mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-06 02:48:04 +00:00
refac
This commit is contained in:
parent
c53cd78dcb
commit
de5e0fbc00
1 changed files with 4 additions and 4 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue