summary refs log tree commit diff
path: root/api/assets/checkLocale.js
diff options
context:
space:
mode:
authorThesourtimes <cckhmck@gmail.com>2021-11-11 11:49:56 +0300
committerThesourtimes <cckhmck@gmail.com>2021-11-11 11:49:56 +0300
commit31ed39e06451a6e050c6c92a8ab52992a7aa284f (patch)
tree3f37fe687422996360c8061fde1fc5cc043e3238 /api/assets/checkLocale.js
parentminor capitulation (diff)
downloadserver-31ed39e06451a6e050c6c92a8ab52992a7aa284f.tar.xz
move checLocale and other js tp checkLocale
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