Allow resource specific translations for pages and buttons
Problem
We have many translations that receive (or should receive) the current resource, for instance:
ra.page.create(and other similar views)ra.action.create(and other similar actions)
However, in some languages such as French, some words are feminine and other masculine. This forces devs to have their own translations if they want:
- New board : Nouveau tableau
- New column : Nouvelle colonne
Solution
Just like we did for notifications, accept resource specific translations in the form:
resources.posts.page.createresources.posts.action.create
Those translations should fall back to the current translations.
I identified the following translations but there may be others:
- create default title
- edit default title
- show default title
- list and infinite list default title
- create button label
How To Test
- https://react-admin-storybook-moe9v68sh-marmelab.vercel.app/?path=/story/ra-core-controller-createbase--default-title
- https://react-admin-storybook-moe9v68sh-marmelab.vercel.app/?path=/story/ra-core-controller-editbase--default-title
- https://react-admin-storybook-moe9v68sh-marmelab.vercel.app/?path=/story/ra-core-controller-showbase--default-title
- https://react-admin-storybook-moe9v68sh-marmelab.vercel.app/?path=/story/ra-core-controller-list-infinitelistbase--default-title
- https://react-admin-storybook-moe9v68sh-marmelab.vercel.app/?path=/story/ra-core-controller-list-listbase--default-title
- https://react-admin-storybook-moe9v68sh-marmelab.vercel.app/?path=/story/ra-ui-materialui-button-createbutton--label
Additional Checks
- [x] The PR targets
masterfor a bugfix or a documentation fix, ornextfor a feature - [x] The PR includes unit tests (if not possible, describe why)
- [x] The PR includes one or several stories (if not possible, describe why)
- [x] The documentation is up to date
Also, please make sure to read the contributing guidelines.
I'm a bit worried by the fact that the resource-specific translation keys for the CreateButton and the Create pages are the same. In my opinion, users should be able to have different translations for those (e.g. "Create" for the button and "New post" for the page).
I'm a bit worried by the fact that the resource-specific translation keys for the CreateButton and the Create pages are the same. In my opinion, users should be able to have different translations for those (e.g. "Create" for the button and "New post" for the page).
They're not the same. One is page.create, the other action.create