Cleaner handling of NoConvert, for variable number of arguments
authorJens Frank <jeluf@users.mediawiki.org>
Sat, 18 Sep 2004 16:38:55 +0000 (16:38 +0000)
committerJens Frank <jeluf@users.mediawiki.org>
Sat, 18 Sep 2004 16:38:55 +0000 (16:38 +0000)
includes/GlobalFunctions.php
includes/SpecialAllmessages.php

index 8c37e35..0688d4a 100644 (file)
@@ -355,7 +355,7 @@ $wgReplacementKeys = array( '$1', '$2', '$3', '$4', '$5', '$6', '$7', '$8', '$9'
 /**
  * Get a message from anywhere
  */
-function wfMsg( $key, $convert=true ) {
+function wfMsg( $key ) {
        global $wgRequest;
        if ( $wgRequest->getVal( 'debugmsg' ) ) {
                if ( $key == 'linktrail' /* a special case where we want to return something specific */ )
@@ -367,18 +367,47 @@ function wfMsg( $key, $convert=true ) {
        if ( count( $args ) ) {
                array_shift( $args );
        }
-       return wfMsgReal( $key, $args, true, $convert );
+       return wfMsgReal( $key, $args, true );
+}
+
+/**
+ * Get a message from anywhere, but don't call Language::convert
+ */
+function wfMsgNoConvert( $key ) {
+       global $wgRequest;
+       if ( $wgRequest->getVal( 'debugmsg' ) ) {
+               if ( $key == 'linktrail' /* a special case where we want to return something specific */ )
+                       return "/^()(.*)$/sD";
+               else
+                       return $key;
+       }
+       $args = func_get_args();
+       if ( count( $args ) ) {
+               array_shift( $args );
+       }
+       return wfMsgReal( $key, $args, true, false );
 }
 
 /**
  * Get a message from the language file
  */
-function wfMsgNoDB( $key, $convert=true ) {
+function wfMsgNoDB( $key ) {
+       $args = func_get_args();
+       if ( count( $args ) ) {
+               array_shift( $args );
+       }
+       return wfMsgReal( $key, $args, false );
+}
+
+/**
+ * Get a message from the language file, but don't call Language::convert
+ */
+function wfMsgNoDBNoConvert( $key ) {
        $args = func_get_args();
        if ( count( $args ) ) {
                array_shift( $args );
        }
-       return wfMsgReal( $key, $args, false, $convert );
+       return wfMsgReal( $key, $args, false, false );
 }
 
 /**
index be33e73..5ceb40b 100644 (file)
@@ -27,8 +27,8 @@ function wfSpecialAllmessages() {
 
        foreach ( $sortedArray as $key => $enMsg ) {
                $messages[$key]['enmsg'] = $enMsg;
-               $messages[$key]['statmsg'] = wfMsgNoDb( $key, false );
-               $messages[$key]['msg'] = wfMsg ( $key, false );
+               $messages[$key]['statmsg'] = wfMsgNoDbNoConvert( $key );
+               $messages[$key]['msg'] = wfMsgNoConvert ( $key );
        }
 
        $wgMessageCache->enableTransform();