From b628c3620885e948455f24be4f1ee82dcc1fd4ec Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 24 Jul 2015 14:11:09 -0700 Subject: [PATCH] SpecialStatistics: Implement statistics-articles-desc message Similar to the statistics-pages-desc message that exists already. This way mediawiki.org can stop using the hack currently employed in the local override for the 'statistics-articles' message which adds a line break inside the link label to emulate a caption. This doesn't work well because it breaks after the first link. Also: * Change from exists() to !isDisabled() so that it can be optional. * Fix wrong use of Xml::element and use Html::rawElement instead. The message in question is already escaped. This was causing escaped parser html to render as text on the page when the desc message contains e.g. a wiki link. Change-Id: I547d1da16c8bdbabddad35525a5c9fa34b8318d4 --- includes/specials/SpecialStatistics.php | 11 ++++++----- languages/i18n/en.json | 1 + languages/i18n/qqq.json | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index 652ea82640..8de6f8b8d4 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -107,11 +107,11 @@ class SpecialStatistics extends SpecialPage { ) { if ( $descMsg ) { $msg = $this->msg( $descMsg, $descMsgParam ); - if ( $msg->exists() ) { - $descriptionText = $this->msg( 'parentheses' )->rawParams( $msg->parse() ) + if ( !$msg->isDisabled() ) { + $descriptionHtml = $this->msg( 'parentheses' )->rawParams( $msg->parse() ) ->escaped(); - $text .= "
" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc' ), - " $descriptionText" ); + $text .= "
" . Html::rawElement( 'small', array( 'class' => 'mw-statistic-desc' ), + " $descriptionHtml" ); } } @@ -134,7 +134,8 @@ class SpecialStatistics extends SpecialPage { $this->formatRow( Linker::linkKnown( SpecialPage::getTitleFor( 'Allpages' ), $this->msg( 'statistics-articles' )->parse() ), $this->getLanguage()->formatNum( $this->good ), - array( 'class' => 'mw-statistics-articles' ) ) . + array( 'class' => 'mw-statistics-articles' ), + 'statistics-articles-desc' ) . $this->formatRow( $this->msg( 'statistics-pages' )->parse(), $this->getLanguage()->formatNum( $this->total ), array( 'class' => 'mw-statistics-pages' ), diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 1fdd75d7b8..cb09a162c0 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1585,6 +1585,7 @@ "statistics-header-users": "User statistics", "statistics-header-hooks": "Other statistics", "statistics-articles": "Content pages", + "statistics-articles-desc": "", "statistics-pages": "Pages", "statistics-pages-desc": "All pages in the wiki, including talk pages, redirects, etc.", "statistics-files": "Uploaded files", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 872a89f39c..1c0b5b1497 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1756,6 +1756,7 @@ "statistics-header-users": "Used in [[Special:Statistics]].\n{{Identical|User statistics}}", "statistics-header-hooks": "Header of a section on [[Special:Statistics]] containing data provided by MediaWiki extensions", "statistics-articles": "Used in [[Special:Statistics]].\n\nA 'content page' is a page that forms part of the purpose of the wiki. It includes the main page and pages in the main namespace and any other namespaces that are included when the wiki is customised. For example on Wikimedia Commons 'content pages' include pages in the file and category namespaces. On Wikinews 'content pages' include pages in the Portal namespace. For technical definition of 'content namespaces' see [[mw:Manual:Using_custom_namespaces#Content_namespaces|MediaWiki]].\n\nPossible alternatives to the word 'content' are 'subject matter' or 'wiki subject' or 'wiki purpose'.\n\n{{Identical|Content page}}", + "statistics-articles-desc": "Caption shown below ''Content pages'' on [[Special:Statistics]]", "statistics-pages": "Used in [[Special:Statistics]]\n{{Identical|Page}}", "statistics-pages-desc": "Tooltip shown over ''Pages'' (or as a note below it) in [[Special:Statistics]]", "statistics-files": "Used in [[Special:Statistics]].\n{{Identical|Uploaded file}}", -- 2.20.1