-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[charts] Add a localization provider #17325
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for adding a type label to the PR! 👍 |
Please add one type label to categorize the purpose of this PR appropriately:
|
Localization writing tips ✍️Seems you are updating localization 🌍 files. Thank you for contributing to the localization! 🎉 To make your PR perfect, here is a list of elements to check: ✔️
Deploy preview: https://deploy-preview-17325--material-ui-x.netlify.app/ Updated pages: |
CodSpeed Performance ReportMerging #17325 will not alter performanceComparing Summary
|
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.
Should this be called ChartsLocalizationTableNoSnap
? It seems like we're using enUS spelling
packages/x-charts/src/ChartsLocalizationProvider/ChartsLocalizationProvider.test.tsx
Outdated
Show resolved
Hide resolved
packages/x-charts/src/ChartsLocalizationProvider/ChartsLocalizationProvider.test.tsx
Outdated
Show resolved
Hide resolved
packages/x-charts/src/ChartsLocalizationProvider/ChartsLocalizationProvider.tsx
Outdated
Show resolved
Hide resolved
import LocalisationTable from 'docsx/src/modules/components/LocalizationTable'; | ||
import data from './data.json'; | ||
|
||
export default function ChartsLocalizationTableNoSnap() { | ||
return <LocalisationTable data={data} />; |
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.
import LocalisationTable from 'docsx/src/modules/components/LocalizationTable'; | |
import data from './data.json'; | |
export default function ChartsLocalizationTableNoSnap() { | |
return <LocalisationTable data={data} />; | |
import LocalizationTable from 'docsx/src/modules/components/LocalizationTable'; | |
import data from './data.json'; | |
export default function ChartsLocalizationTableNoSnap() { | |
return <LocalizationTable data={data} />; |
export interface ChartsLocalizationProviderProps { | ||
children?: React.ReactNode; | ||
/** | ||
* Locale for charts components texts. |
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.
* Locale for charts components texts. | |
* Localized text for chart components. |
Fix #16963
This introduces the localisation for charts. It will be more useful when we introduce the toolbar since buttons and helpers will need some text.
For info, the data grid put its locales in its
apiRef
and the pickers in a dedicated context.I went with the picker approach because we have a similar issue: defining the locale once and using it in multiple components and their subcomponent.
Having a dedicated provider allows targeting it in the MUI theme's defaultProps.