spacedeck-open/middlewares/i18n.js

18 lines
345 B
JavaScript
Raw Permalink Normal View History

2017-04-07 01:29:05 +02:00
'use strict';
require('../models/db');
2017-04-07 01:29:05 +02:00
var config = require('config');
module.exports = (req, res, next) => {
req.i18n.setLocale(req.i18n.prefLocale);
if (req.cookies.spacedeck_locale) {
req.i18n.setLocaleFromCookie();
}
if (req.user && req.user.prefs_language) {
req.i18n.setLocale(req.user.prefs_language);
2017-04-07 01:29:05 +02:00
}
next();
}