jenkins-bot has submitted this change and it was merged.

Change subject: Add link to PD help translatable pages from sidebar
......................................................................


Add link to PD help translatable pages from sidebar

Reuses the existing helppage default message and
adds it to ignored messages as Special:MyLanguage
is used and translations have to be removed:
this does not bother customised local links.

Now using HTTPS URL to mediawiki.org per Brion
on bug 54835. This slightly increases the footprint
of the change but should keep everything functionally
equivalent. The sidebar is not bothered by full URLs,
except in self-defeating tests which are also fixed here.

Bug: 53887
Change-Id: I999b97729536dbab4a3a5efd8d6f86527f031948
---
M includes/EditPage.php
M languages/messages/MessagesEn.php
M languages/messages/MessagesQqq.php
M maintenance/language/messageTypes.inc
M skins/CologneBlue.php
M tests/phpunit/skins/SideBarTest.php
M tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js
7 files changed, 45 insertions(+), 19 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/EditPage.php b/includes/EditPage.php
index 5f5cb53..3b2f179 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -2082,10 +2082,27 @@
                }
                # Try to add a custom edit intro, or use the standard one if 
this is not possible.
                if ( !$this->showCustomIntro() && !$this->mTitle->exists() ) {
+                       $helpLink = Skin::makeInternalOrExternalUrl(
+                               wfMessage( 'helppage' 
)->inContentLanguage()->text()
+                       );
                        if ( $wgUser->isLoggedIn() ) {
-                               $wgOut->wrapWikiMsg( "<div 
class=\"mw-newarticletext\">\n$1\n</div>", 'newarticletext' );
+                               $wgOut->wrapWikiMsg(
+                                       // Suppress the external link icon, 
consider the help url an internal one
+                                       "<div class=\"mw-newarticletext 
plainlinks\">\n$1\n</div>",
+                                       array(
+                                               'newarticletext',
+                                               $helpLink
+                                       )
+                               );
                        } else {
-                               $wgOut->wrapWikiMsg( "<div 
class=\"mw-newarticletextanon\">\n$1\n</div>", 'newarticletextanon' );
+                               $wgOut->wrapWikiMsg(
+                                       // Suppress the external link icon, 
consider the help url an internal one
+                                       "<div class=\"mw-newarticletextanon 
plainlinks\">\n$1\n</div>",
+                                       array(
+                                               'newarticletextanon',
+                                               $helpLink
+                                       )
+                               );
                        }
                }
                # Give a notice if the user is editing a deleted/moved page...
diff --git a/languages/messages/MessagesEn.php 
b/languages/messages/MessagesEn.php
index 435f7cc..085cb29 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -654,6 +654,7 @@
 ** mainpage|mainpage-description
 ** recentchanges-url|recentchanges
 ** randompage-url|randompage
+** helppage|help
 * SEARCH
 * TOOLBOX
 * LANGUAGES', # do not translate or duplicate this message to other languages
@@ -913,7 +914,7 @@
 'disclaimerpage'       => 'Project:General disclaimer',
 'edithelp'             => 'Editing help',
 'edithelppage'         => 
'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Editing_pages', # do 
not translate or duplicate this message to other languages
-'helppage'             => 'Help:Contents',
+'helppage'             => 
'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents',
 'mainpage'             => 'Main Page',
 'mainpage-description' => 'Main page',
 'policy-url'           => 'Project:Policy',
@@ -1446,9 +1447,9 @@
 'accmailtext'                              => 'A randomly generated password 
for [[User talk:$1|$1]] has been sent to $2. It can be changed on the 
<em>[[Special:ChangePassword|change password]]</em> page upon logging in.',
 'newarticle'                               => '(New)',
 'newarticletext'                           => "You have followed a link to a 
page that does not exist yet.
-To create the page, start typing in the box below (see the 
[[{{MediaWiki:Helppage}}|help page]] for more info).
+To create the page, start typing in the box below (see the [$1 help page] for 
more info).
 If you are here by mistake, click your browser's <strong>back</strong> 
button.",
-'newarticletextanon'                       => '{{int:newarticletext}}', # do 
not translate or duplicate this message to other languages
+'newarticletextanon'                       => '{{int:newarticletext|$1}}', # 
do not translate or duplicate this message to other languages
 'talkpagetext'                             => '<!-- MediaWiki:talkpagetext 
-->', # do not translate or duplicate this message to other languages
 'anontalkpagetext'                         => '----
 <em>This is the discussion page for an anonymous user who has not created an 
account yet, or who does not use it.</em>
diff --git a/languages/messages/MessagesQqq.php 
b/languages/messages/MessagesQqq.php
index dbc2248..f3fa70b 100644
--- a/languages/messages/MessagesQqq.php
+++ b/languages/messages/MessagesQqq.php
@@ -1954,10 +1954,9 @@
 * $1 - username
 * $2 - email address",
 'newarticle' => '{{Identical|New}}',
-'newarticletext' => '{{doc-important|Do not translate 
<code><nowiki>{{MediaWiki:Helppage}}</nowiki></code>.}}
-Text displayed above the edit box in editor when trying to create a new page.
-
-Refers to {{msg-mw|Helppage}}.',
+'newarticletext' => "Text displayed above the edit box in editor when trying 
to create a new page.
+Parameters:
+* $1 - The URL to the help page, defined in {{msg-mw|helppage}}",
 'anontalkpagetext' => 'Displayed at the bottom of talk pages of anonymous 
users.',
 'noarticletext' => 'This is the message that you get if you search for a term 
that has not yet got any entries on the wiki.
 
diff --git a/maintenance/language/messageTypes.inc 
b/maintenance/language/messageTypes.inc
index 6cda6d2..9f73c80 100644
--- a/maintenance/language/messageTypes.inc
+++ b/maintenance/language/messageTypes.inc
@@ -266,6 +266,7 @@
        'createacct-benefit-icon3',
        'today-at',
        'redirect-text',
+       'helppage',
        'edithelppage',
        'helplogin-url',
        'autocomment-prefix',
diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php
index 9344feb..0765aa1 100644
--- a/skins/CologneBlue.php
+++ b/skins/CologneBlue.php
@@ -383,9 +383,10 @@
                                Title::newFromText( wfMessage( 'aboutpage' 
)->inContentLanguage()->text() ),
                                wfMessage( 'about' )->text()
                        ),
-                       Linker::linkKnown(
-                               Title::newFromText( wfMessage( 'helppage' 
)->inContentLanguage()->text() ),
-                               wfMessage( 'help' )->text()
+                       Linker::makeExternalLink(
+                               Skin::makeInternalOrExternalUrl( wfMessage( 
'helppage' )->inContentLanguage()->text() ),
+                               wfMessage( 'help' )->text(),
+                               false
                        ),
                        Linker::linkKnown(
                                Title::newFromText( wfMessage( 'faqpage' 
)->inContentLanguage()->text() ),
diff --git a/tests/phpunit/skins/SideBarTest.php 
b/tests/phpunit/skins/SideBarTest.php
index 7d33a59..3fb487c 100644
--- a/tests/phpunit/skins/SideBarTest.php
+++ b/tests/phpunit/skins/SideBarTest.php
@@ -15,7 +15,8 @@
 
        /** Build $this->messages array */
        private function initMessagesHref() {
-               # List of default messages for the sidebar:
+               # List of default messages for the sidebar. The sidebar doesn't 
care at
+               # all whether they are full URLs, interwiki links or local 
titles.
                $URL_messages = array(
                        'mainpage',
                        'portal-url',
@@ -25,10 +26,16 @@
                        'helppage',
                );
 
+               # We're assuming that isValidURI works as advertised: it's also
+               # tested separately, in tests/phpunit/includes/HttpTest.php.
                foreach ( $URL_messages as $m ) {
                        $titleName = MessageCache::singleton()->get( $m );
-                       $title = Title::newFromText( $titleName );
-                       $this->messages[$m]['href'] = $title->getLocalURL();
+                       if ( Http::isValidURI( $titleName ) ) {
+                               $this->messages[$m]['href'] = $titleName;
+                       } else {
+                               $title = Title::newFromText( $titleName );
+                               $this->messages[$m]['href'] = 
$title->getLocalURL();
+                       }
                }
        }
 
diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js 
b/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js
index 292c576..24a7cc9 100644
--- a/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js
+++ b/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js
@@ -376,14 +376,14 @@
        } );
 
        QUnit.test( 'Int', 4, function ( assert ) {
-               var newarticletextSource = 'You have followed a link to a page 
that does not exist yet. To create the page, start typing in the box below (see 
the [[{{Int:Helppage}}|help page]] for more info). If you are here by mistake, 
click your browser\'s back button.',
+               var newarticletextSource = 'You have followed a link to a page 
that does not exist yet. To create the page, start typing in the box below (see 
the [[{{Int:Foobar}}|foobar]] for more info). If you are here by mistake, click 
your browser\'s back button.',
                        expectedNewarticletext,
-                       helpPageTitle = 'Help:Contents';
+                       helpPageTitle = 'Help:Foobar';
 
-               mw.messages.set( 'helppage', helpPageTitle );
+               mw.messages.set( 'foobar', helpPageTitle );
 
                expectedNewarticletext = 'You have followed a link to a page 
that does not exist yet. To create the page, start typing in the box below (see 
the ' +
-                       '<a title="Help:Contents" 
href="/wiki/Help:Contents">help page</a> for more info). If you are here by 
mistake, click your browser\'s back button.';
+                       '<a title="Help:Foobar" 
href="/wiki/Help:Foobar">foobar</a> for more info). If you are here by mistake, 
click your browser\'s back button.';
 
                mw.messages.set( 'newarticletext', newarticletextSource );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/83221
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I999b97729536dbab4a3a5efd8d6f86527f031948
Gerrit-PatchSet: 23
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Nemo bis <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: MZMcBride <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: MegaAlex <[email protected]>
Gerrit-Reviewer: Nemo bis <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Qgil <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to