From: Glaisher Date: Sat, 30 Jul 2016 10:05:36 +0000 (+0500) Subject: Use different message when (un)watching a page in talk namespace X-Git-Tag: 1.31.0-rc.0~6135 X-Git-Url: http://git.cyclocoop.org/%22.htmlspecialchars%28%24url_syndic%29.%22?a=commitdiff_plain;h=c08f8566b4c5764e40830d5c97fc1e5fcb65f4a7;p=lhc%2Fweb%2Fwiklou.git Use different message when (un)watching a page in talk namespace addedwatchtext and removedwatchtext uses the phrase "$1 and its discussion page". As this is inaccurate on talk namespace pages, two new messages, addedwatchtext-talk and removedwatchtext-talk, have been introduced for use in talk namespace pages. Bug: T87856 Change-Id: Iafd86402d3a2a65ce2be007c87c981ac08f44e67 --- diff --git a/includes/actions/UnwatchAction.php b/includes/actions/UnwatchAction.php index f8f1dc1f44..7f043e4676 100644 --- a/includes/actions/UnwatchAction.php +++ b/includes/actions/UnwatchAction.php @@ -50,7 +50,8 @@ class UnwatchAction extends WatchAction { } public function onSuccess() { - $this->getOutput()->addWikiMsg( 'removedwatchtext', $this->getTitle()->getPrefixedText() ); + $msgKey = $this->getTitle()->isTalkPage() ? 'removedwatchtext-talk' : 'removedwatchtext'; + $this->getOutput()->addWikiMsg( $msgKey, $this->getTitle()->getPrefixedText() ); } public function doesWrites() { diff --git a/includes/actions/WatchAction.php b/includes/actions/WatchAction.php index 890740fdd5..23505c020d 100644 --- a/includes/actions/WatchAction.php +++ b/includes/actions/WatchAction.php @@ -67,7 +67,8 @@ class WatchAction extends FormAction { } public function onSuccess() { - $this->getOutput()->addWikiMsg( 'addedwatchtext', $this->getTitle()->getPrefixedText() ); + $msgKey = $this->getTitle()->isTalkPage() ? 'addedwatchtext-talk' : 'addedwatchtext'; + $this->getOutput()->addWikiMsg( $msgKey, $this->getTitle()->getPrefixedText() ); } /* Static utility methods */ diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php index f09fdcb063..3a7a082148 100644 --- a/includes/api/ApiWatch.php +++ b/includes/api/ApiWatch.php @@ -110,14 +110,16 @@ class ApiWatch extends ApiBase { $status = UnwatchAction::doUnwatch( $title, $user ); $res['unwatched'] = $status->isOK(); if ( $status->isOK() ) { - $res['message'] = $this->msg( 'removedwatchtext', $title->getPrefixedText() ) + $msgKey = $title->isTalkPage() ? 'removedwatchtext-talk' : 'removedwatchtext'; + $res['message'] = $this->msg( $msgKey, $title->getPrefixedText() ) ->title( $title )->parseAsBlock(); } } else { $status = WatchAction::doWatch( $title, $user ); $res['watched'] = $status->isOK(); if ( $status->isOK() ) { - $res['message'] = $this->msg( 'addedwatchtext', $title->getPrefixedText() ) + $msgKey = $title->isTalkPage() ? 'addedwatchtext-talk' : 'addedwatchtext'; + $res['message'] = $this->msg( $msgKey, $title->getPrefixedText() ) ->title( $title )->parseAsBlock(); } } diff --git a/languages/i18n/en.json b/languages/i18n/en.json index bc7d78d7ac..cddc30e492 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -2064,9 +2064,11 @@ "watchnologin": "Not logged in", "addwatch": "Add to watchlist", "addedwatchtext": "\"[[:$1]]\" and its discussion page have been added to your [[Special:Watchlist|watchlist]].", + "addedwatchtext-talk": "\"[[:$1]]\" and its associated page have been added to your [[Special:Watchlist|watchlist]].", "addedwatchtext-short": "The page \"$1\" has been added to your watchlist.", "removewatch": "Remove from watchlist", "removedwatchtext": "\"[[:$1]]\" and its discussion page have been removed from your [[Special:Watchlist|watchlist]].", + "removedwatchtext-talk": "\"[[:$1]]\" and its associated page have been removed from your [[Special:Watchlist|watchlist]].", "removedwatchtext-short": "The page \"$1\" has been removed from your watchlist.", "watch": "Watch", "watchthispage": "Watch this page", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index b55375607e..21b639103e 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -2245,10 +2245,12 @@ "watchlistanontext": "Shown on Special:Userlogin when user tries to access their watchlist before logging in", "watchnologin": "Used as error page title.\n\nThe error message for this title is:\n* {{msg-mw|Watchnologintext}}\n{{Identical|Not logged in}}", "addwatch": "Link to a dialog box, displayed at the end of the list of categories at the foot of each page.\n\nSee also:\n* {{msg-mw|Removewatch}}", - "addedwatchtext": "Explanation shown when clicking on the {{msg-mw|Watch}} tab. Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Addedwatch}}", + "addedwatchtext": "Explanation shown when clicking on the {{msg-mw|Watch}} tab in a content namespace page. Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Addedwatch}}", + "addedwatchtext-talk": "Explanation shown when clicking on the {{msg-mw|Watch}} tab in a talk namespace page. Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Addedwatchtext}}", "addedwatchtext-short": "Explanation shown when watching item from [[Special:UnwatchedPages]].\n\nSee also:\n* {{msg-mw|Removedwatchtext-short}}\n* {{msg-mw|Addedwatchtext}}", "removewatch": "Link to a dialog box, displayed at the end of the list of categories at the foot of each page.\n\nSee also:\n* {{msg-mw|Addwatch}}", "removedwatchtext": "After a page has been removed from a user's watchlist by clicking the {{msg-mw|Unwatch}} tab at the top of an article, this message appears just below the title of the article.\n\nParameters:\n* $1 - the title of the article\nSee also:\n* {{msg-mw|Removedwatch}}\n* {{msg-mw|Addedwatchtext}}", + "removedwatchtext-talk": "Message shown when clicking on the {{msg-mw|Unwatch}} tab in a talk namespace page.Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Removedwatchtext}}", "removedwatchtext-short": "Explanation shown when unwatching item from [[Special:UnwatchedPages]].\n\nSee also:\n* {{msg-mw|Addedwatchtext-short}}.\n* {{msg-mw|Removedwatchtext}}.", "watch": "{{doc-actionlink}}\nName of the Watch tab. Should be in the imperative mood.\n\nSee also:\n* {{msg-mw|Watch}}\n* {{msg-mw|Accesskey-ca-watch}}\n* {{msg-mw|Tooltip-ca-watch}}", "watchthispage": "Used as link text.\n\nSee also:\n* {{msg-mw|Unwatchthispage|link text}}\n* {{msg-mw|Notanarticle|error message}}\n{{Identical|Watch this page}}",