11import { Box } from '@mui/material' ;
2- import { DataGrid , DataGridProps , GridColumns , GridFilterItem , GridLinkOperator } from '@mui/x-data-grid' ;
3- import React , { useCallback , useEffect , useState } from 'react' ;
2+ import { DataGrid , DataGridProps , enUS , frFR , GridColumns , GridFilterItem , GridLinkOperator } from '@mui/x-data-grid' ;
3+ import React , { useCallback , useEffect , useMemo , useState } from 'react' ;
44import { useTranslation } from 'react-i18next' ;
55import { useAlert } from '../hooks/useAlert' ;
6+ import { useLanguage } from '../hooks/useLanguage' ;
67import { GlobalCsvExport } from './DatatableGlobalExport' ;
78import DatatableToolbar from './DatatableToolbar' ;
89
@@ -43,6 +44,7 @@ const Datatable = <DataType extends WithId, Model>({
4344} : DatatableProps < DataType , Model > ) => {
4445 const Alert = useAlert ( ) ;
4546 const { t } = useTranslation ( 'table' ) ;
47+ const { language } = useLanguage ( ) ;
4648
4749 const [ isLoading , setLoading ] = useState ( true ) ;
4850 const [ page , setPage ] = useState ( 0 ) ;
@@ -53,6 +55,8 @@ const Datatable = <DataType extends WithId, Model>({
5355 const [ filtersOperator , setFiltersOperator ] = useState < GridLinkOperator > ( GridLinkOperator . And ) ;
5456 const [ data , setData ] = useState < DataType [ ] > ( [ ] ) ;
5557
58+ const localeText = useMemo ( ( ) => ( language === 'fr' ? frFR : enUS ) . components . MuiDataGrid . defaultProps . localeText , [ language ] ) ;
59+
5660 const tableOptions : Omit < DataGridProps , 'columns' | 'rows' > = {
5761 autoHeight : true ,
5862 checkboxSelection : true ,
@@ -199,6 +203,7 @@ const Datatable = <DataType extends WithId, Model>({
199203 } }
200204 >
201205 < DataGrid
206+ localeText = { localeText }
202207 experimentalFeatures = { { newEditingApi : true } }
203208 columns = { columns }
204209 components = { {
0 commit comments