Tuesday, 25 April 2017

i18next, where does language code (ja-JP) comes from? and How can I simulate If I come from another language?

Following the example form i18next-express-middleware

router.get('/login', function(req, res, next) {

  var lng = req.language;

  console.log("");
  console.log("Current language:", lng);
  console.log("");

  res.render("account/login",{layout:"layout-account"});
});

form the terminal I got : Current language: ja-JP , which is cool, but where does the ja-JP comes from (windows or browser's language settings?)

I can use req.i18n.changeLanguage('en'); to change language to see if translation is good or not, but, how can I simulate If I come from another language?



via Kongfupanda

No comments:

Post a Comment