diff --git a/locales/hr-HR.yml b/locales/hr-HR.yml deleted file mode 100644 index ed97d539c..000000000 --- a/locales/hr-HR.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/locales/ht-HT.yml b/locales/ht-HT.yml deleted file mode 100644 index ed97d539c..000000000 --- a/locales/ht-HT.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/locales/jbo-EN.yml b/locales/jbo-EN.yml deleted file mode 100644 index ed97d539c..000000000 --- a/locales/jbo-EN.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/locales/si-LK.yml b/locales/si-LK.yml deleted file mode 100644 index ed97d539c..000000000 --- a/locales/si-LK.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/packages/backend/src/server/web/boot.js b/packages/backend/src/server/web/boot.js index b6c862743..0342603c6 100644 --- a/packages/backend/src/server/web/boot.js +++ b/packages/backend/src/server/web/boot.js @@ -22,37 +22,32 @@ renderError('SOMETHING_HAPPENED_IN_PROMISE', e); }; - const v = localStorage.getItem('v') || VERSION; - //#region Detect language & fetch translations - const localeVersion = localStorage.getItem('localeVersion'); - const localeOutdated = (localeVersion == null || localeVersion !== v); - - if (!localStorage.hasOwnProperty('locale') || localeOutdated) { - const supportedLangs = LANGS; - let lang = localStorage.getItem('lang'); - if (lang == null || !supportedLangs.includes(lang)) { - if (supportedLangs.includes(navigator.language)) { - lang = navigator.language; - } else { - lang = supportedLangs.find(x => x.split('-')[0] === navigator.language); - - // Fallback - if (lang == null) lang = 'en-US'; - } - } - - const res = await fetch(`/assets/locales/${lang}.${v}.json`); - if (res.status === 200) { - localStorage.setItem('lang', lang); - localStorage.setItem('locale', await res.text()); - localStorage.setItem('localeVersion', v); + const v = localStorage.getItem('v') || VERSION; + + const supportedLangs = LANGS; + let lang = localStorage.getItem('lang'); + if (lang == null || !supportedLangs.includes(lang)) { + if (supportedLangs.includes(navigator.language)) { + lang = navigator.language; } else { - await checkUpdate(); - renderError('LOCALE_FETCH'); - return; + lang = supportedLangs.find(x => x.split('-')[0] === navigator.language); + + // Fallback + if (lang == null) lang = 'en-US'; } } + + const res = await fetch(`/assets/locales/${lang}.${v}.json`); + if (res.status === 200) { + localStorage.setItem('lang', lang); + localStorage.setItem('locale', await res.text()); + localStorage.setItem('localeVersion', v); + } else { + await checkUpdate(); + renderError('LOCALE_FETCH'); + return; + } //#endregion //#region Script