fix issue with locale extension builds
This commit is contained in:
@@ -6,13 +6,26 @@
|
||||
* @copyright 2010 Christian Tzurcanu, 2010 Alexis Deveria
|
||||
*
|
||||
*/
|
||||
import {loadExtensionTranslation} from '../../locale.js';
|
||||
|
||||
const loadExtensionTranslation = async function (lang) {
|
||||
let translationModule;
|
||||
try {
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
translationModule = await import(`./locale/${lang}.js`);
|
||||
} catch (_error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(`Missing translation (${lang}) - using 'en'`);
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
translationModule = await import(`./locale/en.js`);
|
||||
}
|
||||
return translationModule.default;
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'shapes',
|
||||
async init ({$}) {
|
||||
const svgEditor = this;
|
||||
const strings = await loadExtensionTranslation('shapes', svgEditor.curPrefs.lang);
|
||||
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
|
||||
const canv = svgEditor.canvas;
|
||||
const svgroot = canv.getRootElem();
|
||||
let lastBBox = {};
|
||||
|
||||
Reference in New Issue
Block a user