Add support of i18n with related patches and support "en" and "zh" locales for now
This commit is contained in:
11
app.js
11
app.js
@@ -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 }));
|
||||
|
||||
Reference in New Issue
Block a user