From 4e19e889aa6461b31514543d21248551e5c2f993 Mon Sep 17 00:00:00 2001 From: Jens Frank Date: Fri, 17 Sep 2004 05:58:28 +0000 Subject: [PATCH] Removed hardcodes for Zh-conversion --- includes/GlobalFunctions.php | 26 +++++++++++--------------- includes/SpecialAllmessages.php | 11 ++--------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index d021a959e7..8c37e3564d 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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 = "<$key>"; } - 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 ); diff --git a/includes/SpecialAllmessages.php b/includes/SpecialAllmessages.php index fd7bb947d4..be33e73bf2 100644 --- a/includes/SpecialAllmessages.php +++ b/includes/SpecialAllmessages.php @@ -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" ); -- 2.20.1