r28802 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28801‎ | r28802 | r28803 >
Date:18:00, 23 December 2007
Author:nikerabbit
Status:old
Tags:
Comment:
* Use variant only if interface language === content language
* (bug 10837) Interface "variant" overruling "language" preference
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/StubObject.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/StubObject.php
@@ -91,13 +91,16 @@
9292 global $wgContLanguageCode, $wgRequest, $wgUser, $wgContLang;
9393 $code = $wgRequest->getVal('uselang', $wgUser->getOption('language') );
9494
95 - // if variant is explicitely selected, use it instead the one from wgUser
96 - // see bug #7605
97 - if($wgContLang->hasVariants()){
98 - $variant = $wgContLang->getPreferredVariant();
99 - if($variant != $wgContLanguageCode)
100 - $code = $variant;
101 - }
 95+ // IF the content language has variants...
 96+ if ( $wgContLang->hasVariants() ) {
 97+ // AND IF the current interface language is the same as content language
 98+ if ( $code === $wgContLanguageCode ) {
 99+ // THEN use preferred variant as interface language.
 100+ // Happens when anonymous users or logged in users with default language
 101+ // setting selects a variant conversion.
 102+ $code = $wgContLang->getPreferredVariant();
 103+ }
 104+ }
102105
103106 # Validate $code
104107 if( empty( $code ) || !preg_match( '/^[a-z-]+$/', $code ) ) {
@@ -105,7 +108,7 @@
106109 $code = $wgContLanguageCode;
107110 }
108111
109 - if( $code == $wgContLanguageCode ) {
 112+ if( $code === $wgContLanguageCode ) {
110113 return $wgContLang;
111114 } else {
112115 $obj = Language::factory( $code );
Index: trunk/phase3/RELEASE-NOTES
@@ -268,6 +268,7 @@
269269 * (bug 12371) Handle more namespace case variants in namespaceDupes.php
270270 * (bug 12380) Bot-friendly EditPage::spamPage
271271 * (bug 8066) Spaces can't be entered in special page aliases
 272+* (bug 10837) Interface "variant" overruling "language" preference
272273
273274 == Parser changes in 1.12 ==
274275

Follow-up revisions

RevisionCommit summaryAuthorDate
r28824* Reverting r28802 until I can figure what is going onnikerabbit13:14, 24 December 2007
r37662* (bug 10837) Language variants overrides languages other than the variant ma...rainman21:32, 14 July 2008
r51204* (bug 10837) Introducing the StubUserVariant class to determine the variant ...shinjiman19:49, 30 May 2009

Status & tagging log