improve loading of extension locales with fallback
This commit is contained in:
10
dist/editor/extensions/ext-arrows/ext-arrows.js
vendored
10
dist/editor/extensions/ext-arrows/ext-arrows.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
14
dist/editor/extensions/ext-grid/ext-grid.js
vendored
14
dist/editor/extensions/ext-grid/ext-grid.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10
dist/editor/extensions/ext-shapes/ext-shapes.js
vendored
10
dist/editor/extensions/ext-shapes/ext-shapes.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
dist/editor/extensions/ext-star/ext-star.js
vendored
2
dist/editor/extensions/ext-star/ext-star.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
dist/editor/index.js
vendored
4
dist/editor/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/editor/index.js.map
vendored
2
dist/editor/index.js.map
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
dist/editor/system/index.js
vendored
4
dist/editor/system/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -6,13 +6,13 @@
|
|||||||
* @copyright 2010 Alexis Deveria
|
* @copyright 2010 Alexis Deveria
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'arrows',
|
name: 'arrows',
|
||||||
async init (S) {
|
async init (S) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('arrows', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const svgCanvas = svgEditor.canvas;
|
const svgCanvas = svgEditor.canvas;
|
||||||
const
|
const
|
||||||
addElem = svgCanvas.addSVGElementFromJson,
|
addElem = svgCanvas.addSVGElementFromJson,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
* @copyright 2010 Jeff Schiller
|
* @copyright 2010 Jeff Schiller
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
import '../../../common/svgpathseg.js';
|
import '../../../common/svgpathseg.js';
|
||||||
|
|
||||||
// This extension adds a simple button to the contextual panel for paths
|
// This extension adds a simple button to the contextual panel for paths
|
||||||
@@ -13,7 +14,8 @@ import '../../../common/svgpathseg.js';
|
|||||||
export default {
|
export default {
|
||||||
name: 'closepath',
|
name: 'closepath',
|
||||||
async init ({importLocale, $}) {
|
async init ({importLocale, $}) {
|
||||||
const strings = await importLocale();
|
const svgEditor = this;
|
||||||
|
const strings = await loadExtensionTranslation('closepath', svgEditor.curPrefs.lang);
|
||||||
let selElems;
|
let selElems;
|
||||||
const updateButton = function (path) {
|
const updateButton = function (path) {
|
||||||
const seglist = path.pathSegList,
|
const seglist = path.pathSegList,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
* @copyright 2010 Alexis Deveria
|
* @copyright 2010 Alexis Deveria
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'connector',
|
name: 'connector',
|
||||||
@@ -350,8 +351,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('connector', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
return {
|
return {
|
||||||
name: strings.name,
|
name: strings.name,
|
||||||
svgicons: 'conn.svg',
|
svgicons: 'conn.svg',
|
||||||
|
|||||||
@@ -7,12 +7,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'eyedropper',
|
name: 'eyedropper',
|
||||||
async init (S) {
|
async init (S) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('eyedropper', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const {$, ChangeElementCommand} = S, // , svgcontent,
|
const {$, ChangeElementCommand} = S, // , svgcontent,
|
||||||
// svgdoc = S.svgroot.parentNode.ownerDocument,
|
// svgdoc = S.svgroot.parentNode.ownerDocument,
|
||||||
svgCanvas = svgEditor.canvas,
|
svgCanvas = svgEditor.canvas,
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'foreignobject',
|
name: 'foreignobject',
|
||||||
async init (S) {
|
async init (S) {
|
||||||
@@ -17,8 +19,8 @@ export default {
|
|||||||
// {svgcontent} = S,
|
// {svgcontent} = S,
|
||||||
// addElem = svgCanvas.addSVGElementFromJson,
|
// addElem = svgCanvas.addSVGElementFromJson,
|
||||||
svgdoc = S.svgroot.parentNode.ownerDocument;
|
svgdoc = S.svgroot.parentNode.ownerDocument;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
const strings = await loadExtensionTranslation('foreignobject', svgEditor.curPrefs.lang);
|
||||||
|
|
||||||
const properlySourceSizeTextArea = function () {
|
const properlySourceSizeTextArea = function () {
|
||||||
// TODO: remove magic numbers here and get values from CSS
|
// TODO: remove magic numbers here and get values from CSS
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
* @copyright 2010 Redou Mine, 2010 Alexis Deveria
|
* @copyright 2010 Redou Mine, 2010 Alexis Deveria
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'grid',
|
name: 'grid',
|
||||||
async init ({$, NS, getTypeMap}) {
|
async init ({$, NS, getTypeMap}) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('grid', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const svgCanvas = svgEditor.canvas;
|
const svgCanvas = svgEditor.canvas;
|
||||||
const svgdoc = document.getElementById('svgcanvas').ownerDocument,
|
const svgdoc = document.getElementById('svgcanvas').ownerDocument,
|
||||||
{assignAttributes} = svgCanvas,
|
{assignAttributes} = svgCanvas,
|
||||||
|
|||||||
@@ -12,12 +12,13 @@
|
|||||||
* the left ("mode") panel. Clicking on the button, and then the canvas
|
* 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.
|
* will show the user the point on the canvas that was clicked on.
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'helloworld',
|
name: 'helloworld',
|
||||||
async init ({$, importLocale}) {
|
async init ({$, importLocale}) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('helloworld', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const svgCanvas = svgEditor.canvas;
|
const svgCanvas = svgEditor.canvas;
|
||||||
return {
|
return {
|
||||||
name: strings.name,
|
name: strings.name,
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
* @copyright 2010 Alexis Deveria
|
* @copyright 2010 Alexis Deveria
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'imagelib',
|
name: 'imagelib',
|
||||||
async init ({$, decode64, dropXMLInternalSubset}) {
|
async init ({$, decode64, dropXMLInternalSubset}) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const imagelibStrings = await loadExtensionTranslation('imagelib', svgEditor.curPrefs.lang);
|
||||||
const {default: imagelibStrings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
|
|
||||||
const {uiStrings, canvas: svgCanvas} = svgEditor;
|
const {uiStrings, canvas: svgCanvas} = svgEditor;
|
||||||
|
|
||||||
|
|||||||
29
src/editor/extensions/ext-imagelib/index.html
Normal file
29
src/editor/extensions/ext-imagelib/index.html
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>-</title>
|
||||||
|
<link rel="icon" type="image/png" href="../../images/logo.png" />
|
||||||
|
|
||||||
|
<!-- Lacking browser support -->
|
||||||
|
<script nomodule="" src="../../redirect-on-no-module-support.js"></script>
|
||||||
|
<script type="module" src="../../redirect-on-lacking-support.js"></script>
|
||||||
|
|
||||||
|
<!-- As yet no ES6 -->
|
||||||
|
<script src="../../jquery.min.js"></script>
|
||||||
|
|
||||||
|
<!-- ES6+ polyfills (Babel) -->
|
||||||
|
<script src="../../external/core-js-bundle/minified.js"></script>
|
||||||
|
<script src="../../external/regenerator-runtime/runtime.js"></script>
|
||||||
|
|
||||||
|
<script type="module" src="index.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>Select an image:</h1>
|
||||||
|
<a href="smiley.svg">smiley.svg</a>
|
||||||
|
<br/>
|
||||||
|
<a href="../../images/logo.png">logo.png</a>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -12,7 +12,7 @@ export default {
|
|||||||
imgLibs: [
|
imgLibs: [
|
||||||
{
|
{
|
||||||
name: 'Demo library (local)',
|
name: 'Demo library (local)',
|
||||||
url: '{path}imagelib/index.html',
|
url: 'extensions/ext-imagelib/index.html',
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default {
|
|||||||
imgLibs: [
|
imgLibs: [
|
||||||
{
|
{
|
||||||
name: 'Demo library (local)',
|
name: 'Demo library (local)',
|
||||||
url: '{path}imagelib/index.html',
|
url: 'extensions/ext-imagelib/index.html',
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default {
|
|||||||
imgLibs: [
|
imgLibs: [
|
||||||
{
|
{
|
||||||
name: 'Demo library (local)',
|
name: 'Demo library (local)',
|
||||||
url: '{path}imagelib/index.html',
|
url: 'extensions/ext-imagelib/index.html',
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default {
|
|||||||
imgLibs: [
|
imgLibs: [
|
||||||
{
|
{
|
||||||
name: 'Demo library (local)',
|
name: 'Demo library (local)',
|
||||||
url: '{path}imagelib/index.html',
|
url: 'extensions/ext-imagelib/index.html',
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default {
|
|||||||
imgLibs: [
|
imgLibs: [
|
||||||
{
|
{
|
||||||
name: 'Demo library (local)',
|
name: 'Demo library (local)',
|
||||||
url: '{path}imagelib/index.html',
|
url: 'extensions/ext-imagelib/index.html',
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default {
|
|||||||
imgLibs: [
|
imgLibs: [
|
||||||
{
|
{
|
||||||
name: 'Demo library (local)',
|
name: 'Demo library (local)',
|
||||||
url: '{path}imagelib/index.html',
|
url: 'extensions/ext-imagelib/index.html',
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default {
|
|||||||
imgLibs: [
|
imgLibs: [
|
||||||
{
|
{
|
||||||
name: 'Demo library (local)',
|
name: 'Demo library (local)',
|
||||||
url: '{path}imagelib/index.html',
|
url: 'extensions/ext-imagelib/index.html',
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default {
|
|||||||
imgLibs: [
|
imgLibs: [
|
||||||
{
|
{
|
||||||
name: 'Demo library (local)',
|
name: 'Demo library (local)',
|
||||||
url: '{path}imagelib/index.html',
|
url: 'extensions/ext-imagelib/index.html',
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default {
|
|||||||
imgLibs: [
|
imgLibs: [
|
||||||
{
|
{
|
||||||
name: 'Demo library (local)',
|
name: 'Demo library (local)',
|
||||||
url: '{path}imagelib/index.html',
|
url: 'extensions/ext-imagelib/index.html',
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,13 +28,13 @@
|
|||||||
* add support for dimension extension lines
|
* add support for dimension extension lines
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'markers',
|
name: 'markers',
|
||||||
async init (S) {
|
async init (S) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('markers', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const {$} = S;
|
const {$} = S;
|
||||||
const svgCanvas = svgEditor.canvas;
|
const svgCanvas = svgEditor.canvas;
|
||||||
const // {svgcontent} = S,
|
const // {svgcontent} = S,
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
* @copyright 2013 Jo Segaert
|
* @copyright 2013 Jo Segaert
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'mathjax',
|
name: 'mathjax',
|
||||||
async init ({$}) {
|
async init ({$}) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('mathjax', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const svgCanvas = svgEditor.canvas;
|
const svgCanvas = svgEditor.canvas;
|
||||||
|
|
||||||
// Configuration of the MathJax extention.
|
// Configuration of the MathJax extention.
|
||||||
|
|||||||
@@ -9,13 +9,13 @@
|
|||||||
/*
|
/*
|
||||||
This is a very basic SVG-Edit extension to let tablet/mobile devices pan without problem
|
This is a very basic SVG-Edit extension to let tablet/mobile devices pan without problem
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'panning',
|
name: 'panning',
|
||||||
async init ({importLocale}) {
|
async init ({importLocale}) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('panning', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const svgCanvas = svgEditor.canvas;
|
const svgCanvas = svgEditor.canvas;
|
||||||
const buttons = [{
|
const buttons = [{
|
||||||
id: 'ext-panning',
|
id: 'ext-panning',
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
* @copyright 2010 CloudCanvas, Inc. All rights reserved
|
* @copyright 2010 CloudCanvas, Inc. All rights reserved
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'placemark',
|
name: 'placemark',
|
||||||
async init (S) {
|
async init (S) {
|
||||||
@@ -22,8 +24,7 @@ export default {
|
|||||||
// newFOG, newFOGParent, newDef, newImageName, newMaskID,
|
// newFOG, newFOGParent, newDef, newImageName, newMaskID,
|
||||||
// undoCommand = 'Not image',
|
// undoCommand = 'Not image',
|
||||||
// modeChangeG, ccZoom, wEl, hEl, wOffset, hOffset, ccRgbEl, brushW, brushH;
|
// modeChangeG, ccZoom, wEl, hEl, wOffset, hOffset, ccRgbEl, brushW, brushH;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('placemark', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const markerTypes = {
|
const markerTypes = {
|
||||||
nomarker: {},
|
nomarker: {},
|
||||||
forwardslash:
|
forwardslash:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* @copyright 2010 CloudCanvas, Inc. All rights reserved
|
* @copyright 2010 CloudCanvas, Inc. All rights reserved
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'polygon',
|
name: 'polygon',
|
||||||
@@ -14,8 +15,7 @@ export default {
|
|||||||
const {$} = S, // {svgcontent}
|
const {$} = S, // {svgcontent}
|
||||||
// addElem = svgCanvas.addSVGElementFromJson,
|
// addElem = svgCanvas.addSVGElementFromJson,
|
||||||
editingitex = false;
|
editingitex = false;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('polygon', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
let selElems,
|
let selElems,
|
||||||
// svgdoc = S.svgroot.parentNode.ownerDocument,
|
// svgdoc = S.svgroot.parentNode.ownerDocument,
|
||||||
// newFOG, newFOGParent, newDef, newImageName, newMaskID, modeChangeG,
|
// newFOG, newFOGParent, newDef, newImageName, newMaskID, modeChangeG,
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
* (I agree to dual license my work to additional GPLv2 or later)
|
* (I agree to dual license my work to additional GPLv2 or later)
|
||||||
*/
|
*/
|
||||||
import {canvg} from '../../../external/canvg/canvg.js';
|
import {canvg} from '../../../external/canvg/canvg.js';
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'server_moinsave',
|
name: 'server_moinsave',
|
||||||
async init ({$, encode64, importLocale}) {
|
async init ({$, encode64, importLocale}) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('server_moinsave', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const svgCanvas = svgEditor.canvas;
|
const svgCanvas = svgEditor.canvas;
|
||||||
const saveSvgAction = '/+modify';
|
const saveSvgAction = '/+modify';
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import {canvg} from '../../../external/canvg/canvg.js';
|
import {canvg} from '../../../external/canvg/canvg.js';
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'server_opensave',
|
name: 'server_opensave',
|
||||||
async init ({$, decode64, encode64}) {
|
async init ({$, decode64, encode64}) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('server_opensave', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const {
|
const {
|
||||||
curConfig: {
|
curConfig: {
|
||||||
extPath,
|
extPath,
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
* @copyright 2010 Christian Tzurcanu, 2010 Alexis Deveria
|
* @copyright 2010 Christian Tzurcanu, 2010 Alexis Deveria
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'shapes',
|
name: 'shapes',
|
||||||
async init ({$}) {
|
async init ({$}) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('shapes', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const canv = svgEditor.canvas;
|
const canv = svgEditor.canvas;
|
||||||
const svgroot = canv.getRootElem();
|
const svgroot = canv.getRootElem();
|
||||||
let lastBBox = {};
|
let lastBBox = {};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* @copyright 2010 CloudCanvas, Inc. All rights reserved
|
* @copyright 2010 CloudCanvas, Inc. All rights reserved
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'star',
|
name: 'star',
|
||||||
@@ -23,8 +24,7 @@ export default {
|
|||||||
// newFOG, newFOGParent, newDef, newImageName, newMaskID,
|
// newFOG, newFOGParent, newDef, newImageName, newMaskID,
|
||||||
// undoCommand = 'Not image',
|
// undoCommand = 'Not image',
|
||||||
// modeChangeG, ccZoom, wEl, hEl, wOffset, hOffset, ccRgbEl, brushW, brushH;
|
// modeChangeG, ccZoom, wEl, hEl, wOffset, hOffset, ccRgbEl, brushW, brushH;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('star', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
* initial (or URL-forced) dialog. *
|
* initial (or URL-forced) dialog. *
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'storage',
|
name: 'storage',
|
||||||
init ({$}) {
|
init ({$}) {
|
||||||
@@ -167,13 +169,12 @@ export default {
|
|||||||
name: 'storage',
|
name: 'storage',
|
||||||
async langReady ({lang}) {
|
async langReady ({lang}) {
|
||||||
const storagePrompt = new URL(top.location).searchParams.get('storagePrompt');
|
const storagePrompt = new URL(top.location).searchParams.get('storagePrompt');
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('storage', svgEditor.curPrefs.lang);
|
||||||
const {default: confirmSetStorage} = await import(`./locale/${lang}.js`);
|
|
||||||
const {
|
const {
|
||||||
message, storagePrefsAndContent, storagePrefsOnly,
|
message, storagePrefsAndContent, storagePrefsOnly,
|
||||||
storagePrefs, storageNoPrefsOrContent, storageNoPrefs,
|
storagePrefs, storageNoPrefsOrContent, storageNoPrefs,
|
||||||
rememberLabel, rememberTooltip
|
rememberLabel, rememberTooltip
|
||||||
} = confirmSetStorage;
|
} = strings;
|
||||||
|
|
||||||
// No need to run this one-time dialog again just because the user
|
// No need to run this one-time dialog again just because the user
|
||||||
// changes the language
|
// changes the language
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
* @todo See WebAppFind Readme for SVG-related todos
|
* @todo See WebAppFind Readme for SVG-related todos
|
||||||
*/
|
*/
|
||||||
|
import {loadExtensionTranslation} from '../../locale.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'webappfind',
|
name: 'webappfind',
|
||||||
async init ({$}) {
|
async init ({$}) {
|
||||||
const svgEditor = this;
|
const svgEditor = this;
|
||||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
const strings = await loadExtensionTranslation('webappfind', svgEditor.curPrefs.lang);
|
||||||
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
|
|
||||||
const saveMessage = 'save',
|
const saveMessage = 'save',
|
||||||
readMessage = 'read',
|
readMessage = 'read',
|
||||||
excludedMessages = [readMessage, saveMessage];
|
excludedMessages = [readMessage, saveMessage];
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* but an API common for cross-domain and same domain use can be found
|
* but an API common for cross-domain and same domain use can be found
|
||||||
* in embedapi.js with a demo at embedapi.html.
|
* in embedapi.js with a demo at embedapi.html.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'xdomain-messaging',
|
name: 'xdomain-messaging',
|
||||||
init () {
|
init () {
|
||||||
|
|||||||
@@ -364,3 +364,24 @@ export const putLocale = async function (givenParam, goodLangs) {
|
|||||||
const module = await import(`./locale/lang.${langParam}.js`);
|
const module = await import(`./locale/lang.${langParam}.js`);
|
||||||
return readLang(module.default);
|
return readLang(module.default);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @function module:locale.loadExtensionTranslation
|
||||||
|
* @param {string} extensionName
|
||||||
|
* @param {string} lang
|
||||||
|
* @returns {string} lang will will returned if the translation exists else it will be 'en'
|
||||||
|
*/
|
||||||
|
export const loadExtensionTranslation = async function (extensionName, lang) {
|
||||||
|
let translationModule;
|
||||||
|
try {
|
||||||
|
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||||
|
translationModule = await import(`./extensions/ext-${extensionName}/locale/${lang}.js`);
|
||||||
|
} catch (_error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(`Missing translation (${lang}) for extension ${extensionName} - using 'en'`);
|
||||||
|
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||||
|
translationModule = await import(`./extensions/ext-${extensionName}/locale/en.js`);
|
||||||
|
}
|
||||||
|
return translationModule.default;
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user