Fix bug #7605. For logged-in users use the selected variant(if any) insted the one from user settings.
This commit is contained in:
parent
e2aa937ee4
commit
dd5e44ea63
1 changed files with 9 additions and 0 deletions
|
|
@ -92,6 +92,15 @@ class StubUserLang extends StubObject {
|
|||
$code = $wgRequest->getVal('uselang', '');
|
||||
if ($code == '')
|
||||
$code = $wgUser->getOption('language');
|
||||
|
||||
// if variant is explicitely selected, use it instead the one from wgUser
|
||||
// see bug #7605
|
||||
if($wgContLang->hasVariants()){
|
||||
$variant = $wgContLang->getPreferredVariant(false);
|
||||
if($variant != $wgContLanguageCode)
|
||||
$code = $variant;
|
||||
}
|
||||
|
||||
# Validate $code
|
||||
if( empty( $code ) || !preg_match( '/^[a-z]+(-[a-z]+)?$/', $code ) ) {
|
||||
$code = $wgContLanguageCode;
|
||||
|
|
|
|||
Loading…
Reference in a new issue