r5254 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r5253‎ | r5254 | r5255 >
Date:05:58, 17 September 2004
Author:jeluf
Status:old
Tags:
Comment:
Removed hardcodes for Zh-conversion
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/SpecialAllmessages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialAllmessages.php
@@ -10,7 +10,6 @@
1111 */
1212 function wfSpecialAllmessages() {
1313 global $wgOut, $wgAllMessagesEn, $wgRequest, $wgMessageCache, $wgTitle;
14 - global $wgDoZhMessageConversion, $wgLanguageCode;
1514
1615 $fname = "wfSpecialAllMessages";
1716 wfProfileIn( $fname );
@@ -26,18 +25,12 @@
2726 $messages = array();
2827 $wgMessageCache->disableTransform();
2928
30 - if(strtolower($wgLanguageCode) == "zh")
31 - $wgDoZhMessageConversion = false;
32 -
3329 foreach ( $sortedArray as $key => $enMsg ) {
3430 $messages[$key]['enmsg'] = $enMsg;
35 - $messages[$key]['statmsg'] = wfMsgNoDb( $key );
36 - $messages[$key]['msg'] = wfMsg ( $key );
 31+ $messages[$key]['statmsg'] = wfMsgNoDb( $key, false );
 32+ $messages[$key]['msg'] = wfMsg ( $key, false );
3733 }
3834
39 - if(strtolower($wgLanguageCode) == "zh")
40 - $wgDoZhMessageConversion = true;
41 -
4235 $wgMessageCache->enableTransform();
4336 wfProfileOut( "$fname-setup" );
4437
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -27,11 +27,6 @@
2828 $wgTotalEdits = -1;
2929
3030
31 -/**
32 - * in "zh", whether conversion of messages should take place
33 - */
34 -$wgDoZhMessageConversion = true;
35 -
3631 require_once( 'DatabaseFunctions.php' );
3732 require_once( 'UpdateClasses.php' );
3833 require_once( 'LogPage.php' );
@@ -360,7 +355,7 @@
361356 /**
362357 * Get a message from anywhere
363358 */
364 -function wfMsg( $key ) {
 359+function wfMsg( $key, $convert=true ) {
365360 global $wgRequest;
366361 if ( $wgRequest->getVal( 'debugmsg' ) ) {
367362 if ( $key == 'linktrail' /* a special case where we want to return something specific */ )
@@ -372,26 +367,26 @@
373368 if ( count( $args ) ) {
374369 array_shift( $args );
375370 }
376 - return wfMsgReal( $key, $args, true );
 371+ return wfMsgReal( $key, $args, true, $convert );
377372 }
378373
379374 /**
380375 * Get a message from the language file
381376 */
382 -function wfMsgNoDB( $key ) {
 377+function wfMsgNoDB( $key, $convert=true ) {
383378 $args = func_get_args();
384379 if ( count( $args ) ) {
385380 array_shift( $args );
386381 }
387 - return wfMsgReal( $key, $args, false );
 382+ return wfMsgReal( $key, $args, false, $convert );
388383 }
389384
390385 /**
391386 * Really get a message
392387 */
393 -function wfMsgReal( $key, $args, $useDB ) {
394 - global $wgReplacementKeys, $wgMessageCache, $wgLang, $wgLanguageCode;
395 - global $wgDoZhMessageConversion;
 388+function wfMsgReal( $key, $args, $useDB, $convert=true ) {
 389+ global $wgReplacementKeys, $wgMessageCache, $wgLang;
 390+
396391 $fname = 'wfMsg';
397392 wfProfileIn( $fname );
398393 if ( $wgMessageCache ) {
@@ -403,9 +398,10 @@
404399 $message = "<$key>";
405400 }
406401
407 - if(strtolower($wgLanguageCode) == "zh" && $wgDoZhMessageConversion) {
408 - $message = $wgLang->convert($message);
409 - }
 402+ if ( $convert ) {
 403+ $message = $wgLang->convert($message);
 404+ }
 405+
410406 # Replace arguments
411407 if( count( $args ) ) {
412408 $message = str_replace( $wgReplacementKeys, $args, $message );

Status & tagging log