simplify wfMsgWeirdKey(), avoid needless DB query
authorIlmari Karonen <vyznev@users.mediawiki.org>
Wed, 9 May 2007 17:23:56 +0000 (17:23 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Wed, 9 May 2007 17:23:56 +0000 (17:23 +0000)
includes/GlobalFunctions.php

index 1ffde74..3c902de 100644 (file)
@@ -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;
 }
 
 /**