From fc30ace0b525e9afe2bce2c4a06d0c2b52950e58 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Sun, 23 Dec 2007 18:00:54 +0000 Subject: [PATCH] * Use variant only if interface language === content language * (bug 10837) Interface "variant" overruling "language" preference --- RELEASE-NOTES | 1 + includes/StubObject.php | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e3bf47af0f..b5b73fde78 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -268,6 +268,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 12371) Handle more namespace case variants in namespaceDupes.php * (bug 12380) Bot-friendly EditPage::spamPage * (bug 8066) Spaces can't be entered in special page aliases +* (bug 10837) Interface "variant" overruling "language" preference == Parser changes in 1.12 == diff --git a/includes/StubObject.php b/includes/StubObject.php index a9a6bde959..16c5302ca0 100644 --- a/includes/StubObject.php +++ b/includes/StubObject.php @@ -91,13 +91,16 @@ class StubUserLang extends StubObject { global $wgContLanguageCode, $wgRequest, $wgUser, $wgContLang; $code = $wgRequest->getVal('uselang', $wgUser->getOption('language') ); - // if variant is explicitely selected, use it instead the one from wgUser - // see bug #7605 - if($wgContLang->hasVariants()){ - $variant = $wgContLang->getPreferredVariant(); - if($variant != $wgContLanguageCode) - $code = $variant; - } + // IF the content language has variants... + if ( $wgContLang->hasVariants() ) { + // AND IF the current interface language is the same as content language + if ( $code === $wgContLanguageCode ) { + // THEN use preferred variant as interface language. + // Happens when anonymous users or logged in users with default language + // setting selects a variant conversion. + $code = $wgContLang->getPreferredVariant(); + } + } # Validate $code if( empty( $code ) || !preg_match( '/^[a-z-]+$/', $code ) ) { @@ -105,7 +108,7 @@ class StubUserLang extends StubObject { $code = $wgContLanguageCode; } - if( $code == $wgContLanguageCode ) { + if( $code === $wgContLanguageCode ) { return $wgContLang; } else { $obj = Language::factory( $code ); -- 2.20.1