From ff264a485a262f0aab1f1df7ce774c67ee3a450b Mon Sep 17 00:00:00 2001 From: Jens Frank Date: Fri, 17 Sep 2004 05:51:03 +0000 Subject: [PATCH] Added convert() to Language class, so that convert can be called without checking wgLanguageCode. Avoid hardcodes. --- includes/Parser.php | 10 ++++------ languages/Language.php | 5 +++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 2703fe4b26..4bb512ad7d 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -20,7 +20,7 @@ * * settings: * $wgUseTex*, $wgUseDynamicDates*, $wgInterwikiMagic*, - * $wgNamespacesWithSubpages, $wgLanguageCode, $wgAllowExternalImages*, + * $wgNamespacesWithSubpages, $wgAllowExternalImages*, * $wgLocaltimezone * * * only within ParserOptions @@ -579,7 +579,7 @@ class Parser } function internalParse( $text, $linestart, $args = array(), $isMain=true ) { - global $wgLanguageCode, $wgLang; + global $wgLang; $fname = 'Parser::internalParse'; wfProfileIn( $fname ); @@ -587,9 +587,7 @@ class Parser $text = $this->removeHTMLtags( $text ); $text = $this->replaceVariables( $text, $args ); - if($wgLanguageCode == "zh") { - $text = $wgLang->convert($text); - } + $text = $wgLang->convert($text); $text = preg_replace( '/(^|\n)-----*/', '\\1
', $text ); @@ -963,7 +961,7 @@ class Parser # The wikilinks [[ ]] are procedeed here. /* private */ function replaceInternalLinks( $s ) { global $wgLang, $wgLinkCache; - global $wgNamespacesWithSubpages, $wgLanguageCode; + global $wgNamespacesWithSubpages; static $fname = 'Parser::replaceInternalLinks' ; wfProfileIn( $fname ); diff --git a/languages/Language.php b/languages/Language.php index 41985e4126..297ad05f5c 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1956,6 +1956,11 @@ class Language { function convertGrammar( $word, $case ) { return $word; } + + # Hook for Chinese traditional/simplified conversion + function convert( $text ) { + return $text; + } } # This should fail gracefully if there's not a localization available -- 2.20.1