jeresig / i18n-node-2

Lightweight simple translation module for node.js / express.js with dynamic json storage. Uses common __('...') syntax in app and templates.
MIT License
507 stars 79 forks source link

Setting locale form browser #77

Closed adrienbarreau closed 8 years ago

adrienbarreau commented 8 years ago

Hello,

Is it possible to set the locale according to the language desired by the browser's Accept-language header ?

gjuchault commented 8 years ago

Hello

req.i18n.setLocale(req.i18n.preferredLocale(req));

This is the way to do it (it is undocumented I think).

adrienbarreau commented 8 years ago

Awesome ! Thanks !