For content language, removed language code suffix from the message keys in the media...
authorZheng Zhu <zhengzhu@users.mediawiki.org>
Mon, 11 Oct 2004 02:15:55 +0000 (02:15 +0000)
committerZheng Zhu <zhengzhu@users.mediawiki.org>
Mon, 11 Oct 2004 02:15:55 +0000 (02:15 +0000)
includes/MessageCache.php
includes/SpecialAllmessages.php
maintenance/InitialiseMessages.inc

index 9b4c3d7..2a31c0d 100755 (executable)
@@ -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 ) ) {
index ea5a620..2001c41 100644 (file)
@@ -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 );
 
index da172fc..9d5c948 100755 (executable)
@@ -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);
                }
        }