improve loading of extension locales with fallback

This commit is contained in:
jfh
2020-09-10 00:54:17 +02:00
parent 9a8b573ca5
commit ff83e4d22e
94 changed files with 267 additions and 354 deletions

View File

@@ -6,13 +6,13 @@
* @copyright 2010 Alexis Deveria
*
*/
import {loadExtensionTranslation} from '../../locale.js';
export default {
name: 'imagelib',
async init ({$, decode64, dropXMLInternalSubset}) {
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: imagelibStrings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const imagelibStrings = await loadExtensionTranslation('imagelib', svgEditor.curPrefs.lang);
const {uiStrings, canvas: svgCanvas} = svgEditor;

View 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>

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index.html',
url: 'extensions/ext-imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index.html',
url: 'extensions/ext-imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index.html',
url: 'extensions/ext-imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index.html',
url: 'extensions/ext-imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index.html',
url: 'extensions/ext-imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index.html',
url: 'extensions/ext-imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index.html',
url: 'extensions/ext-imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index.html',
url: 'extensions/ext-imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index.html',
url: 'extensions/ext-imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{