node.js

How to use multiple language routes with node and i18n?  #angularjs #reactjs

  • You can get the requested path from req.url, you could check which one it was and set the language .
  • Stack Overflow works best with JavaScript enabled
  • Browse other questions tagged node.js express internationalization multilanguage or ask your own question .
  • sign up log in tour help
  • You could also prefix the path like example.com/fr/a-propos-de-nous , which would make it a little easier to extract the language from the request.

Currently, I’ve noticed that to set the language with i18n, you need to redirect the user in order for it to catch on by doing something like:

@ng_real_ninja: How to use multiple language routes with node and i18n? #angularjs #reactjs

I am building a simple website and would like the links to be translated.

Ex:

Currently, I’ve noticed that to set the language with i18n, you need to redirect the user in order for it to catch on by doing something like:

But how would that work if a user visit the following urls directly?

You can get the requested path from req.url, you could check which one it was and set the language accordingly.

, which would make it a little easier to extract the language from the request.

node.js