Created
October 30, 2013 09:48
-
-
Save mderazon/7229824 to your computer and use it in GitHub Desktop.
i18n module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i18n = require('i18n'); | |
i18n.configure({ | |
// setup some locales - other locales default to en silently | |
locales:['en', 'iw'], | |
// where to store json files - defaults to './locales' relative to modules directory | |
directory: __dirname + '/locales', | |
defaultLocale: 'en', | |
// sets a custom cookie name to parse locale settings from - defaults to NULL | |
cookie: 'lang', | |
}); | |
module.exports = function(req, res, next) { | |
i18n.init(req, res); | |
res.local('__', res.__); | |
var current_locale = i18n.getLocale(); | |
return next(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment