Removed hardcodes for Zh-conversion
authorJens Frank <jeluf@users.mediawiki.org>
Fri, 17 Sep 2004 05:58:28 +0000 (05:58 +0000)
committerJens Frank <jeluf@users.mediawiki.org>
Fri, 17 Sep 2004 05:58:28 +0000 (05:58 +0000)
includes/GlobalFunctions.php
includes/SpecialAllmessages.php

index d021a95..8c37e35 100644 (file)
@@ -27,11 +27,6 @@ $wgTotalViews = -1;
 $wgTotalEdits = -1;
 
 
-/**
- * in "zh", whether conversion of messages should take place
- */
-$wgDoZhMessageConversion = true;
-
 require_once( 'DatabaseFunctions.php' );
 require_once( 'UpdateClasses.php' );
 require_once( 'LogPage.php' );
@@ -360,7 +355,7 @@ $wgReplacementKeys = array( '$1', '$2', '$3', '$4', '$5', '$6', '$7', '$8', '$9'
 /**
  * Get a message from anywhere
  */
-function wfMsg( $key ) {
+function wfMsg( $key, $convert=true ) {
        global $wgRequest;
        if ( $wgRequest->getVal( 'debugmsg' ) ) {
                if ( $key == 'linktrail' /* a special case where we want to return something specific */ )
@@ -372,26 +367,26 @@ function wfMsg( $key ) {
        if ( count( $args ) ) {
                array_shift( $args );
        }
-       return wfMsgReal( $key, $args, true );
+       return wfMsgReal( $key, $args, true, $convert );
 }
 
 /**
  * Get a message from the language file
  */
-function wfMsgNoDB( $key ) {
+function wfMsgNoDB( $key, $convert=true ) {
        $args = func_get_args();
        if ( count( $args ) ) {
                array_shift( $args );
        }
-       return wfMsgReal( $key, $args, false );
+       return wfMsgReal( $key, $args, false, $convert );
 }
 
 /**
  * Really get a message
  */
-function wfMsgReal( $key, $args, $useDB ) {
-       global $wgReplacementKeys, $wgMessageCache, $wgLang, $wgLanguageCode;
-    global $wgDoZhMessageConversion;
+function wfMsgReal( $key, $args, $useDB, $convert=true ) {
+       global $wgReplacementKeys, $wgMessageCache, $wgLang;
+
        $fname = 'wfMsg';
        wfProfileIn( $fname );
        if ( $wgMessageCache ) {
@@ -403,9 +398,10 @@ function wfMsgReal( $key, $args, $useDB ) {
                $message = "&lt;$key&gt;";
        }
 
-    if(strtolower($wgLanguageCode) == "zh" && $wgDoZhMessageConversion) {
-        $message = $wgLang->convert($message);
-    }
+       if ( $convert ) {
+               $message = $wgLang->convert($message);
+       }
+
        # Replace arguments
        if( count( $args ) ) {
                $message = str_replace( $wgReplacementKeys, $args, $message );
index fd7bb94..be33e73 100644 (file)
@@ -10,7 +10,6 @@
  */
 function wfSpecialAllmessages() {
        global $wgOut, $wgAllMessagesEn, $wgRequest, $wgMessageCache, $wgTitle;
-       global $wgDoZhMessageConversion, $wgLanguageCode;
 
        $fname = "wfSpecialAllMessages";
        wfProfileIn( $fname );
@@ -26,18 +25,12 @@ function wfSpecialAllmessages() {
        $messages = array();
        $wgMessageCache->disableTransform();
 
-    if(strtolower($wgLanguageCode) == "zh")
-        $wgDoZhMessageConversion = false;
-
        foreach ( $sortedArray as $key => $enMsg ) {
                $messages[$key]['enmsg'] = $enMsg;
-               $messages[$key]['statmsg'] = wfMsgNoDb( $key );
-               $messages[$key]['msg'] = wfMsg ( $key );
+               $messages[$key]['statmsg'] = wfMsgNoDb( $key, false );
+               $messages[$key]['msg'] = wfMsg ( $key, false );
        }
 
-    if(strtolower($wgLanguageCode) == "zh")
-        $wgDoZhMessageConversion = true;
-
        $wgMessageCache->enableTransform();
        wfProfileOut( "$fname-setup" );