diff options
Diffstat (limited to 'lang')
-rw-r--r-- | lang/loader.js | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/lang/loader.js b/lang/loader.js index b28e004..205d898 100644 --- a/lang/loader.js +++ b/lang/loader.js @@ -35,12 +35,26 @@ if (typeof native === "boolean" && !native) { global.lang = JSON.parse(window.fetch("./lang/" + lp + ".json").toString());
}
} else {
- try {
- global.lp = require('electron').remote.getCurrentWindow().lp.trim();
- global.lang = JSON.parse(require('fs').readFileSync("./lang/" + lp + ".json").toString());
- } catch (e) {
- console.error(e);
- global.lp = "en";
- global.lang = JSON.parse(require('fs').readFileSync("./lang/" + lp + ".json").toString());
+ if (typeof webview !== "undefined") {
+ console.log("Delaying language files loading");
+ if (location.hash === "#ready") {
+ try {
+ global.lp = require('electron').remote.getCurrentWindow().lp.trim();
+ global.lang = JSON.parse(require('fs').readFileSync("./lang/" + lp + ".json").toString());
+ } catch (e) {
+ console.error(e);
+ global.lp = "en";
+ global.lang = JSON.parse(require('fs').readFileSync("./lang/" + lp + ".json").toString());
+ }
+ }
+ } else {
+ try {
+ global.lp = require('electron').remote.getCurrentWindow().lp.trim();
+ global.lang = JSON.parse(require('fs').readFileSync("./lang/" + lp + ".json").toString());
+ } catch (e) {
+ console.error(e);
+ global.lp = "en";
+ global.lang = JSON.parse(require('fs').readFileSync("./lang/" + lp + ".json").toString());
+ }
}
}
|