* An attempt to fix bug 11119
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Sun, 21 Sep 2008 09:18:35 +0000 (09:18 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Sun, 21 Sep 2008 09:18:35 +0000 (09:18 +0000)
* (bug 11119) {{grammar}} broken in noarticletext(anon) when ui lang != content lang

RELEASE-NOTES
includes/Article.php

index 6d40652..b8b6887 100644 (file)
@@ -213,6 +213,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   has been blocked more than 10 times. Patch by Matt Johnston.
 * (bug 12678) Skins don't show Upload link if the user isn't allowed to upload.
 * Fixed incorrect usage of DB_LAST in Special:Export. Deprecated DB_LAST.
+* 11119 {{grammar}} broken in noarticletext(anon) when ui lang != content lang
 
 === API changes in 1.14 ===
 
index eeff834..cc40948 100644 (file)
@@ -210,7 +210,7 @@ class Article {
         * @return Return the text of this revision
        */
        function getContent() {
-               global $wgUser, $wgOut, $wgMessageCache;
+               global $wgOut, $wgMessageCache;
 
                wfProfileIn( __METHOD__ );
 
@@ -220,12 +220,11 @@ class Article {
 
                        if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
                                $wgMessageCache->loadAllMessages();
-                               $ret = wfMsgWeirdKey ( $this->mTitle->getText() ) ;
+                               $ret = wfMsgWeirdKey( $this->mTitle->getText() );
+                               return "<div class='noarticletext'>\n$ret\n</div>";
                        } else {
-                               $ret = wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' );
+                               return $this->getNoSuchPageText();
                        }
-
-                       return "<div class='noarticletext'>\n$ret\n</div>";
                } else {
                        $this->loadContent();
                        wfProfileOut( __METHOD__ );
@@ -233,6 +232,20 @@ class Article {
                }
        }
 
+       /*
+        * HACK HACK! We pre-parse them with parsemag to get GRAMMAR working right.
+        * It should be safe to do this and then do the full parse.
+        */
+       function getNoSuchPageText() {
+               global $wgUser;
+               if ( $wgUser->isLoggedIn() ) {
+                       $text = wfMsgExt( 'noarticletext', 'parsemag' );
+               } else {
+                       $text = wfMsgExt( 'noarticletextanon', 'parsemag' );
+               }
+               return "<div class='noarticletext'>\n$text\n</div>";
+       }
+
        /**
         * This function returns the text of a section, specified by a number ($section).
         * A section is text under a heading like == Heading == or \<h1\>Heading\</h1\>, or