r5253 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r5252‎ | r5253 | r5254 >
Date:05:51, 17 September 2004
Author:jeluf
Status:old
Tags:
Comment:
Added convert() to Language class, so that convert can be called
without checking wgLanguageCode. Avoid hardcodes.
Modified paths:
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -20,7 +20,7 @@
2121 *
2222 * settings:
2323 * $wgUseTex*, $wgUseDynamicDates*, $wgInterwikiMagic*,
24 - * $wgNamespacesWithSubpages, $wgLanguageCode, $wgAllowExternalImages*,
 24+ * $wgNamespacesWithSubpages, $wgAllowExternalImages*,
2525 * $wgLocaltimezone
2626 *
2727 * * only within ParserOptions
@@ -579,7 +579,7 @@
580580 }
581581
582582 function internalParse( $text, $linestart, $args = array(), $isMain=true ) {
583 - global $wgLanguageCode, $wgLang;
 583+ global $wgLang;
584584
585585 $fname = 'Parser::internalParse';
586586 wfProfileIn( $fname );
@@ -587,9 +587,7 @@
588588 $text = $this->removeHTMLtags( $text );
589589 $text = $this->replaceVariables( $text, $args );
590590
591 - if($wgLanguageCode == "zh") {
592 - $text = $wgLang->convert($text);
593 - }
 591+ $text = $wgLang->convert($text);
594592
595593 $text = preg_replace( '/(^|\n)-----*/', '\\1<hr />', $text );
596594
@@ -963,7 +961,7 @@
964962 # The wikilinks [[ ]] are procedeed here.
965963 /* private */ function replaceInternalLinks( $s ) {
966964 global $wgLang, $wgLinkCache;
967 - global $wgNamespacesWithSubpages, $wgLanguageCode;
 965+ global $wgNamespacesWithSubpages;
968966 static $fname = 'Parser::replaceInternalLinks' ;
969967 wfProfileIn( $fname );
970968
Index: trunk/phase3/languages/Language.php
@@ -1956,6 +1956,11 @@
19571957 function convertGrammar( $word, $case ) {
19581958 return $word;
19591959 }
 1960+
 1961+ # Hook for Chinese traditional/simplified conversion
 1962+ function convert( $text ) {
 1963+ return $text;
 1964+ }
19601965 }
19611966
19621967 # This should fail gracefully if there's not a localization available

Status & tagging log