diff options
author | Wu Cheng-Han | 2016-08-19 11:49:24 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2016-08-19 11:49:24 +0800 |
commit | b9c59c454d68e35708f64703a423930b99075cab (patch) | |
tree | 35afc40b67c86c17d291b482cd52ae2417c82fb3 /app.js | |
parent | 87f4d05e8e8f36ac276cd85601cabc1fbb7efc2c (diff) |
Add support of i18n with related patches and support "en" and "zh" locales for now
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -16,6 +16,7 @@ var formidable = require('formidable'); var morgan = require('morgan'); var passportSocketIo = require("passport.socketio"); var helmet = require('helmet'); +var i18n = require('i18n'); //core var config = require("./lib/config.js"); @@ -92,6 +93,16 @@ app.use(helmet.hsts({ preload: true })); +i18n.configure({ + locales: ['en', 'zh'], + cookie: 'locale', + directory: __dirname + '/locales' +}); + +app.use(cookieParser()); + +app.use(i18n.init); + // routes without sessions // static files app.use('/', express.static(__dirname + '/public', { maxAge: config.staticcachetime })); |