mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-12 13:29:37 +02:00
refac
This commit is contained in:
@@ -14,8 +14,11 @@ const createI18nStore = (i18n: i18nType) => {
|
||||
i18nWritable.set(i18n);
|
||||
});
|
||||
i18n.on('added', () => i18nWritable.set(i18n));
|
||||
i18n.on('languageChanged', () => {
|
||||
i18n.on('languageChanged', (lang) => {
|
||||
i18nWritable.set(i18n);
|
||||
if (typeof document !== 'undefined') {
|
||||
document.documentElement.setAttribute('lang', lang);
|
||||
}
|
||||
});
|
||||
return i18nWritable;
|
||||
};
|
||||
@@ -67,9 +70,6 @@ export const initI18n = (defaultLocale?: string | undefined) => {
|
||||
escapeValue: false // not needed for svelte as it escapes by default
|
||||
}
|
||||
});
|
||||
|
||||
const lang = i18next?.language || defaultLocale || 'en-US';
|
||||
document.documentElement.setAttribute('lang', lang);
|
||||
};
|
||||
|
||||
const i18n = createI18nStore(i18next);
|
||||
|
||||
Reference in New Issue
Block a user