# How to add MUI localization
WARNING
To use MUI localization you'll have to make changes in the ThemeComponent.tsx
file.
You'll have to make a copy of the ThemeComponent.tsx
file to keep it as a backup while updating the template.
# Localization Synced With I18n
- Open the
src/@core/theme/ThemeComponent.tsx
file - Import the locales you need from
'@mui/material/locale'
- Import the
useTranslation
hook fromreact-i18next
import { useTranslation } from 'react-i18next'
- Create a
langObj
variable
- Initialize the
useTranslation
hook
const { i18n } = useTranslation()
- Add the language as a parameter to the
createTheme
function
theme = createTheme(
theme,
{
components: { ...mergeComponentOverrides(theme, settings) },
typography: { ...mergeTypography(theme) }
},
langObj[i18n.language]
)