New 'newimagestext' message on [[Special:NewFiles]]
authorrillke <rainerrillke@hotmail.com>
Wed, 23 Apr 2014 13:12:57 +0000 (15:12 +0200)
committerrillke <rainerrillke@hotmail.com>
Wed, 23 Apr 2014 21:21:43 +0000 (23:21 +0200)
There is a default message called 'newimages-summary' but its output
is in user language and not in content language. Therefore, to customize
the introduction at [[Special:NewFiles]], one has to override all trans-
lations (which in turn must be maintained).

Use cases:
* Wikimedia Commons: Wants to add links to external tools and different
  gallery styles.
  Currently [[:commons:MediaWiki:Newimages-summary]] is used, and thus
  the customization is only visible to users with English user language
  preference set.

Change-Id: I4a253847d25540c90a0708636058ca821b035b06

includes/specials/SpecialNewimages.php
languages/i18n/en.json
languages/i18n/qqq.json

index c10a618..1d06071 100644 (file)
@@ -33,6 +33,7 @@ class SpecialNewFiles extends IncludableSpecialPage {
                $pager = new NewFilesPager( $this->getContext(), $par );
 
                if ( !$this->including() ) {
+                       $this->setTopText();
                        $form = $pager->getForm();
                        $form->prepareForm();
                        $form->displayForm( '' );
@@ -47,6 +48,25 @@ class SpecialNewFiles extends IncludableSpecialPage {
        protected function getGroupName() {
                return 'changes';
        }
+
+       /**
+        * Send the text to be displayed above the options
+        */
+       function setTopText() {
+               global $wgContLang;
+
+               $message = $this->msg( 'newimagestext' )->inContentLanguage();
+               if ( !$message->isDisabled() ) {
+                       $this->getOutput()->addWikiText(
+                               Html::rawElement( 'p',
+                                       array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
+                                       "\n" . $message->plain() . "\n"
+                               ),
+                               /* $lineStart */ false,
+                               /* $interface */ false
+                       );
+               }
+       }
 }
 
 /**
index 4c844c3..cbae53b 100644 (file)
     "file-no-thumb-animation": "<strong>Note: Due to technical limitations, thumbnails of this file will not be animated.</strong>",
     "file-no-thumb-animation-gif": "<strong>Note: Due to technical limitations, thumbnails of high resolution GIF images such as this one will not be animated.</strong>",
     "newimages": "Gallery of new files",
+    "newimagestext": "-",
     "imagelisttext": "Below is a list of <strong>$1</strong> {{PLURAL:$1|file|files}} sorted $2.",
     "newimages-summary": "This special page shows the last uploaded files.",
     "newimages-legend": "Filter",
index 2e3bd52..5543692 100644 (file)
        "file-no-thumb-animation": "We cannot animate thumbnails of this file.\n\nThis notice is shown on the image description page on animated svg files just below {{msg-mw|File-info-size}}.\n\nThis message may be overridden by a more specific message:\n* {{msg-mw|File-no-thumb-animation-gif}}.",
        "file-no-thumb-animation-gif": "Cannot animate thumbnails of this gif file, because it has too big a resolution. The cut off resolution can vary between wikis ([[mw:manual:$wgMaxAnimatedGifArea|$wgMaxAnimatedGifArea]]). Note that resolution is calculated as width times height times number of frames. See {{msg-mw|file-no-thumb-animation}}.",
        "newimages": "Page title of [[Special:NewImages]].",
+       "newimagestext": "Text in [[Special:NewImages]].",
        "imagelisttext": "This is text on [[Special:NewImages]]. Parameters:\n* $1 - the number of files\n* $2 - the message {{msg-mw|Bydate}}",
        "newimages-summary": "This message is displayed at the top of [[Special:NewImages]] to explain what is shown on that special page.",
        "newimages-legend": "Caption of the fieldset for the filter on [[Special:NewImages]]\n\n{{Identical|Filter}}",