-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DataGrid] Implement internationalization #718
[DataGrid] Implement internationalization #718
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea to only translate a few keys!
packages/grid/_modules_/grid/components/toolbar/DensitySelector.tsx
Outdated
Show resolved
Hide resolved
112520a
to
8e5ce3c
Compare
packages/grid/_modules_/grid/components/toolbar/DensitySelector.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/toolbar/DensitySelector.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
…e/DataGrid-196-implement-localization
I've fixed the outstanding issues and comments, added a test case and updated the docs. Note: I've only converted the text in the Density Selector component for now to make the PR more focused on the functionality. Once this is merged I'll open a follow up PR that handles the rest of the text used in the grid. |
packages/grid/_modules_/grid/components/toolbar/DensitySelector.tsx
Outdated
Show resolved
Hide resolved
docs/src/pages/components/data-grid/localization/localization.md
Outdated
Show resolved
Hide resolved
docs/src/pages/components/data-grid/localization/localization.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Matt <github@nospam.33m.co>
Co-authored-by: Matt <github@nospam.33m.co>
Co-authored-by: Matt <github@nospam.33m.co>
packages/grid/_modules_/grid/hooks/features/localeText/useLocaleText.tsx
Outdated
Show resolved
Hide resolved
…leText.tsx Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
…com:DanailH/material-ui-x into feature/DataGrid-196-implement-localization
One iteration on #196
Overview
I'm this is the first part of the "Implement Localization" ticket. For the second part there is going to be a follow up ticket. This feature is available on both the
DataGrid
andXGrid
components.What does this PR solves?
I've added a
useI18n
hook that has only one exported method for now that is thegetText
. It is used to get the text value that is assigned to a key in the 'localText' object.Later on we can extend the hook with additional functionality needed for part 2.
Documentation, tests and full text replacement is missing from this Draft. Once we have the implementation and the naming 😅 nailed down I'll add in the missing things and convert the Draft into a normal PR.
Example usage:
ToDo:
getText
to display the text in the grid (on one component initially, a follow up PR will be created for the rest of the components)