mirror of
https://github.com/zadam/trilium.git
synced 2025-11-14 17:25:52 +01:00
fix(website/i18n): header sometimes not correctly translated
This commit is contained in:
@@ -52,14 +52,15 @@ export function LocaleProvider({ children }) {
|
||||
},
|
||||
returnEmptyString: false
|
||||
}).then(() => setLoaded(true))
|
||||
}, []);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
useLayoutEffect(() => {
|
||||
if (!loaded) return;
|
||||
changeLanguage(localeId);
|
||||
const correspondingLocale = LOCALES.find(l => l.id === localeId);
|
||||
document.documentElement.lang = localeId;
|
||||
document.documentElement.dir = correspondingLocale?.rtl ? "rtl" : "ltr";
|
||||
}, [ localeId ]);
|
||||
}, [ loaded, localeId ]);
|
||||
|
||||
return (
|
||||
<LocaleContext.Provider value={localeId}>
|
||||
|
||||
Reference in New Issue
Block a user