You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What you were expecting:
When loading the translations from an async function (e.g. XHR Request) the translated keys should update.
What happened instead:
It only changes, when the action dispatched by the side effect has a different language key than the current selected language. If it's the same, then the TranslatedProvider does not rerender, because it's componentDidUpdate method only checks on the language key.
So even when you change to the same language again it won't update, if you haven't changed it to another language before.
Only changed the i18nProvider and added a language switcher to an aside of the post edit view, where the resource keys are visible.
Other information:
I think this can be easily fixed by checking if the messages object changes in the TranslationProvider componentDidUpdate method. But then still there are technical keys visible until the async function returns the translation. This could be solved by not rendering before translation is ready. But that's not very practical either.
Environment
react-admin 2.8.5
The text was updated successfully, but these errors were encountered:
I think it's a rare case.
In my case it's because I save the translations in a database and have them editable by the user. And when changes are made and I just want to see the result I need to switch to another language and then back to the one I'm editing.
What you were expecting:
When loading the translations from an async function (e.g. XHR Request) the translated keys should update.
What happened instead:
It only changes, when the action dispatched by the side effect has a different language key than the current selected language. If it's the same, then the TranslatedProvider does not rerender, because it's componentDidUpdate method only checks on the language key.
So even when you change to the same language again it won't update, if you haven't changed it to another language before.
Steps to reproduce:
It's a rare case, so I created a code sandbox.
https://yjvyo9yp29.codesandbox.io/#/posts/13
Only changed the i18nProvider and added a language switcher to an aside of the post edit view, where the resource keys are visible.
Other information:
I think this can be easily fixed by checking if the messages object changes in the TranslationProvider componentDidUpdate method.
But then still there are technical keys visible until the async function returns the translation. This could be solved by not rendering before translation is ready. But that's not very practical either.
Environment
react-admin 2.8.5
The text was updated successfully, but these errors were encountered: