r46528 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46527‎ | r46528 | r46529 >
Date:10:09, 29 January 2009
Author:philip
Status:deferred (Comments)
Tags:
Comment:
mTables' element must not be left blank, to ensure the translate() function could always return a string.
Modified paths:
  • /trunk/phase3/languages/LanguageConverter.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/LanguageConverter.php
@@ -208,10 +208,10 @@
209209 * @private
210210 */
211211 function captionConvert( $matches ) {
212 - // we convert captions except URL
213212 $toVariant = $this->getPreferredVariant();
214213 $title = $matches[1];
215214 $text = $matches[2];
 215+ // we convert captions except URL
216216 if( !strpos( $text, '://' ) )
217217 $text = $this->translate($text, $toVariant);
218218 return " $title=\"$text\"";
@@ -372,12 +372,19 @@
373373 if( !in_array($v,$this->mVariants) )continue;
374374 if( $action=="add" ) {
375375 foreach($t as $from=>$to) {
376 - // more efficient than array_merge(), about 2.5 times.
377 - $this->mManualAddTables[$v][$from] = $to;
 376+ // to ensure that $from and $to not be left blank
 377+ // so $this->translate() could always return a string
 378+ if ($from || $to)
 379+ // more efficient than array_merge(), about 2.5 times.
 380+ $this->mManualAddTables[$v][$from] = $to;
378381 }
379382 }
380 - elseif ( $action=="remove" )
381 - $this->mManualRemoveTables[$v] = array_merge($this->mManualRemoveTables[$v], $t);
 383+ elseif ( $action=="remove" ) {
 384+ foreach($t as $from=>$to) {
 385+ if ($from || $to)
 386+ $this->mManualRemoveTables[$v][$from] = $to;
 387+ }
 388+ }
382389 }
383390 }
384391

Comments

#Comment by Werdna (talk | contribs)   23:10, 11 February 2009

Tweak to r46434.

Status & tagging log