3 var env = require('gitter-web-env');
4 var logger = env.logger;
6 var userSettingsService = require('gitter-web-user-settings');
8 // use this whenever a user signs up or logs in
9 // (Why don't we add it as middleware to those routes rather?)
10 module.exports = function updateUserLocale(req, user) {
11 if (req.i18n && req.i18n.locale) {
12 userSettingsService.setUserSettings(user.id, 'lang', req.i18n.locale).catch(function(err) {
13 logger.error('Failed to save lang user setting', {
15 lang: req.i18n.locale,