react-admin
react-admin copied to clipboard
Automatic translation (i18n) support for emptyText
Is your feature request related to a problem? Please describe.
The emptyText
prop value of field components is not automatically translated as it is done for the label
prop.
Describe the solution you'd like
Having the possibility to have the emptyText
prop value being translated when available for example:
<Tab
// The label prop is being automatically translated.
label="resources.rides.tabs.path"
path="path"
>
<DateField
source="startedAt"
showTime
// Expected to be translated too.
emptyText="resources.rides.emptyText.notStarted"
/>
</Tab>
Describe alternatives you've considered
I am using useTranslate
hooks with the result store in a variable like so: const t = useTranslate();
Then I translate the key manually:
<DateField
source="startedAt"
showTime
emptyText={t('resources.rides.emptyText.notStarted')}
/>
Additional context
N/A
That's a nice idea. We would gladly welcome a PR on this topic! The PR should include the code, unit tests, and the documentation.
@fzaninotto @septentrion-730n the adjustment here must be for all fields or just for the date? I can raise this PR!
Please do it for all fields.
Should this issue be closed now? cc @fzaninotto @septentrion-730n
Indeed, thanks!