Make linkshere-related messages backward compatible
authorDaimona Eaytoy <daimona.wiki@gmail.com>
Wed, 30 May 2018 15:16:36 +0000 (17:16 +0200)
committerDaimona Eaytoy <daimona.wiki@gmail.com>
Thu, 31 May 2018 10:29:06 +0000 (12:29 +0200)
With I11e663cbce32b4199f16df6ed1e9b980630ece7a we changed message
parsing and message name, which broke some customized messages where $1
was used for various purposed as the page title. This patch shifts
message parameters so to still pass plain title as $1 while keeping HTML
link as $2. This won't change parsing method (still HTML since we use an
HTML link), nor message key (still with "-2") due to different parsing
method.

Bug: T189860
Change-Id: I68a8639a61237c67deb61aefd5360dea3cced6cd

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

index 5677ac8..0f3bea7 100644 (file)
@@ -216,7 +216,10 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                                                $this->target->isRedirect() ? [ 'redirect' => 'no' ] : []
                                        );
 
-                                       $errMsg = $this->msg( $msgKey )->rawParams( $link )->parseAsBlock();
+                                       $errMsg = $this->msg( $msgKey )
+                                               ->params( $this->target->getPrefixedText() )
+                                               ->rawParams( $link )
+                                               ->parseAsBlock();
                                        $out->addHTML( $errMsg );
                                        $out->setStatusCode( 404 );
                                }
@@ -289,7 +292,10 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                                        $this->target->isRedirect() ? [ 'redirect' => 'no' ] : []
                                );
 
-                               $msg = $this->msg( 'linkshere-2' )->rawParams( $link )->parseAsBlock();
+                               $msg = $this->msg( 'linkshere-2' )
+                                       ->params( $this->target->getPrefixedText() )
+                                       ->rawParams( $link )
+                                       ->parseAsBlock();
                                $out->addHTML( $msg );
 
                                $prevnext = $this->getPrevNext( $prevId, $nextId );
index 837e3b5..37a682d 100644 (file)
        "whatlinkshere-title": "Pages that link to \"$1\"",
        "whatlinkshere-summary": "",
        "whatlinkshere-page": "Page:",
-       "linkshere-2": "The following pages link to <strong>$1</strong>:",
-       "nolinkshere-2": "No pages link to <strong>$1</strong>.",
-       "nolinkshere-ns-2": "No pages link to <strong>$1</strong> in the chosen namespace.",
+       "linkshere-2": "The following pages link to <strong>$2</strong>:",
+       "nolinkshere-2": "No pages link to <strong>$2</strong>.",
+       "nolinkshere-ns-2": "No pages link to <strong>$2</strong> in the chosen namespace.",
        "isredirect": "redirect page",
        "istemplate": "transclusion",
        "isimage": "file link",
index 139c91c..9a35404 100644 (file)
        "whatlinkshere-title": "Title of the special page [[Special:WhatLinksHere]]. This page appears when you click on the 'What links here' button in the toolbox. $1 is the name of the page concerned.",
        "whatlinkshere-summary": "{{doc-specialpagesummary|whatlinkshere}}",
        "whatlinkshere-page": "{{Identical|Page}}",
-       "linkshere-2": "This message is the header line of the [[Special:WhatLinksHere/$1]] page generated by clicking \"What links here\" in the sidebar toolbox.\n\nIt is followed by a navigation bar built using {{msg-mw|Viewprevnext}}.\n\nParameters:\n* $1 - HTML link to the page.",
-       "nolinkshere-2": "Used in [[Special:WhatLinksHere]] if empty. Parameters:\n* $1 - HTML link to the page\nSee also:\n* {{msg-mw|Nolinkshere-ns-html}}",
-       "nolinkshere-ns-2": "Used in [[Special:WhatLinksHere]] if empty. Parameters:\n* $1 - HTML link to the page\nSee also:\n* {{msg-mw|Nolinkshere-html}}",
+       "linkshere-2": "This message is the header line of the [[Special:WhatLinksHere/$1]] page generated by clicking \"What links here\" in the sidebar toolbox.\n\nIt is followed by a navigation bar built using {{msg-mw|Viewprevnext}}.\n\nParameters:\n* $1 - Plain page title\n* $2 - HTML link to the page.",
+       "nolinkshere-2": "Used in [[Special:WhatLinksHere]] if empty. Parameters:\n* $1 - Plain page title\n* $2 - HTML link to the page.\nSee also:\n* {{msg-mw|Nolinkshere-ns-html}}",
+       "nolinkshere-ns-2": "Used in [[Special:WhatLinksHere]] if empty. Parameters:\n* $1 - Plain page title\n* $2 - HTML link to the page.\nSee also:\n* {{msg-mw|Nolinkshere-html}}",
        "isredirect": "Displayed in [[Special:WhatLinksHere]] (see [{{fullurl:Special:WhatLinksHere/Project:Translator|hidelinks=1}} Special:WhatLinksHere/Project:Translator] for example).\n\n{{Identical|Redirect page}}",
        "istemplate": "Means that a page (a template, specifically) is used as <code><nowiki>{{Page name}}</nowiki></code>.\nDisplayed in [[Special:WhatLinksHere]] (see [[Special:WhatLinksHere/Template:New portal]] for example).\nIf you are not sure how to translate this term, think of something like \"inclusion\", \"embedding\", or \"insertion\".\n{{Identical|Transclusion}}",
        "isimage": "This message is displayed on [[Special:WhatLinksHere]] for images. It means that the image is used on the page (as opposed to just being linked to like an non-image page).\n{{Identical|File link}}",