From 065eba7458a8482199cdf5e30dc03dc299abe342 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Sun, 21 Sep 2008 09:18:35 +0000 Subject: [PATCH] * An attempt to fix bug 11119 * (bug 11119) {{grammar}} broken in noarticletext(anon) when ui lang != content lang --- RELEASE-NOTES | 1 + includes/Article.php | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6d40652e81..b8b6887f57 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/Article.php b/includes/Article.php index eeff834474..cc409482a5 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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 "
\n$ret\n
"; } else { - $ret = wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' ); + return $this->getNoSuchPageText(); } - - return "
\n$ret\n
"; } 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 "
\n$text\n
"; + } + /** * This function returns the text of a section, specified by a number ($section). * A section is text under a heading like == Heading == or \Heading\, or -- 2.20.1