[Index] Await i18n at start of load instead of async using then

pull/39/head
Oj18 3 years ago
parent 9145e0bd8d
commit 6e31b580c8

@ -7,6 +7,7 @@
- ### Tweaks [progress]
- Added new translators to GooseMod badges
- Changed settings from async waiting for i18n to awaiting i18n at start of load
## v8.7.0 [2021-05-30]

@ -19,13 +19,11 @@ export const setThisScope = (scope) => {
getDiscordLang = getLocaleInfo;
goosemodScope.i18nCheckNewLangInterval = setInterval(checkForNewLang, 1000);
checkForNewLang();
};
let lastLangCode;
const checkForNewLang = async () => {
export const checkForNewLang = async () => {
if (forced) return; // If forced, ignore Discord lang
const { code } = getDiscordLang();
@ -34,7 +32,7 @@ const checkForNewLang = async () => {
// goosemodScope.showToast(`New lang detected`);
updateExports(code);
await updateExports(code);
};
export const updateExports = async (code) => {

@ -108,7 +108,7 @@ const init = async function () {
let a = 1;
for (let x of scopeSetterFncs) {
x(this);
await x(this);
a++;
}
@ -138,20 +138,13 @@ const init = async function () {
this.startLoadingScreen();
this.updateLoadingScreen('Initialising internals...');
// this.updateLoadingScreen('Getting i18n data...');
this.updateLoadingScreen('Getting i18n data...');
await this.i18n.checkForNewLang();
// Wait for i18n to load
(new Promise(async (res) => {
while (!this.i18n.goosemodStrings || !this.i18n.discordStrings) {
await sleep(10);
}
this.updateLoadingScreen('Initialising internals...');
res();
})).then(() => {
this.moduleStoreAPI.updateStoreSetting();
this.settings.makeGooseModSettings();
});
this.moduleStoreAPI.updateStoreSetting();
this.settings.makeGooseModSettings();
this.moduleStoreAPI.initRepoURLs();

Loading…
Cancel
Save