From: Ilmari Karonen Date: Wed, 9 May 2007 17:23:56 +0000 (+0000) Subject: simplify wfMsgWeirdKey(), avoid needless DB query X-Git-Tag: 1.31.0-rc.0~53000 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=d4991fcf6aa8a6aa88adc4cef80625e11addaed6;p=lhc%2Fweb%2Fwiklou.git simplify wfMsgWeirdKey(), avoid needless DB query --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 1ffde741b8..3c902ded61 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -429,18 +429,13 @@ function wfMsgReal( $key, $args, $useDB = true, $forContent=false, $transform = * @param $key String: */ function wfMsgWeirdKey ( $key ) { - $subsource = str_replace ( ' ' , '_' , $key ) ; - $source = wfMsgForContentNoTrans( $subsource ) ; - if ( wfEmptyMsg( $subsource, $source) ) { - # Try again with first char lower case - $subsource = strtolower ( substr ( $subsource , 0 , 1 ) ) . substr ( $subsource , 1 ) ; - $source = wfMsgForContentNoTrans( $subsource ) ; - } - if ( wfEmptyMsg( $subsource, $source ) ) { - # Didn't work either, return blank text - $source = "" ; - } - return $source ; + global $wgContLang; + $key = str_replace( ' ' , '_' , $wgContLang->lcfirst( $key ) ); + $source = wfMsgGetKey( $key, false, true, false ); + if ( wfEmptyMsg( $key, $source ) ) + return ""; + else + return $source; } /**