question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dev-mode: reload resources on page reload

See original GitHub issue

Is your feature request related to a problem? Please describe.

When you develop the app u are usually adding / changing keys in the translation jsons, because of the fact that i18n runs once (at server startup) the change is not reflected in the browser, you need to restart the server for the changes to affect.

Describe the solution you’d like

We can add in the next-i18next middleware a check for NODE_ENV=development and if so, attach additional middleware that will invoke i18n.reloadResources.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

5reactions
felixmoshcommented, Dec 10, 2019

I’ve developed i18next-hmr in-order to hot reload client & server when translations are changes… check it out :]

2reactions
felixmoshcommented, Mar 5, 2019

So, I agree with u that it should not be part of this lib.

If anyone interested with my final solution:

const chokidar = require('chokidar');
const path = require('path');
chokidar.watch('static/locales/**/*.json', { ignoreInitial: true }).on('all', (_event, filePath) => {
    const parsedPath = path.parse(filePath);
    const ns = parsedPath.name;
    const lng = path.basename(parsedPath.dir);
    nextI18next.i18n.reloadResources([lng], [ns]);
    console.log(chalk.magenta(`\nReloaded successfully ${filePath}`));
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dev-mode: reload resources on page reload #214 - GitHub
Dev-mode : reload resources on page reload #214 ... perform the reload work (either the entire Node process or the i18n resources) on...
Read more >
How can i make my CSS reload on page refresh? gwt maven
If you want to update your web assets without restarting the DevMode, run mvn war:exploded -Dgwt.compiler.skip . And similarly for resources ...
Read more >
How dev mode differs from a production application - Quarkus
In dev mode, Quarkus uses a ClassLoader hierarchy (explained in detail here) that enables the live reload of user code without requiring a...
Read more >
Development Mode (aka “devMode” - Apache Struts
When enabled, Struts 2 will reload your resource bundles on every request (meaning you can change your .properties files, save them, and see...
Read more >
Supporting Hot Reload - Nuxeo Documentation
Setting up the Dev Mode. Hot reload is currently mainly interesting to ease up development. Enabling it means re-building part of the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found