r94279 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94278‎ | r94279 | r94280 >
Date:19:58, 11 August 2011
Author:robin
Status:resolved
Tags:
Comment:
* CategoryPage.php: fix the "category-empty" message per comment on r91518, it was outside the bodyContent. And do not convert interface text.
* Parser.php: Apparently that was a much bigger bug: do not convert interface text going through the parser either.
* Preferences.php: Do not convert the user signature.
For this bug in action, see e.g. http://sr.wikipedia.org/sr-ec/Посебно:Подешавањ?uselang=en (e.g. "Username" -> "Усернаме")
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/CategoryPage.php (modified) (history)
  • /trunk/phase3/includes/Preferences.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -40,6 +40,7 @@
4141 when the function exists but is disabled. Introduced Maintenance::posix_isatty()
4242 * (bug 30264) Changed installer-generated LocalSettings.php to use require_once()
4343 instead require() for included extensions.
 44+* Do not convert text in the user interface language to another script.
4445
4546 === API changes in 1.19 ===
4647 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
Index: trunk/phase3/includes/CategoryPage.php
@@ -172,16 +172,16 @@
173173 // Give a proper message if category is empty
174174 if ( $r == '' ) {
175175 $r = wfMsgExt( 'category-empty', array( 'parse' ) );
 176+ } else {
 177+ $pageLang = $this->title->getPageLanguage();
 178+ $langAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() );
 179+ # close the previous div, show the headings in user language,
 180+ # then open a new div with the page content language again
 181+ $r = '</div>' . $r . Html::openElement( 'div', $langAttribs );
176182 }
177183
178 - $pageLang = $this->title->getPageLanguage();
179 - $langAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() );
180 - # close the previous div, show the headings in user language,
181 - # then open a new div with the page content language again
182 - $r = '</div>' . $r . Html::openElement( 'div', $langAttribs );
183 -
184184 wfProfileOut( __METHOD__ );
185 - return $wgContLang->convert( $r );
 185+ return $r;
186186 }
187187
188188 function clearCategoryState() {
Index: trunk/phase3/includes/parser/Parser.php
@@ -362,14 +362,16 @@
363363 $this->replaceLinkHolders( $text );
364364
365365 /**
366 - * The page doesn't get language converted if
 366+ * The input doesn't get language converted if
367367 * a) It's disabled
368368 * b) Content isn't converted
369369 * c) It's a conversion table
 370+ * d) it is an interface message (which is in the user language)
370371 */
371372 if ( !( $wgDisableLangConversion
372373 || isset( $this->mDoubleUnderscores['nocontentconvert'] )
373 - || $this->mTitle->isConversionTable() ) ) {
 374+ || $this->mTitle->isConversionTable()
 375+ || $this->mOptions->getInterfaceMessage() ) ) {
374376
375377 # The position of the convert() call should not be changed. it
376378 # assumes that the links are all replaced and the only thing left
@@ -1996,6 +1998,15 @@
19971999 }
19982000 wfProfileOut( __METHOD__."-interwiki" );
19992001
 2002+ # Interprojects
 2003+ wfProfileIn( __METHOD__."-interproject" );
 2004+ global $wgInterProjectLinks;
 2005+ if ( is_array( $wgInterProjectLinks ) && isset( $wgInterProjectLinks[$iw] ) && $nottalk ) {
 2006+ $this->mOutput->addInterProjectLink( $iw, $nt, ( $wasblank ? '' : $text ) );
 2007+ wfProfileOut( __METHOD__."-interproject" );
 2008+ }
 2009+ wfProfileOut( __METHOD__."-interproject" );
 2010+
20002011 if ( $ns == NS_FILE ) {
20012012 wfProfileIn( __METHOD__."-image" );
20022013 if ( !wfIsBadImage( $nt->getDBkey(), $this->mTitle ) ) {
Index: trunk/phase3/includes/Preferences.php
@@ -314,7 +314,7 @@
315315
316316 // show a preview of the old signature first
317317 $oldsigWikiText = $wgParser->preSaveTransform( "~~~", new Title, $user, new ParserOptions );
318 - $oldsigHTML = $wgOut->parseInline( $oldsigWikiText );
 318+ $oldsigHTML = $wgOut->parseInline( $oldsigWikiText, true, true );
319319 $defaultPreferences['oldsig'] = array(
320320 'type' => 'info',
321321 'raw' => true,

Follow-up revisions

RevisionCommit summaryAuthorDate
r94280remove stuff accidentally committed in r94279robin20:03, 11 August 2011
r94299merge r94279 partially (fix for r91518): 'category-empty' was outside bodyCon...robin23:19, 11 August 2011
r94395Mark wfMsgWikiHtml() as an interface message so it doesn't get converted acco...robin23:14, 12 August 2011
r96257Correctly parse interface messages as such, so it doesn't get converted accor...robin21:19, 4 September 2011
r96737Correctly parse interface messages as such, so it doesn't get converted accor...robin20:05, 10 September 2011
r113024Transitional patch for bug 34832: introduce a CI-style option to allow deploy...tstarling12:14, 5 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r91518(bug 6100; follow-up to r91315) Being bold and removing $wgBetterDirectionali...robin02:26, 6 July 2011

Status & tagging log