From: Rotem Liss Date: Mon, 4 Sep 2006 17:22:14 +0000 (+0000) Subject: (bug 7226) Use the fallback language instead of English to check if we should include... X-Git-Tag: 1.31.0-rc.0~55835 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=f8003249733c6fe9bdb17247e5ad1e6fc42b0cd6;p=lhc%2Fweb%2Fwiklou.git (bug 7226) Use the fallback language instead of English to check if we should include the message in the PHP view of Special:Allmessages (we may have to remove all this check completely, as it makes no sense, but fixing it for now) --- diff --git a/includes/SpecialAllmessages.php b/includes/SpecialAllmessages.php index 7eada4b981..994adc6c84 100644 --- a/includes/SpecialAllmessages.php +++ b/includes/SpecialAllmessages.php @@ -10,7 +10,7 @@ */ function wfSpecialAllmessages() { global $wgOut, $wgRequest, $wgMessageCache, $wgTitle; - global $wgUseDatabaseMessages; + global $wgUseDatabaseMessages, $wgLang, $wgContLang; # The page isn't much use if the MediaWiki namespace is not being used if( !$wgUseDatabaseMessages ) { @@ -32,11 +32,17 @@ function wfSpecialAllmessages() { $first = true; $sortedArray = array_merge( Language::getMessagesFor( 'en' ), $wgMessageCache->getExtensionMessagesFor( 'en' ) ); ksort( $sortedArray ); + $contentCode = $wgContLang->getCode(); + $fallback = Language::getFallbackFor( $wgLang->getCode() ); $messages = array(); $wgMessageCache->disableTransform(); - foreach ( $sortedArray as $key => $value ) { - $messages[$key]['enmsg'] = $value; + foreach ( array_keys( $sortedArray ) as $key ) { + if ( $contentCode == $fallback ) { + $messages[$key]['fallbackmsg'] = wfMsgNoDbForContent( $key ); + } else { + $messages[$key]['fallbackmsg'] = wfMsgNoDb( "$key/$fallback" ); + } $messages[$key]['statmsg'] = wfMsgNoDb( $key ); $messages[$key]['msg'] = wfMsg ( $key ); } @@ -65,7 +71,7 @@ function makePhp($messages) { global $wgLang; $txt = "\n\n\$messages = array(\n"; foreach( $messages as $key => $m ) { - if($wgLang->getCode() != 'en' and $m['msg'] == $m['enmsg'] ) { + if($wgLang->getCode() != 'en' and $m['msg'] == $m['fallbackmsg'] ) { //if (strstr($m['msg'],"\n")) { // $txt.='/* '; // $comment=' */';