mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Revert "fix(language): prefer session data over request data"
This reverts commit 86d6580ffb.
This commit is contained in:
@@ -19,6 +19,12 @@ export function attachTranslateFunction (req, res, next) {
|
||||
}
|
||||
|
||||
export function getUserLanguage (req, res, next) {
|
||||
// In case the language is specified in the request url, use intersection
|
||||
if (req.query.lang) {
|
||||
req.language = translations[req.query.lang] ? req.query.lang : 'en';
|
||||
return next();
|
||||
}
|
||||
|
||||
// If the request is authenticated, use the user's preferred language
|
||||
if (res.locals && res.locals.user) {
|
||||
req.language = getLanguageFromUser(res.locals.user, req);
|
||||
@@ -39,12 +45,6 @@ export function getUserLanguage (req, res, next) {
|
||||
.catch(next);
|
||||
}
|
||||
|
||||
// In case the language is specified in the request url, use intersection
|
||||
if (req.query.lang) {
|
||||
req.language = translations[req.query.lang] ? req.query.lang : 'en';
|
||||
return next();
|
||||
}
|
||||
|
||||
// Otherwise get from browser
|
||||
req.language = getLanguageFromBrowser(req);
|
||||
return next();
|
||||
|
||||
Reference in New Issue
Block a user