fix(theme): load language-specific font and fix font not updating on language change

This commit is contained in:
2026-06-27 17:44:20 +03:30
parent edb05876d5
commit 649337d01c
35 changed files with 12512 additions and 3 deletions

View File

@@ -10,7 +10,10 @@ export const CustomThemeProvider: React.FC<{ children: React.ReactNode }> = ({
const { i18n } = useTranslation();
const theme = useMemo(() => {
console.log('Theme recalculated, lang:', i18n.language);
const direction = i18n.dir(i18n.language);
const isEnglish = i18n.language?.startsWith('en');
const fontFamily = isEnglish ? 'iranyekanEnNum' : 'iranyekan';
return createTheme({
direction: direction,
@@ -29,7 +32,10 @@ export const CustomThemeProvider: React.FC<{ children: React.ReactNode }> = ({
shape: {
borderRadius: 8,
},
typography: typography,
typography: {
fontFamily: [fontFamily, 'sans-serif'].join(','),
...typography,
},
components: {
MuiButton: {
defaultProps: {
@@ -59,7 +65,7 @@ export const CustomThemeProvider: React.FC<{ children: React.ReactNode }> = ({
},
},
});
}, [i18n]);
}, [i18n, i18n.language]);
return (
<ThemeProvider theme={theme} defaultMode="light">