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

@@ -6,13 +6,26 @@
* @copyright 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: 'arrows',
async init (S) {
const svgEditor = this;
const strings = await loadExtensionTranslation('arrows', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const svgCanvas = svgEditor.canvas;
const
addElem = svgCanvas.addSVGElementFromJson,

View File

@@ -6,16 +6,29 @@
* @copyright 2010 Jeff Schiller
*
*/
import {loadExtensionTranslation} from '../../locale.js';
import '../../../common/svgpathseg.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;
};
// This extension adds a simple button to the contextual panel for paths
// The button toggles whether the path is open or closed
export default {
name: 'closepath',
async init ({importLocale, $}) {
const svgEditor = this;
const strings = await loadExtensionTranslation('closepath', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
let selElems;
const updateButton = function (path) {
const seglist = path.pathSegList,

View File

@@ -6,7 +6,20 @@
* @copyright 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: 'connector',
@@ -351,7 +364,7 @@ export default {
}
}
}];
const strings = await loadExtensionTranslation('connector', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
return {
name: strings.name,
svgicons: 'conn.svg',

View File

@@ -7,13 +7,25 @@
*
*/
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: 'eyedropper',
async init (S) {
const svgEditor = this;
const strings = await loadExtensionTranslation('eyedropper', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const {$, ChangeElementCommand} = S, // , svgcontent,
// svgdoc = S.svgroot.parentNode.ownerDocument,
svgCanvas = svgEditor.canvas,

View File

@@ -7,7 +7,19 @@
*
*/
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: 'foreignobject',
@@ -20,7 +32,7 @@ export default {
// addElem = svgCanvas.addSVGElementFromJson,
svgdoc = S.svgroot.parentNode.ownerDocument;
const strings = await loadExtensionTranslation('foreignobject', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const properlySourceSizeTextArea = function () {
// TODO: remove magic numbers here and get values from CSS

View File

@@ -6,13 +6,26 @@
* @copyright 2010 Redou Mine, 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: 'grid',
async init ({$, NS, getTypeMap}) {
const svgEditor = this;
const strings = await loadExtensionTranslation('grid', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const svgCanvas = svgEditor.canvas;
const svgdoc = document.getElementById('svgcanvas').ownerDocument,
{assignAttributes} = svgCanvas,

View File

@@ -12,13 +12,26 @@
* the left ("mode") panel. Clicking on the button, and then the canvas
* will show the user the point on the canvas that was clicked on.
*/
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: 'helloworld',
async init ({$, importLocale}) {
const svgEditor = this;
const strings = await loadExtensionTranslation('helloworld', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const svgCanvas = svgEditor.canvas;
return {
name: strings.name,

View File

@@ -6,13 +6,26 @@
* @copyright 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: 'imagelib',
async init ({$, decode64, dropXMLInternalSubset}) {
const svgEditor = this;
const imagelibStrings = await loadExtensionTranslation('imagelib', svgEditor.curPrefs.lang);
const imagelibStrings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const {uiStrings, canvas: svgCanvas} = svgEditor;

View File

@@ -28,13 +28,26 @@
* add support for dimension extension lines
*
*/
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: 'markers',
async init (S) {
const svgEditor = this;
const strings = await loadExtensionTranslation('markers', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const {$} = S;
const svgCanvas = svgEditor.canvas;
const // {svgcontent} = S,

View File

@@ -7,13 +7,26 @@
* @copyright 2013 Jo Segaert
*
*/
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: 'mathjax',
async init ({$}) {
const svgEditor = this;
const strings = await loadExtensionTranslation('mathjax', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const svgCanvas = svgEditor.canvas;
// Configuration of the MathJax extention.

View File

@@ -9,13 +9,26 @@
/*
This is a very basic SVG-Edit extension to let tablet/mobile devices pan without problem
*/
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: 'panning',
async init ({importLocale}) {
const svgEditor = this;
const strings = await loadExtensionTranslation('panning', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const svgCanvas = svgEditor.canvas;
const buttons = [{
id: 'ext-panning',

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: 'placemark',
@@ -24,7 +37,7 @@ export default {
// newFOG, newFOGParent, newDef, newImageName, newMaskID,
// undoCommand = 'Not image',
// modeChangeG, ccZoom, wEl, hEl, wOffset, hOffset, ccRgbEl, brushW, brushH;
const strings = await loadExtensionTranslation('placemark', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const markerTypes = {
nomarker: {},
forwardslash:

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,

View File

@@ -8,13 +8,26 @@
* (I agree to dual license my work to additional GPLv2 or later)
*/
import {canvg} from '../../../external/canvg/canvg.js';
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: 'server_moinsave',
async init ({$, encode64, importLocale}) {
const svgEditor = this;
const strings = await loadExtensionTranslation('server_moinsave', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const svgCanvas = svgEditor.canvas;
const saveSvgAction = '/+modify';

View File

@@ -7,13 +7,26 @@
*
*/
import {canvg} from '../../../external/canvg/canvg.js';
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: 'server_opensave',
async init ({$, decode64, encode64}) {
const svgEditor = this;
const strings = await loadExtensionTranslation('server_opensave', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const {
curConfig: {
extPath,

View File

@@ -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 = {};

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: 'star',
@@ -24,7 +37,7 @@ export default {
// newFOG, newFOGParent, newDef, newImageName, newMaskID,
// undoCommand = 'Not image',
// modeChangeG, ccZoom, wEl, hEl, wOffset, hOffset, ccRgbEl, brushW, brushH;
const strings = await loadExtensionTranslation('star', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
/**
*

View File

@@ -19,7 +19,19 @@
* initial (or URL-forced) dialog. *
*/
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: 'storage',
@@ -169,7 +181,7 @@ export default {
name: 'storage',
async langReady ({lang}) {
const storagePrompt = new URL(top.location).searchParams.get('storagePrompt');
const strings = await loadExtensionTranslation('storage', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const {
message, storagePrefsAndContent, storagePrefsOnly,
storagePrefs, storageNoPrefsOrContent, storageNoPrefs,

View File

@@ -5,13 +5,26 @@
* @license MIT
* @todo See WebAppFind Readme for SVG-related todos
*/
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: 'webappfind',
async init ({$}) {
const svgEditor = this;
const strings = await loadExtensionTranslation('webappfind', svgEditor.curPrefs.lang);
const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang);
const saveMessage = 'save',
readMessage = 'read',
excludedMessages = [readMessage, saveMessage];