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

Automatic translation (i18n) support for emptyText #8044

Closed
soullivaneuh opened this issue Aug 7, 2022 · 5 comments
Closed

Automatic translation (i18n) support for emptyText #8044

soullivaneuh opened this issue Aug 7, 2022 · 5 comments

Comments

@soullivaneuh
Copy link
Contributor

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

@antoinefricker
Copy link
Contributor

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.

@ogustavo-pereira
Copy link
Contributor

ogustavo-pereira commented Aug 29, 2022

@fzaninotto @septentrion-730n the adjustment here must be for all fields or just for the date? I can raise this PR!

@fzaninotto
Copy link
Member

Please do it for all fields.

@ogustavo-pereira
Copy link
Contributor

Should this issue be closed now?
cc @fzaninotto @septentrion-730n

@fzaninotto
Copy link
Member

Indeed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants