From 9aae1d5065cee553d93882c20a755e58efabe2d8 Mon Sep 17 00:00:00 2001 From: Zheng Zhu Date: Mon, 11 Oct 2004 02:15:55 +0000 Subject: [PATCH] For content language, removed language code suffix from the message keys in the mediawiki: namespace. This way languages that do not support multiple variants will see no change in the way the namespace works. --- includes/MessageCache.php | 8 +++++--- includes/SpecialAllmessages.php | 6 ++++-- maintenance/InitialiseMessages.inc | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/includes/MessageCache.php b/includes/MessageCache.php index 9b4c3d7b7c..2a31c0d92e 100755 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -207,8 +207,9 @@ class MessageCache } function get( $key, $useDB, $forcontent=true ) { + global $wgContLanguageCode; if($forcontent) { - global $wgContLang, $wgContLanguageCode; + global $wgContLang; $lang = $wgContLang; $langcode = $wgContLanguageCode; } @@ -224,8 +225,9 @@ class MessageCache $message = false; if ( !$this->mDisable && $useDB ) { - $title = $lang->ucfirst( $key )."/$langcode"; - + $title = $lang->ucfirst( $key ); + if($langcode!=$wgContLanguageCode) + $title.="/$langcode"; # Try the cache if ( $this->mUseCache && $this->mCache && array_key_exists( $title, $this->mCache ) ) { diff --git a/includes/SpecialAllmessages.php b/includes/SpecialAllmessages.php index ea5a6206d4..2001c414c0 100644 --- a/includes/SpecialAllmessages.php +++ b/includes/SpecialAllmessages.php @@ -94,7 +94,7 @@ function makePhp($messages) { * */ function makeHTMLText( $messages ) { - global $wgLang, $wgUser, $wgLanguageCode; + global $wgLang, $wgUser, $wgLanguageCode, $wgContLanguageCode; $fname = "makeHTMLText"; wfProfileIn( $fname ); @@ -130,7 +130,9 @@ function makeHTMLText( $messages ) { wfProfileIn( "$fname-output" ); foreach( $messages as $key => $m ) { - $title = $wgLang->ucfirst( $key )."/$wgLanguageCode"; + $title = $wgLang->ucfirst( $key ); + if($wgLanguageCode != $wgContLanguageCode) + $title.="/$wgLanguageCode"; $titleObj =& Title::makeTitle( NS_MEDIAWIKI, $title ); $talkPage =& Title::makeTitle( NS_MEDIAWIKI_TALK, $title ); diff --git a/maintenance/InitialiseMessages.inc b/maintenance/InitialiseMessages.inc index da172fc882..9d5c94892b 100755 --- a/maintenance/InitialiseMessages.inc +++ b/maintenance/InitialiseMessages.inc @@ -41,8 +41,12 @@ function initialiseMessages( $overwrite = false, $messageArray = false ) { if(!is_object($lang)) { die ("class $langclass not defined. perhaps you need to include the file $langclass.php in $wgContLangClass.php?"); } + if($v==$wgContLanguageCode) + $suffix=''; + else + $suffix="/$v"; foreach ($sortedArray as $key => $msg) { - $messages[$key."/$v"] = $lang->getMessage($key); + $messages[$key.$suffix] = $lang->getMessage($key); } } -- 2.20.1