Localization (i18n) Guide
Material React Table has full support for localization (i18n). Some locales are included by default, but if your language is not yet supported, you can still easily add your own custom translations to the localization
prop.
Are you interested in contributing some official translations that can be included in MRT by default?
Please contact us on GitHub or the Discord server to get in touch. We want to include dozens of languages and locales that can simply be imported from 'material-react-table/locales'!
Relevant Props
Built-in Locales
The following locales are included and can be imported from 'material-react-table/locales/'
:
en
, pt-BR
If your language is not yet supported, please consider making a PR to add it to the library! See here on GitHub.
Built-in Locale Examples
Scroll and find your language below to see an example of how to use it.
Custom Non-Built-In Translations
Here's a crude not-so-accurately translated Spanish example:
Acciones | Primer nombre | Apellido | Dirección | Ciudad | Estado | |
---|---|---|---|---|---|---|
Dylan | Murray | 261 Erdman Ford | East Daphne | Kentucky | ||
Raquel | Kohler | 769 Dominic Grove | Columbus | Ohio | ||
Ervin | Reinger | 566 Brakus Inlet | South Linda | West Virginia | ||
Brittany | McCullough | 722 Emie Stream | Lincoln | Nebraska | ||
Branson | Frami | 32188 Larkin Turnpike | Charleston | South Carolina |
1import React, { FC } from 'react';2import MaterialReactTable, { MRT_ColumnDef } from 'material-react-table';3import { data, Person } from './makeData';4import { createTheme, ThemeProvider, useTheme } from '@mui/material';5import { esES } from '@mui/material/locale';67const columns = [8 {9 accessorKey: 'firstName',10 header: 'Primer nombre',11 },12 {13 accessorKey: 'lastName',14 header: 'Apellido',15 },16 {17 accessorKey: 'address',18 header: 'Dirección',19 },20 {21 accessorKey: 'city',22 header: 'Ciudad',23 },24 {25 accessorKey: 'state',26 header: 'Estado',27 },28] as MRT_ColumnDef<Person>[];2930const Example: FC = () => {31 const theme = useTheme();3233 return (34 <ThemeProvider theme={createTheme(theme, esES)}>35 <MaterialReactTable36 columns={columns}37 data={data}38 enableColumnOrdering39 enableEditing40 enablePinning41 enableRowActions42 enableRowSelection43 localization={{44 actions: 'Acciones',45 cancel: 'Cancelar',46 changeFilterMode: 'Cambia el modo de filtro',47 clearFilter: 'Filtro claro',48 clearSearch: 'Borrar búsqueda',49 clearSort: 'Ordenar claro',50 columnActions: 'Acciones de columna',51 edit: 'Editar',52 expand: 'Expandir',53 expandAll: 'Expandir todo',54 filterByColumn: 'Filtrar por {column}',55 filterMode: 'Modo de filtro: {filterType}',56 grab: 'Agarrar',57 groupByColumn: 'Agrupar por {column}',58 groupedBy: 'Agrupados por ',59 hideAll: 'Ocultar todo',60 hideColumn: 'Ocultar columna de {column}',61 rowActions: 'Acciones de fila',62 pinToLeft: 'Alfile a la izquierda',63 pinToRight: 'Alfile a la derecha',64 save: 'Salvar',65 search: 'Búsqueda',66 selectedCountOfRowCountRowsSelected:67 '{selectedCount} de {rowCount} fila(s) seleccionadas',68 showAll: 'Mostrar todo',69 showAllColumns: 'Mostrar todas las columnas',70 showHideColumns: 'Mostrar/Ocultar columnas',71 showHideFilters: 'Alternar filtros',72 showHideSearch: 'Alternar búsqueda',73 sortByColumnAsc: 'Ordenar por {column} ascendente',74 sortByColumnDesc: 'Ordenar por {column} descendiendo',75 thenBy: ', entonces por ',76 toggleDensity: 'Alternar relleno denso',77 toggleFullScreen: 'Alternar pantalla completa',78 toggleSelectAll: 'Seleccionar todo',79 toggleSelectRow: 'Seleccionar fila',80 ungroupByColumn: 'Desagrupar por {column}',81 unpin: 'Quitar pasador',82 unsorted: 'Sin clasificar',83 }}84 />85 </ThemeProvider>86 );87};8889export default Example;90
If you are willing and able to contribute accurate translations, please consider making a PR and they will be included as an extra import in this library