Skip to content
+

Data Grid - Localization

The Data Grid's localization features provide the appropriate translations and formatting for users around the world.

The default locale of MUI X is English (United States). 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 label of the quick filter placeholder is customized.

Press Enter to start editing

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 Data Grid Pro as it's an extension of Data Grid.

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
126/223
Edit
Armenian hy-AM hyAM
128/223
Edit
Bangla bn-BD bnBD
137/223
Edit
Belarusian be-BY beBY
94/223
Edit
Bulgarian bg-BG bgBG
128/223
Edit
Catalan ca-ES caES
Done 🎉
Edit
Chinese (Hong Kong) zh-HK zhHK
141/223
Edit
Chinese (Simplified) zh-CN zhCN
141/223
Edit
Chinese (Taiwan) zh-TW zhTW
141/223
Edit
Croatian hr-HR hrHR
146/223
Edit
Czech cs-CZ csCZ
141/223
Edit
Danish da-DK daDK
131/223
Edit
Dutch nl-NL nlNL
131/223
Edit
Finnish fi-FI fiFI
130/223
Edit
French fr-FR frFR
158/223
Edit
German de-DE deDE
195/223
Edit
Greek el-GR elGR
120/223
Edit
Hebrew he-IL heIL
137/223
Edit
Hungarian hu-HU huHU
132/223
Edit
Icelandic is-IS isIS
124/223
Edit
Indonesian id-ID idID
195/223
Edit
Italian it-IT itIT
Done 🎉
Edit
Japanese ja-JP jaJP
153/223
Edit
Korean ko-KR koKR
192/223
Edit
Norwegian (Bokmål) nb-NO nbNO
134/223
Edit
Norwegian (Nynorsk) nn-NO nnNO
195/223
Edit
Persian fa-IR faIR
129/223
Edit
Polish pl-PL plPL
149/223
Edit
Portuguese pt-PT ptPT
Done 🎉
Edit
Portuguese (Brazil) pt-BR ptBR
222/223
Edit
Romanian ro-RO roRO
136/223
Edit
Russian ru-RU ruRU
139/223
Edit
Slovak sk-SK skSK
141/223
Edit
Spanish es-ES esES
Done 🎉
Edit
Swedish sv-SE svSE
Done 🎉
Edit
Thai th-TH thTH
Done 🎉
Edit
Turkish tr-TR trTR
136/223
Edit
Ukrainian uk-UA ukUA
140/223
Edit
Urdu (Pakistan) ur-PK urPK
128/223
Edit
Vietnamese vi-VN viVN
128/223
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.

You can also run the pnpm l10n:llm CLI script to translate missing locales for specific packages and locales using an LLM. The interactive CLI will guide you through the process of selecting the packages and locales to translate, and then it will generate a prompt for the LLM to translate the missing locales.

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.

Press Enter to start editing

Pagination number formatting

To format large numbers in the pagination component, customize the paginationDisplayedRows with the following code:

import { DataGrid } from '@mui/x-data-grid';

// ======================================================
// TODO: replace with your locale
import { frFR as locale } from '@mui/x-data-grid/locales';
const LOCALE = 'fr-FR';
// ======================================================

function formatNumber(value: number | string) {
  if (typeof Intl !== 'undefined' && Intl.NumberFormat) {
    try {
      const result = new Intl.NumberFormat(LOCALE).format(Number(value));
      return result === 'NaN' ? String(value) : result;
    } catch {
      return String(value);
    }
  }
  return String(value);
}

function paginationDisplayedRows({
  from,
  to,
  count,
  estimated,
}: {
  from: number;
  to: number;
  count: number;
  estimated?: number;
}) {
  if (!estimated) {
    return `${formatNumber(from)}–${formatNumber(to)} sur ${
      count !== -1 ? formatNumber(count) : `plus de ${formatNumber(to)}`
    }`;
  }
  const estimatedLabel =
    estimated && estimated > to
      ? `environ ${formatNumber(estimated)}`
      : `plus de ${formatNumber(to)}`;
  return `${formatNumber(from)}–${formatNumber(to)} sur ${
    count !== -1 ? formatNumber(count) : estimatedLabel
  }`;
}

const localeText = {
  ...locale.components.MuiDataGrid.defaultProps.localeText,
  paginationDisplayedRows,
};

function App() {
  return (
    <DataGrid
      rowCount={1000000}
      localeText={localeText}
    />
  )
}
Press Enter to start editing