Localization in node.js with express Localization in node.js with express node.js node.js

Localization in node.js with express


node-localize can work together with express.

Depending on where you want the localization, jqtpl-express-i18n can do the job for templating.


Actually I use this NPM Package i18n

It have a very simple usage with Express framework... create locales folder (it.json, en.json, etc...)

// load modules at bootstrapvar app = express();var i18n = require("i18n");//set configurationi18n.configure({  locales:['en', 'de'],  directory: __dirname + '/server/locales'});app.use(i18n.init);// and then, in controller we can use responseres__('YOUR_KEY')

Front End side just set the HTTP header Accept-Language with value 'en', 'it', etc.