read config earlier so lang can be retrieved.

master
JFH 2021-05-13 18:26:35 +02:00
parent 7710069ff3
commit 327a4bdc67
2 changed files with 7 additions and 12 deletions

View File

@ -61,6 +61,10 @@ class EditorStartup {
* @returns {void} * @returns {void}
*/ */
async init () { async init () {
if ('localStorage' in window) { // && onWeb removed so Webkit works locally
this.storage = window.localStorage;
}
this.configObj.load();
const self = this; const self = this;
const { i18next } = await putLocale(this.configObj.pref('lang'), this.goodLangs); const { i18next } = await putLocale(this.configObj.pref('lang'), this.goodLangs);
this.i18next = i18next; this.i18next = i18next;
@ -97,12 +101,6 @@ class EditorStartup {
console.error(err); console.error(err);
} }
if ('localStorage' in window) { // && onWeb removed so Webkit works locally
this.storage = window.localStorage;
}
this.configObj.load();
/** /**
* @name module:SVGthis.canvas * @name module:SVGthis.canvas
* @type {module:svgcanvas.SvgCanvas} * @type {module:svgcanvas.SvgCanvas}

View File

@ -111,11 +111,8 @@ class MainMenu {
// set language // set language
if (lang && lang !== this.editor.configObj.pref("lang")) { if (lang && lang !== this.editor.configObj.pref("lang")) {
const { langParam, langData } = await this.editor.putLocale( this.editor.configObj.pref("lang", lang);
lang, seAlert('Changing the language needs reload');
this.editor.goodLangs
);
await this.editor.svgCanvassetLang(langParam, langData);
} }
// set grid setting // set grid setting
@ -130,7 +127,7 @@ class MainMenu {
this.editor.configObj.curConfig.baseUnit = baseunit; this.editor.configObj.curConfig.baseUnit = baseunit;
this.editor.svgCanvas.setConfig(this.editor.configObj.curConfig); this.editor.svgCanvas.setConfig(this.editor.configObj.curConfig);
this.editor.updateCanvas(); this.editor.updateCanvas();
this.editor.hidePreferences(); this.hidePreferences();
} }
/** /**