React-admin: Internationalization doesn't work in version >= 2.4.1

Created on 29 Nov 2018  路  7Comments  路  Source: marmelab/react-admin

What you were expecting:
Internationalized labels in lists and pages in versions >= 2.4.1.
In the side menu, it's working normally.
My app uses an en.json and de.json file and worked fine for multiple versions, no other changes are on-going than the version upgrade.

What happened instead:
Labels in lists and pages are not properly replaced with texts.

internationalization

Steps to reproduce:
Upgrade react-admin from 2.4.0 to 2.4.1 - 2.4.4 (tried with 2.4.1, 2.4.2, 2.4.3, 2.4.4)

Other information:
There are no logs in the javascript console at all that indicating warnings or errors.

Environment

  • React-admin version: 2.4.1 - 2.4.4
  • Last version that did not exhibit the issue (if applicable): 2.4.0
  • React version: 16.4.1
  • Browser: Firefox 63.0.3 & Chrome 70

Most helpful comment

I have an idea: did you upgrade react-admin but not ra-data-simple-rest, or any other default data provider? In that case, you may end up with several ra-core version sin your package.json, and this could cause the issue.

All 7 comments

I can't reproduce the bug on master. Besides, the i18n layer was untouched in 2.4.1 (it was in 2.4.2).

Can you please provide a codesandbox demonstrating the problem?

I tried now for almost an hour to reproduce the problem in the demo codesandbox and also cannot reproduce it.
The only thing I saw during my analysis was that when I use the translate explicit (like: primaryText={translate('results.title')} ), like I do in the side-menu, it works. Only the implicit translations don't work.
I try to reproduce it in a codesandbox in the next days.

Hi @msteingruber, I also had some issues after update to 2.4.X. with translation in Admin types custom components such as Sidebar, Toolbar
In my case, I've been working in a library component that works as an Infra. Is it your structure as well? I didn't solve it yet, for any customization I'd to move the Components to the final project... I'm missing something... I'll follow your thread.

I also have this problem after upgrading to 2.4.4 and later to 2.5.0. Labels are not parsed properly even if I explicitly set them via label prop. No errors in console

image

Update: actually label prop works for buttons and fields, but <Resource options={{ label: 'Users'}}/> does not

I have an idea: did you upgrade react-admin but not ra-data-simple-rest, or any other default data provider? In that case, you may end up with several ra-core version sin your package.json, and this could cause the issue.

Yes, that was the case. In particular I had to upgrade ra-data-json-server. Afterwards label returned to their normal state. Thanks

I had removed package-lock.json lock file and node_modules folder, then did npm i and same issue has to be fixed, but I switched from 2.5.2 to 2.9.4. Hope it will be also helpful for somebody.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mbj36 picture mbj36  路  3Comments

9747749366 picture 9747749366  路  3Comments

phacks picture phacks  路  3Comments

alukito picture alukito  路  3Comments

kdabir picture kdabir  路  3Comments