Local (#94)
* add i18next package for localisation * progress * update dep and fix 2 bugs * remove report as this seems to hang ci * Update package.json * add package to kill server when tests end
This commit is contained in:
@@ -7,8 +7,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const loadExtensionTranslation = async function (lang) {
|
||||
const loadExtensionTranslation = async function (svgEditor) {
|
||||
let translationModule;
|
||||
const lang = svgEditor.configObj.pref('lang')
|
||||
try {
|
||||
translationModule = await import(`./locale/${encodeURIComponent(lang)}.js`);
|
||||
} catch (_error) {
|
||||
@@ -23,7 +24,7 @@ export default {
|
||||
name: 'arrows',
|
||||
async init (S) {
|
||||
const svgEditor = this;
|
||||
const strings = await loadExtensionTranslation(svgEditor.configObj.pref('lang'));
|
||||
const strings = await loadExtensionTranslation(svgEditor);
|
||||
const {svgCanvas} = svgEditor;
|
||||
const {$id} = svgCanvas;
|
||||
const
|
||||
|
||||
@@ -44,7 +44,7 @@ export default {
|
||||
const done = this.configObj.pref('save_notice_done');
|
||||
|
||||
if (done !== 'all') {
|
||||
const note = this.uiStrings.notification.saveFromBrowser.replace('%s', 'SVG');
|
||||
const note = svgEditor.i18next.t('notification.saveFromBrowser', { type: 'SVG'});
|
||||
|
||||
this.configObj.pref('save_notice_done', 'all');
|
||||
if (done !== 'part') {
|
||||
|
||||
@@ -58,7 +58,7 @@ export default {
|
||||
name: 'storage',
|
||||
init ({$}) {
|
||||
const svgEditor = this;
|
||||
const {svgCanvas} = svgEditor;
|
||||
const {svgCanvas, storage} = svgEditor;
|
||||
|
||||
// We could empty any already-set data for users when they decline storage,
|
||||
// but it would be a risk for users who wanted to store but accidentally
|
||||
@@ -78,7 +78,6 @@ export default {
|
||||
noStorageOnLoad,
|
||||
forceStorage
|
||||
} = svgEditor.configObj.curConfig;
|
||||
const {storage} = svgEditor;
|
||||
|
||||
// storageDialog added to DOM
|
||||
const storageBox = document.createElement('se-storage-dialog');
|
||||
@@ -184,7 +183,7 @@ export default {
|
||||
let loaded = false;
|
||||
return {
|
||||
name: 'storage',
|
||||
langReady ({lang}) {
|
||||
callback () {
|
||||
const storagePrompt = new URL(top.location).searchParams.get('storagePrompt');
|
||||
// No need to run this one-time dialog again just because the user
|
||||
// changes the language
|
||||
|
||||
Reference in New Issue
Block a user