r54633 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54632‎ | r54633 | r54634 >
Date:16:02, 8 August 2009
Author:jan
Status:reverted (Comments)
Tags:
Comment:
(fixes for r54628) Add PLURAL to "last change" message
Modified paths:
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -217,7 +217,7 @@
218218
219219 static $idCacheByName = array();
220220
221 - var $mNewtalknumber;
 221+ public $mNewtalknumber;
222222
223223 /**
224224 * Lightweight constructor for an anonymous user.
@@ -1639,7 +1639,7 @@
16401640 * Return the number of new messages
16411641 * @return \int The number of new messages
16421642 */
1643 - public function getNewtalkNumber() {
 1643+ public function getnewMessagesCount() {
16441644 global $wgLang;
16451645 return $wgLang->formatNum( $this->mNewtalknumber );
16461646 }
Index: trunk/phase3/includes/SkinTemplate.php
@@ -302,6 +302,8 @@
303303 if( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) {
304304 $usertitle = $this->mUser->getUserPage();
305305 $usertalktitle = $usertitle->getTalkPage();
 306+
 307+ $newmessagescount = $wgUser->getnewMessagesCount();
306308
307309 if( !$usertalktitle->equals( $this->mTitle ) ) {
308310 $newmessageslink = $this->link(
@@ -314,19 +316,16 @@
315317
316318 $newmessagesdifflink = $this->link(
317319 $usertalktitle,
318 - wfMsgHtml( 'newmessagesdifflink' ),
 320+ wfMsgHtml( 'newmessagesdifflink', $newmessagescount ),
319321 array(),
320322 array( 'diff' => 'cur' ),
321323 array( 'known', 'noclasses' )
322324 );
323 -
324 - $newmessagesnumber = $wgUser->getNewtalkNumber();
325325
326326 $ntl = wfMsg(
327327 'youhavenewmessages',
328328 $newmessageslink,
329329 $newmessagesdifflink,
330 - $newmessagesnumber
331330 );
332331 # Disable Cache
333332 $out->setSquidMaxage( 0 );
@@ -538,7 +537,7 @@
539538 # do not show text when we are viewing our
540539 # own talk page
541540 if( !$title->equals( $wgUser->getTalkPage() ) ) {
542 - $newtalk = $wgUser->getNewtalkNumber();
 541+ $newtalk = $wgUser->getnewMessagesCount();
543542
544543 # disable caching
545544 $wgOut->setSquidMaxage( 0 );
Index: trunk/phase3/includes/Skin.php
@@ -1040,9 +1040,11 @@
10411041 # do not show "You have new messages" text when we are viewing our
10421042 # own talk page
10431043 if( !$this->mTitle->equals( $wgUser->getTalkPage() ) ) {
 1044+ $nu = $wgUser->getnewMessagesCount();
 1045+
10441046 $tl = $this->link(
10451047 $wgUser->getTalkPage(),
1046 - wfMsgHtml( 'newmessageslink' ),
 1048+ wfMsgHtml( 'newmessageslink'),
10471049 array(),
10481050 array( 'redirect' => 'no' ),
10491051 array( 'known', 'noclasses' )
@@ -1050,7 +1052,7 @@
10511053
10521054 $dl = $this->link(
10531055 $wgUser->getTalkPage(),
1054 - wfMsgHtml( 'newmessagesdifflink' ),
 1056+ wfMsgHtml( 'newmessagesdifflink', $nu ),
10551057 array(),
10561058 array( 'diff' => 'cur' ),
10571059 array( 'known', 'noclasses' )
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -895,7 +895,7 @@
896896 'pagetitle-view-mainpage' => '{{SITENAME}}', # only translate this message to other languages if you have to change it
897897 'retrievedfrom' => 'Retrieved from "$1"',
898898 'youhavenewmessages' => 'You have $3 $1 ($2).',
899 -'newmessageslink' => 'new messages',
 899+'newmessageslink' => '{{PLURAL:$1|new message|new messages}}',
900900 'newmessagesdifflink' => 'last change',
901901 'youhavenewmessagesmulti' => 'You have new messages on $1',
902902 'newtalkseparator' => ', ', # do not translate or duplicate this message to other languages

Follow-up revisions

RevisionCommit summaryAuthorDate
r54636fixes for r54633: Add wfMsgExt for parsing PLURAL in message "newmessagesdiff...jan17:34, 8 August 2009
r54714(r54628 + r54633) Display (...) only if there new messagesjan11:29, 10 August 2009
r54733Pull back r54590, r54591, r54628, r54633, r54636, r54714 "Add after the link ...brion19:03, 10 August 2009
r54740Localisation updates for core messages from translatewiki.net...siebrand20:45, 10 August 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r54628(fixes for r54590 & bug 20103) Use now only one query and add number to messa...jan10:37, 8 August 2009

Comments

#Comment by Nikerabbit (talk | contribs)   16:18, 8 August 2009

Unfortunately plural magic work does not work with wfMsgHtml:

wfMsgHtml( 'newmessagesdifflink', $newmessagescount ),

This could work instead:

wfMsgExt( 'newmessagesdifflink', array( 'parsemag', 'escape' ), $newmessagescount ),

Same for newmessageslink. newmessagesdifflink doesn't seem to use the parameter at all.

Status & tagging log