Fix bug #7605. For logged-in users use the selected variant(if any) insted the one...
authorRobert Stojnić <rainman@users.mediawiki.org>
Sun, 22 Oct 2006 01:24:39 +0000 (01:24 +0000)
committerRobert Stojnić <rainman@users.mediawiki.org>
Sun, 22 Oct 2006 01:24:39 +0000 (01:24 +0000)
includes/StubObject.php

index 8731670..4068c31 100644 (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;