Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I trigger a forced update with react-i18next?

I am loading some resource bundles asynchronously, and I want to refresh the entire app when it's loaded. How can I do this?

i18n.addResourceBundle(locale, ns, messages, true, true);

// app is not updated

Update: I can use the bindToStore: 'add' option, but since multiple bundles can be loaded, I'd like to prevent the refresh until after everything is loaded.

So, for now, calling i18n.changeLanguage(lang); and bindToStore seems to be the only options,

like image 263
Yanick Rochon Avatar asked Oct 29 '25 05:10

Yanick Rochon


1 Answers

You can call i18n.changeLanguage(lang); it will trigger re-render of the app.

like image 67
felixmosh Avatar answered Oct 30 '25 19:10

felixmosh