Fix bug #7605. For logged-in users use the selected variant(if any) insted the one from user settings.

This commit is contained in:
Robert Stojnić 2006-10-22 01:24:39 +00:00
parent e2aa937ee4
commit dd5e44ea63

View file

@ -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;