2017-04-07 01:29:05 +02:00
|
|
|
'use strict';
|
|
|
|
|
2018-04-12 18:40:58 +02:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2018-04-12 18:40:58 +02:00
|
|
|
if (req.user && req.user.prefs_language) {
|
|
|
|
req.i18n.setLocale(req.user.prefs_language);
|
2017-04-07 01:29:05 +02:00
|
|
|
}
|
|
|
|
next();
|
2018-04-12 18:40:58 +02:00
|
|
|
}
|