From 327a4bdc673aecb036583dd70fff610bd9eb2fbc Mon Sep 17 00:00:00 2001 From: JFH <20402845+jfhenon@users.noreply.github.com> Date: Thu, 13 May 2021 18:26:35 +0200 Subject: [PATCH] read config earlier so lang can be retrieved. --- src/editor/EditorStartup.js | 10 ++++------ src/editor/MainMenu.js | 9 +++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/editor/EditorStartup.js b/src/editor/EditorStartup.js index 367e3ec9..891f749a 100644 --- a/src/editor/EditorStartup.js +++ b/src/editor/EditorStartup.js @@ -61,6 +61,10 @@ class EditorStartup { * @returns {void} */ async init () { + if ('localStorage' in window) { // && onWeb removed so Webkit works locally + this.storage = window.localStorage; + } + this.configObj.load(); const self = this; const { i18next } = await putLocale(this.configObj.pref('lang'), this.goodLangs); this.i18next = i18next; @@ -97,12 +101,6 @@ class EditorStartup { console.error(err); } - if ('localStorage' in window) { // && onWeb removed so Webkit works locally - this.storage = window.localStorage; - } - - this.configObj.load(); - /** * @name module:SVGthis.canvas * @type {module:svgcanvas.SvgCanvas} diff --git a/src/editor/MainMenu.js b/src/editor/MainMenu.js index b07b0425..644bc216 100644 --- a/src/editor/MainMenu.js +++ b/src/editor/MainMenu.js @@ -111,11 +111,8 @@ class MainMenu { // set language if (lang && lang !== this.editor.configObj.pref("lang")) { - const { langParam, langData } = await this.editor.putLocale( - lang, - this.editor.goodLangs - ); - await this.editor.svgCanvassetLang(langParam, langData); + this.editor.configObj.pref("lang", lang); + seAlert('Changing the language needs reload'); } // set grid setting @@ -130,7 +127,7 @@ class MainMenu { this.editor.configObj.curConfig.baseUnit = baseunit; this.editor.svgCanvas.setConfig(this.editor.configObj.curConfig); this.editor.updateCanvas(); - this.editor.hidePreferences(); + this.hidePreferences(); } /**