Improve Persian (fa-IR) support
- Add 12 missing translation keys to fa-IR.json - Set lang and dir on document.documentElement via useEffect on locale change, fixing the hardcoded lang="en" and ensuring both attributes are on the same element and applied on initial load
This commit is contained in:
1 parent
e347f767a7
commit
b077714f7c
2 files changed
+17
-2
No files matched your search
@@ -32,8 +32,6 @@ export function useLocale() {
|
||||
|
||||
setItem(LOCALE_CONFIG, value);
|
||||
|
||||
document.getElementById('__next')?.setAttribute('dir', getTextDirection(value));
|
||||
|
||||
if (locale !== value) {
|
||||
setLocale(value);
|
||||
} else {
|
||||
@@ -47,6 +45,11 @@ export function useLocale() {
|
||||
}
|
||||
}, [locale]);
|
||||
|
||||
useEffect(() => {
|
||||
document.documentElement.lang = locale.split('-')[0];
|
||||
document.documentElement.setAttribute('dir', getTextDirection(locale));
|
||||
}, [locale]);
|
||||
|
||||
useEffect(() => {
|
||||
const url = new URL(window?.location?.href);
|
||||
const locale = url.searchParams.get('locale');
|
||||
|
||||
Reference in new issue
Block a user