1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-26 12:12:31 +01:00
server/assets/preload-plugins/checkLocale.js

38 lines
557 B
JavaScript
Raw Normal View History

2022-10-24 09:59:53 +02:00
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"
];
2022-10-26 07:36:54 +02:00
const settings = JSON.parse(window.localStorage.getItem("UserSettingsStore"));
2022-10-24 09:59:53 +02:00
if (settings && !supportedLocales.includes(settings.locale)) {
// fix client locale wrong and client not loading at all
settings.locale = "en-US";
2022-10-26 07:36:54 +02:00
window.localStorage.setItem("UserSettingsStore", JSON.stringify(settings));
2022-10-24 09:59:53 +02:00
}