From 2fcdada6864751ec708ace9ccd8c28d6d99aab06 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 10 Aug 2021 16:47:40 +0200 Subject: New loading screen --- lang/loader.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'lang/loader.js') 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()); + } } } -- cgit