diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-10 16:47:40 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-08-10 16:47:40 +0200 |
commit | 2fcdada6864751ec708ace9ccd8c28d6d99aab06 (patch) | |
tree | f5538bf3d5111cc6eff189a75d6780c137e1b56f /lang | |
parent | 8fbfcf981608248929b202cb055000407e6d6c3d (diff) | |
download | kartik-client-2fcdada6864751ec708ace9ccd8c28d6d99aab06.tar.gz kartik-client-2fcdada6864751ec708ace9ccd8c28d6d99aab06.tar.bz2 kartik-client-2fcdada6864751ec708ace9ccd8c28d6d99aab06.zip |
New loading screen
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());
+ }
}
}
|