From a59f2237ae7afa4b5b07c10d47198d4c801fe7c5 Mon Sep 17 00:00:00 2001 From: Danail H Date: Wed, 10 Feb 2021 13:51:52 +0100 Subject: [PATCH 1/4] Add code snippet for localization docs in the data grid --- .../data-grid/localization/localization.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/src/pages/components/data-grid/localization/localization.md b/docs/src/pages/components/data-grid/localization/localization.md index 77250fff03559..df70b6a814fe0 100644 --- a/docs/src/pages/components/data-grid/localization/localization.md +++ b/docs/src/pages/components/data-grid/localization/localization.md @@ -22,6 +22,26 @@ In the following example, the labels of the density selector are customized. The default locale of Material-UI is English (United States). You can find all the locales supported in [the source](https://github.com/mui-org/material-ui-x/blob/HEAD/packages/grid/_modules_/grid/locales) in the GitHub repository. +You can use the theme to configure the locale text: + +```jsx +import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles'; +import { DataGrid, bgBG } from '@material-ui/data-grid'; + +const theme = createMuiTheme( + { + palette: { + primary: { main: '#1976d2' }, + }, + }, + bgBG, +); + + + +; +``` + ### Supported locales | Locale | BCP 47 language tag | Import name | From 2353c648ba8c31ed1783a04a1df5863cce28731d Mon Sep 17 00:00:00 2001 From: Danail H Date: Thu, 11 Feb 2021 12:50:30 +0100 Subject: [PATCH 2/4] Exlude numeric operators from translations --- .../grid/components/panel/filterPanel/FilterForm.tsx | 7 ++++--- packages/grid/_modules_/grid/models/filterOperator.ts | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/grid/_modules_/grid/components/panel/filterPanel/FilterForm.tsx b/packages/grid/_modules_/grid/components/panel/filterPanel/FilterForm.tsx index ce7217a8dd78f..17f7808e2f4c4 100644 --- a/packages/grid/_modules_/grid/components/panel/filterPanel/FilterForm.tsx +++ b/packages/grid/_modules_/grid/components/panel/filterPanel/FilterForm.tsx @@ -202,9 +202,10 @@ export function FilterForm(props: FilterFormProps) { > {currentColumn?.filterOperators?.map((operator) => ( ))} diff --git a/packages/grid/_modules_/grid/models/filterOperator.ts b/packages/grid/_modules_/grid/models/filterOperator.ts index 74abe9917b935..05c80601e6833 100644 --- a/packages/grid/_modules_/grid/models/filterOperator.ts +++ b/packages/grid/_modules_/grid/models/filterOperator.ts @@ -4,6 +4,7 @@ import { FilterItem } from './filterItem'; import { CellParams } from './params/cellParams'; export interface FilterOperator { + label?: string; value: string; getApplyFilterFn: ( filterItem: FilterItem, From 02fc39ba1af638b89b0d22187b232bdff3c4109e Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Thu, 11 Feb 2021 15:24:46 +0100 Subject: [PATCH 3/4] Update docs/src/pages/components/data-grid/localization/localization.md --- .../pages/components/data-grid/localization/localization.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/src/pages/components/data-grid/localization/localization.md b/docs/src/pages/components/data-grid/localization/localization.md index df70b6a814fe0..64ca2740c76cf 100644 --- a/docs/src/pages/components/data-grid/localization/localization.md +++ b/docs/src/pages/components/data-grid/localization/localization.md @@ -42,6 +42,9 @@ const theme = createMuiTheme( ; ``` +Note that `createMuiTheme` 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 with `XGrid` as it's an extension of `DataGrid`. ### Supported locales | Locale | BCP 47 language tag | Import name | From d4544590f4efb7f5a0f6a59aedf7d69f5f850f7b Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Thu, 11 Feb 2021 15:25:02 +0100 Subject: [PATCH 4/4] blank line --- docs/src/pages/components/data-grid/localization/localization.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/pages/components/data-grid/localization/localization.md b/docs/src/pages/components/data-grid/localization/localization.md index 64ca2740c76cf..0cc8227dc10b6 100644 --- a/docs/src/pages/components/data-grid/localization/localization.md +++ b/docs/src/pages/components/data-grid/localization/localization.md @@ -45,6 +45,7 @@ const theme = createMuiTheme( Note that `createMuiTheme` 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 with `XGrid` as it's an extension of `DataGrid`. + ### Supported locales | Locale | BCP 47 language tag | Import name |