From b9465068157b92ce3722cf15ab2effa6812b21a3 Mon Sep 17 00:00:00 2001 From: rillke Date: Wed, 23 Apr 2014 15:12:57 +0200 Subject: [PATCH] New 'newimagestext' message on [[Special:NewFiles]] 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 | 20 ++++++++++++++++++++ languages/i18n/en.json | 1 + languages/i18n/qqq.json | 1 + 3 files changed, 22 insertions(+) diff --git a/includes/specials/SpecialNewimages.php b/includes/specials/SpecialNewimages.php index c10a618b09..1d06071757 100644 --- a/includes/specials/SpecialNewimages.php +++ b/includes/specials/SpecialNewimages.php @@ -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 + ); + } + } } /** diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 4c844c38c6..cbae53b733 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -2598,6 +2598,7 @@ "file-no-thumb-animation": "Note: Due to technical limitations, thumbnails of this file will not be animated.", "file-no-thumb-animation-gif": "Note: Due to technical limitations, thumbnails of high resolution GIF images such as this one will not be animated.", "newimages": "Gallery of new files", + "newimagestext": "-", "imagelisttext": "Below is a list of $1 {{PLURAL:$1|file|files}} sorted $2.", "newimages-summary": "This special page shows the last uploaded files.", "newimages-legend": "Filter", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 2e3bd52215..5543692594 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -2764,6 +2764,7 @@ "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}}", -- 2.20.1