chore(i18n): migrate i18n to TypeScript

Updated i18n module to .ts and added type annotations.
This commit is contained in:
jakob.scheid committed 2026-10-25 02:36:17 +02:00
1 parent 6bfef99cda
commit a4a857062b
1 file changed
+7 -3
+7 -3
View File
@@ -28,9 +28,11 @@ export const i18n = createI18n({
messages: {},
});
const loadedLanguages = new Set();
const loadedLanguages = new Set<string>();
export const loadLanguage = async function loadLanguage(locale) {
export const loadLanguage = async function loadLanguage(
locale: string,
): Promise<void> {
if (!SUPPORTED_LANGUAGES.includes(locale)) {
locale = fallbackLocale;
}
@@ -48,7 +50,9 @@ export const loadLanguage = async function loadLanguage(locale) {
loadedLanguages.add(locale);
};
export const setLocale = async function setLocale(locale) {
export const setLocale = async function setLocale(
locale: string,
): Promise<void> {
await loadLanguage(locale);
document.documentElement.lang = locale;
document.documentElement.dir = LANGUAGES_RTL.includes(locale)