Skip to content
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

Add ability to specify available locales on the i18nProvider #7758

Merged
merged 3 commits into from
May 30, 2022

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented May 25, 2022

Problem

Supporting multiple locales is cumbersome:

  • configure the i18nProvider in one file
  • make a custom appbar to include the LocalesMenuButton
  • remember to add the title in the appbar as it is not included automatically when passing custom children
  • sync the i18nProvider locales with the LocalesMenuButton options

Solution

Defines the available locales in the same file they are added (the i18nProvider), thanks to a new getLocales method.
The Appbar will now include the LocalesMenuButton automatically if multiple locales are available

@djhi djhi added the RFR Ready For Review label May 25, 2022
@djhi djhi added this to the 4.2.0 milestone May 25, 2022
@vercel vercel bot temporarily deployed to Preview – react-admin May 25, 2022 16:03 Inactive
Copy link
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small things can be improved in the docs, otherwise that's great! 😎

docs/LocalesMenuButton.md Show resolved Hide resolved
docs/Translation.md Outdated Show resolved Hide resolved
@slax57 slax57 merged commit 12a142a into next May 30, 2022
@slax57 slax57 deleted the i18nProvider-get-locales branch May 30, 2022 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants