SpecialStatistics: Implement statistics-articles-desc message
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 24 Jul 2015 21:11:09 +0000 (14:11 -0700)
committerKrinkle <krinklemail@gmail.com>
Sat, 25 Jul 2015 21:05:49 +0000 (21:05 +0000)
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
languages/i18n/en.json
languages/i18n/qqq.json

index 652ea82..8de6f8b 100644 (file)
@@ -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 .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc' ),
-                                       " $descriptionText" );
+                               $text .= "<br />" . 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' ),
index 1fdd75d..cb09a16 100644 (file)
        "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",
index 872a89f..1c0b5b1 100644 (file)
        "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}}",