fix issue with locale extension builds

This commit is contained in:
jfh
2020-09-12 01:27:47 +02:00
parent 16ad1d8342
commit 0d34672c9a
82 changed files with 1881 additions and 418 deletions

View File

@@ -5,7 +5,20 @@
* @copyright 2010 CloudCanvas, Inc. All rights reserved
*
*/
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: 'polygon',
@@ -15,7 +28,7 @@ export default {
const {$} = S, // {svgcontent}
// addElem = svgCanvas.addSVGElementFromJson,
editingitex = false;
const strings = await loadExtensionTranslation('polygon', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
let selElems,
// svgdoc = S.svgroot.parentNode.ownerDocument,
// newFOG, newFOGParent, newDef, newImageName, newMaskID, modeChangeG,