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:
Mohamad Jahani committed 2026-06-02 05:09:25 +03:30
1 parent e347f767a7
commit b077714f7c
2 files changed
+17 -2

No files matched your search

+5 -2
View File
@@ -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');