From d4991fcf6aa8a6aa88adc4cef80625e11addaed6 Mon Sep 17 00:00:00 2001 From: Ilmari Karonen Date: Wed, 9 May 2007 17:23:56 +0000 Subject: [PATCH] simplify wfMsgWeirdKey(), avoid needless DB query --- includes/GlobalFunctions.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) 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; } /** -- 2.20.1