* (bug 10837) Language variants overrides languages other than the variant main language.
authorRobert Stojnić <rainman@users.mediawiki.org>
Mon, 14 Jul 2008 21:32:13 +0000 (21:32 +0000)
committerRobert Stojnić <rainman@users.mediawiki.org>
Mon, 14 Jul 2008 21:32:13 +0000 (21:32 +0000)
Explicitely forbid conversion when interface language is different than the main content language.

RELEASE-NOTES
includes/StubObject.php
languages/LanguageConverter.php

index 028f602..1e47f50 100644 (file)
@@ -432,6 +432,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   had stict standards issues with setFakeSlaveLag() and setFakeMaster().
 * (bug 451) Improve the phrase mappings of the Chinese converter arrays.
 * (bug 12487) Rights log is not fully internationalized
+* (bug 10837) Language variants no longer override other languages than base
 
 === API changes in 1.13 ===
 
index 07db880..685cc9e 100644 (file)
@@ -147,7 +147,7 @@ class StubUserLang extends StubObject {
 
                // if variant is explicitely selected, use it instead the one from wgUser
                // see bug #7605
-               if( $wgContLang->hasVariants() ){
+               if( $wgContLang->hasVariants() && $code == $wgContLanguageCode ){
                        $variant = $wgContLang->getPreferredVariant();
                        if( $variant != $wgContLanguageCode )
                                $code = $variant;
index edaf4d6..c2c9523 100644 (file)
@@ -124,6 +124,14 @@ class LanguageConverter {
                if($this->mPreferredVariant)
                        return $this->mPreferredVariant;
 
+               // figure out user lang without constructing wgLang to avoid infinite recursion
+               $userLang = $wgRequest->getVal( 'uselang', $wgUser->getOption( 'language' ) );
+               // see if interface language is same as content, if not, prevent conversion
+               if( $this->mMainLanguageCode != $userLang ){ 
+                       $this->mPreferredVariant = $this->mMainLanguageCode; // no conversion
+                       return $this->mPreferredVariant;
+               }
+
                // see if the preference is set in the request
                $req = $wgRequest->getText( 'variant' );
                if( in_array( $req, $this->mVariants ) ) {