fix: update titles in locale files and set document title on language change

This commit is contained in:
2026-06-15 12:29:41 +03:30
parent 744ab78c14
commit 71b8077296
5 changed files with 11 additions and 4 deletions

View File

@@ -6,12 +6,13 @@ import { useTranslation } from 'react-i18next';
* side effects to the document. It renders no visible UI.
*/
export const LanguageManager = () => {
const { i18n } = useTranslation();
const { i18n, t } = useTranslation();
useLayoutEffect(() => {
const handleLanguageChange = (lng: string) => {
document.documentElement.setAttribute('dir', i18n.dir(lng));
document.documentElement.setAttribute('lang', lng);
document.title = t('app.title', { lng });
};
// Set initial values on component mount
@@ -24,7 +25,7 @@ export const LanguageManager = () => {
return () => {
i18n.off('languageChanged', handleLanguageChange);
};
}, [i18n]);
}, [i18n, t]);
return null;
};