0

I have been able to integrate react-i18next into my project, however, when I change the language in Chrome and refresh the application, it does not change the text. It stays as the previous translation. I noticed that in the terminal where I log data, the translations.json files are loaded for the correct language set in the browser. Video demo showing what happens.

From a post I made on the github page for react-i18next, the creator indicated that what I might be missing was passing down initial translations and language so client continues where the server stopped.

I will appreciate if I can get some pointers on how to figure this out.

I have recreated a sample project here.

Cheers

4

1 回答 1

1

发生的事情是我如何在窗口 var:code here上设置 initialI18nStore 和 initialLanguage 。

事实证明,我只能(据我目前所知)通过在 initialI18nStore 或 initialLanguage 前面加上 2 个下划线来设置它 - 所以

window.__initialI18nStore

工作但window.initialI18nStore没有。

希望它可以帮助从事 React ssr 项目的人。

于 2019-03-12T15:20:55.840 回答