fix: update titles in locale files and set document title on language change
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
|
||||
<link rel="icon" href="/favicon.ico" sizes="any" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Harmony Accounts</title>
|
||||
<title>حسابهای هارمونی</title>
|
||||
<!-- this script add for preventing initial theme flashing -->
|
||||
<script>
|
||||
(function () {
|
||||
|
||||
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"app": {
|
||||
"title": "Harmony Accounts"
|
||||
},
|
||||
"labels": {
|
||||
"search": "search"
|
||||
},
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"app": {
|
||||
"title": "حسابهای هارمونی"
|
||||
},
|
||||
"labels": {
|
||||
"search": "جست و جو"
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user