Ignore user language settings that aren't listed in language config; we'll then fall back to current autodetection. This prevents the surprises where your profile suddenly switches to Arabic because it was selected by default due to lack of a match in the drop-down box.
This commit is contained in:
parent
a43c310fbc
commit
b244ac6462
10
lib/util.php
10
lib/util.php
|
@ -91,9 +91,17 @@ function common_language()
|
|||
if (_have_config() && common_logged_in()) {
|
||||
$user = common_current_user();
|
||||
$user_language = $user->language;
|
||||
if ($user_language)
|
||||
|
||||
if ($user->language) {
|
||||
// Validate -- we don't want to end up with a bogus code
|
||||
// left over from some old junk.
|
||||
foreach (common_config('site', 'languages') as $code => $info) {
|
||||
if ($info['lang'] == $user_language) {
|
||||
return $user_language;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, find the best match for the languages requested by the
|
||||
// user's browser...
|
||||
|
|
Loading…
Reference in New Issue
Block a user