Hiral
Hiral

Reputation: 132

How to reflect locales changes without restarting the node server - i18n?

In my project, I want to update locales JSON file dynamically. But when I update its not reload in browser directly. To reflect changes in browser I have to restart my server (Node). I am using i18n for same.

Is it possible to update locales without restarting node server?

I also read about i18next. But did not get solution. Can anyone please explain solution.

Thank You.

Upvotes: 1

Views: 1144

Answers (1)

felixmosh
felixmosh

Reputation: 35573

If you are using webpack as your bundler there is a webpack plugin i18next-hmr that adds a watcher on the locale folder and Hot reload translations in the browser & server.

The lib is able to work without a webpack on the server, it can "connect" to the client webpack and trigger change in the server as well.

Upvotes: 1

Related Questions