diff --git a/assets/modules/i18n.ts b/assets/modules/i18n.ts index 2b16e9ccb548..f57f9d089277 100644 --- a/assets/modules/i18n.ts +++ b/assets/modules/i18n.ts @@ -7,9 +7,15 @@ const messages = Object.fromEntries( return [key.slice(14, yaml ? -5 : -4), value.default]; }), ); + +const userLang = navigator.language; +const shortLang = userLang.slice(0, 2); + +const locale = messages.hasOwnProperty(userLang) ? userLang : shortLang; + const i18n = createI18n({ legacy: false, - locale: navigator.language.slice(0, 2), + locale: locale, fallbackLocale: "en", messages, });