i18n.expressBind(app, {
locales: ['ru', 'en'],
directory: __dirname + '/locales',
extension: '.js',
defaultLocale: 'ru',
cookieName: 'lang',
});
app.use(function(req, res, next) {
if(req.query.lang) {
req.i18n.setLocaleFromQuery();
res.cookie('lang', req.i18n.getLocale());
} else {
req.i18n.setLocaleFromCookie();
}
next();
});