Data Grid - Translated components
The data grid allows to support users from different locales, with formatting, and localized strings.
The default locale of MUI X is English (United States). If you want to use other locales, follow the instructions below.
Translation keys
You can use the localeText
prop to pass in your own text and translations.
You can find all the translation keys supported in the source
in the GitHub repository.
In the following example, the labels of the density selector are customized.
Locale text
The default locale of MUI X is English (United States).
You can use the theme to configure the locale text:
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { DataGrid } from '@mui/x-data-grid';
import { bgBG } from '@mui/x-data-grid/locales';
// Or import { bgBG } from '@mui/x-data-grid-pro/locales';
// Or import { bgBG } from '@mui/x-data-grid-premium/locales';
const theme = createTheme(
{
palette: {
primary: { main: '#1976d2' },
},
},
bgBG,
);
<ThemeProvider theme={theme}>
<DataGrid />
</ThemeProvider>;
Note that createTheme
accepts any number of arguments.
If you are already using the translations of the core components, you can add bgBG
as a new argument.
The same import works for DataGridPro
as it's an extension of DataGrid
.
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { DataGrid } from '@mui/x-data-grid';
import { bgBG } from '@mui/x-data-grid/locales';
import { bgBG as pickersBgBG } from '@mui/x-date-pickers/locales';
import { bgBG as coreBgBG } from '@mui/material/locale';
const theme = createTheme(
{
palette: {
primary: { main: '#1976d2' },
},
},
bgBG, // x-data-grid translations
pickersBgBG, // x-date-pickers translations
coreBgBG, // core translations
);
<ThemeProvider theme={theme}>
<DataGrid />
</ThemeProvider>;
If you want to pass language translations directly to the data grid without using createTheme
and ThemeProvider
, you can directly load the language translations from @mui/x-data-grid/locales
.
import { DataGrid } from '@mui/x-data-grid';
import { nlNL } from '@mui/x-data-grid/locales';
<DataGrid localeText={nlNL.components.MuiDataGrid.defaultProps.localeText} />;
Supported locales
Locale | BCP 47 language tag | Import name | Completion | Source file |
---|---|---|---|---|
Arabic (Sudan) | ar-SD | arSD | 114/122 | Edit |
Belarusian | be-BY | beBY | 88/122 | Edit |
Bulgarian | bg-BG | bgBG | 114/122 | Edit |
Chinese (Hong Kong) | zh-HK | zhHK | 114/122 | Edit |
Chinese (Simplified) | zh-CN | zhCN | 118/122 | Edit |
Chinese (Taiwan) | zh-TW | zhTW | 114/122 | Edit |
Croatian | hr-HR | hrHR | 114/122 | Edit |
Czech | cs-CZ | csCZ | 118/122 | Edit |
Danish | da-DK | daDK | 117/122 | Edit |
Dutch | nl-NL | nlNL | 118/122 | Edit |
Finnish | fi-FI | fiFI | 118/122 | Edit |
French | fr-FR | frFR | 118/122 | Edit |
German | de-DE | deDE | 118/122 | Edit |
Greek | el-GR | elGR | 114/122 | Edit |
Hebrew | he-IL | heIL | 118/122 | Edit |
Hungarian | hu-HU | huHU | 116/122 | Edit |
Icelandic | is-IS | isIS | 114/122 | Edit |
Italian | it-IT | itIT | 114/122 | Edit |
Japanese | ja-JP | jaJP | 117/122 | Edit |
Korean | ko-KR | koKR | 87/122 | Edit |
Norwegian (Bokmål) | nb-NO | nbNO | 118/122 | Edit |
Norwegian (Nynorsk) | nn-NO | nnNO | 118/122 | Edit |
Persian | fa-IR | faIR | 118/122 | Edit |
Polish | pl-PL | plPL | 87/122 | Edit |
Portuguese | pt-PT | ptPT | 118/122 | Edit |
Portuguese (Brazil) | pt-BR | ptBR | 118/122 | Edit |
Romanian | ro-RO | roRO | 114/122 | Edit |
Russian | ru-RU | ruRU | 118/122 | Edit |
Slovak | sk-SK | skSK | 117/122 | Edit |
Spanish | es-ES | esES | 118/122 | Edit |
Swedish | sv-SE | svSE | 117/122 | Edit |
Turkish | tr-TR | trTR | 118/122 | Edit |
Ukrainian | uk-UA | ukUA | 114/122 | Edit |
Urdu (Pakistan) | ur-PK | urPK | 114/122 | Edit |
Vietnamese | vi-VN | viVN | 118/122 | Edit |
You can find the source in the GitHub repository.
To create your own translation or to customize the English text, copy this file to your project, make any changes needed and import the locale from there. Note that these translations of the Data Grid component depend on the Localization strategy of the whole library.
RTL Support
Right-to-left languages such as Arabic, Persian, or Hebrew are supported. Follow this guide to use them.
The example below demonstrates how to use an RTL language (Arabic) with the data grid.