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">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<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" />
|
<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 -->
|
<!-- this script add for preventing initial theme flashing -->
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(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": {
|
"labels": {
|
||||||
"search": "search"
|
"search": "search"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
"app": {
|
||||||
|
"title": "حسابهای هارمونی"
|
||||||
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"search": "جست و جو"
|
"search": "جست و جو"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ import { useTranslation } from 'react-i18next';
|
|||||||
* side effects to the document. It renders no visible UI.
|
* side effects to the document. It renders no visible UI.
|
||||||
*/
|
*/
|
||||||
export const LanguageManager = () => {
|
export const LanguageManager = () => {
|
||||||
const { i18n } = useTranslation();
|
const { i18n, t } = useTranslation();
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
const handleLanguageChange = (lng: string) => {
|
const handleLanguageChange = (lng: string) => {
|
||||||
document.documentElement.setAttribute('dir', i18n.dir(lng));
|
document.documentElement.setAttribute('dir', i18n.dir(lng));
|
||||||
document.documentElement.setAttribute('lang', lng);
|
document.documentElement.setAttribute('lang', lng);
|
||||||
|
document.title = t('app.title', { lng });
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set initial values on component mount
|
// Set initial values on component mount
|
||||||
@@ -24,7 +25,7 @@ export const LanguageManager = () => {
|
|||||||
return () => {
|
return () => {
|
||||||
i18n.off('languageChanged', handleLanguageChange);
|
i18n.off('languageChanged', handleLanguageChange);
|
||||||
};
|
};
|
||||||
}, [i18n]);
|
}, [i18n, t]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user