From: Jens Frank Date: Sat, 18 Sep 2004 16:38:55 +0000 (+0000) Subject: Cleaner handling of NoConvert, for variable number of arguments X-Git-Tag: 1.5.0alpha1~1964 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=744ab639f75e1ac29de2ef80b9e0e343455a67c4;p=lhc%2Fweb%2Fwiklou.git Cleaner handling of NoConvert, for variable number of arguments --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 8c37e3564d..0688d4a086 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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 ); } /** diff --git a/includes/SpecialAllmessages.php b/includes/SpecialAllmessages.php index be33e73bf2..5ceb40bf58 100644 --- a/includes/SpecialAllmessages.php +++ b/includes/SpecialAllmessages.php @@ -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();