summary refs log tree commit diff
path: root/api/assets/checkLocale.js
diff options
context:
space:
mode:
authorSamuel <34555296+Flam3rboy@users.noreply.github.com>2021-11-11 10:54:29 +0100
committerGitHub <noreply@github.com>2021-11-11 10:54:29 +0100
commitfba18e4c01f8be99c1eeacaaab9888f4e4f79a1e (patch)
tree3f37fe687422996360c8061fde1fc5cc043e3238 /api/assets/checkLocale.js
parentMerge pull request #501 from Thesourtimes/master (diff)
parentmove checLocale and other js tp checkLocale (diff)
downloadserver-fba18e4c01f8be99c1eeacaaab9888f4e4f79a1e.tar.xz
Merge pull request #508 from Thesourtimes/master
Move unimported tag scripts to assets/ in Test Client
Diffstat (limited to 'api/assets/checkLocale.js')
-rw-r--r--api/assets/checkLocale.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/api/assets/checkLocale.js b/api/assets/checkLocale.js
new file mode 100644

index 00000000..016d66c8 --- /dev/null +++ b/api/assets/checkLocale.js
@@ -0,0 +1,47 @@ + const localStorage = window.localStorage; + // TODO: remote auth + // window.GLOBAL_ENV.REMOTE_AUTH_ENDPOINT = window.GLOBAL_ENV.GATEWAY_ENDPOINT.replace(/wss?:/, ""); + localStorage.setItem("gatewayURL", window.GLOBAL_ENV.GATEWAY_ENDPOINT); + localStorage.setItem( + "DeveloperOptionsStore", + `{"trace":false,"canary":false,"logGatewayEvents":true,"logOverlayEvents":true,"logAnalyticsEvents":true,"sourceMapsEnabled":false,"axeEnabled":false}` + ); + + const supportedLocales = [ + "bg", + "cs", + "da", + "de", + "el", + "en-GB", + "es-ES", + "fi", + "fr", + "hi", + "hr", + "hu", + "it", + "ja", + "ko", + "lt", + "nl", + "no", + "pl", + "pt-BR", + "ro", + "ru", + "sv-SE", + "th", + "tr", + "uk", + "vi", + "zh-CN", + "zh-TW" + ]; + + const settings = JSON.parse(localStorage.getItem("UserSettingsStore")); + if (settings && !supportedLocales.includes(settings.locale)) { + // fix client locale wrong and client not loading at all + settings.locale = "en-US"; + localStorage.setItem("UserSettingsStore", JSON.stringify(settings)); + } \ No newline at end of file