r112591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112590‎ | r112591 | r112592 >
Date:12:41, 28 February 2012
Author:siebrand
Status:resolved (Comments)
Tags:i18nreview 
Comment:
(bug 34702) More localised parentheses.
Modified paths:
  • /trunk/phase3/includes/RecentChange.php (modified) (history)
  • /trunk/phase3/includes/SkinLegacy.php (modified) (history)
  • /trunk/phase3/includes/logging/LogEventsList.php (modified) (history)
  • /trunk/phase3/includes/logging/LogPage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllmessages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialListusers.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialTags.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUndelete.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RecentChange.php
@@ -706,6 +706,7 @@
707707 } elseif($szdiff >= 0) {
708708 $szdiff = '+' . $szdiff ;
709709 }
 710+ // @todo i18n with parentheses in content language?
710711 $szdiff = '(' . $szdiff . ')' ;
711712 } else {
712713 $szdiff = '';
Index: trunk/phase3/includes/logging/LogPage.php
@@ -416,7 +416,8 @@
417417
418418 # Use the language name for log titles, rather than Log/X
419419 if( $name == 'Log' ) {
420 - $titleLink = '(' . Linker::link( $title, LogPage::logName( $par ) ) . ')';
 420+ $titleLink = Linker::link( $title, LogPage::logName( $par ) );
 421+ $titleLink = wfMessage( 'parentheses' )->rawParams( $titleLink )->escaped();
421422 } else {
422423 $titleLink = Linker::link( $title );
423424 }
@@ -551,7 +552,7 @@
552553 for( $i = 0; $i < count( $flags ); $i++ ) {
553554 $flags[$i] = self::formatBlockFlag( $flags[$i], $lang );
554555 }
555 - return '(' . $lang->commaList( $flags ) . ')';
 556+ return wfMessage( 'parentheses' )->rawParams( $lang->commaList( $flags ) )->escaped();
556557 } else {
557558 return '';
558559 }
Index: trunk/phase3/includes/logging/LogEventsList.php
@@ -383,7 +383,7 @@
384384 if( self::typeAction( $row, 'move', 'move', 'move' ) && !empty( $paramArray[0] ) ) {
385385 $destTitle = Title::newFromText( $paramArray[0] );
386386 if( $destTitle ) {
387 - $revert = '(' . Linker::link(
 387+ $revert = Linker::link(
388388 SpecialPage::getTitleFor( 'Movepage' ),
389389 $this->message['revertmove'],
390390 array(),
@@ -394,7 +394,8 @@
395395 'wpMovetalk' => 0
396396 ),
397397 array( 'known', 'noclasses' )
398 - ) . ')';
 398+ );
 399+ $revert = wfMessage( 'parentheses' )->rawParams( $revert )->escaped();
399400 }
400401 // Show undelete link
401402 } elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'delete', 'deletedhistory' ) ) {
@@ -403,17 +404,17 @@
404405 } else {
405406 $viewdeleted = $this->message['undeletelink'];
406407 }
407 - $revert = '(' . Linker::link(
 408+ $revert = Linker::link(
408409 SpecialPage::getTitleFor( 'Undelete' ),
409410 $viewdeleted,
410411 array(),
411412 array( 'target' => $title->getPrefixedDBkey() ),
412413 array( 'known', 'noclasses' )
413 - ) . ')';
 414+ );
 415+ $revert = wfMessage( 'parentheses' )->rawParams( $revert )->escaped();
414416 // Show unblock/change block link
415417 } elseif( self::typeAction( $row, array( 'block', 'suppress' ), array( 'block', 'reblock' ), 'block' ) ) {
416 - $revert = '(' .
417 - Linker::link(
 418+ $revert = Linker::link(
418419 SpecialPage::getTitleFor( 'Unblock', $row->log_title ),
419420 $this->message['unblocklink'],
420421 array(),
@@ -427,12 +428,11 @@
428429 array(),
429430 array(),
430431 'known'
431 - ) .
432 - ')';
 432+ );
 433+ $revert = wfMessage( 'parentheses' )->rawParams( $revert )->escaped();
433434 // Show change protection link
434435 } elseif( self::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) {
435 - $revert .= ' (' .
436 - Linker::link( $title,
 436+ $revert .= Linker::link( $title,
437437 $this->message['hist'],
438438 array(),
439439 array(
@@ -448,10 +448,10 @@
449449 array( 'action' => 'protect' ),
450450 'known' );
451451 }
452 - $revert .= ')';
 452+ $revert = ' ' . wfMessage( 'parentheses' )->rawParams( $revert )->escaped();
453453 // Show unmerge link
454454 } elseif( self::typeAction( $row, 'merge', 'merge', 'mergehistory' ) ) {
455 - $revert = '(' . Linker::link(
 455+ $revert = Linker::link(
456456 SpecialPage::getTitleFor( 'MergeHistory' ),
457457 $this->message['revertmerge'],
458458 array(),
@@ -461,7 +461,8 @@
462462 'mergepoint' => $paramArray[1]
463463 ),
464464 array( 'known', 'noclasses' )
465 - ) . ')';
 465+ );
 466+ $revert = wfMessage( 'parentheses' )->rawParams( $revert )->escaped();
466467 // If an edit was hidden from a page give a review link to the history
467468 } elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'revision', 'deletedhistory' ) ) {
468469 $revert = RevisionDeleter::getLogLinks( $title, $paramArray,
@@ -473,7 +474,7 @@
474475 // $paramArray[1] is a CSV of the IDs
475476 $query = $paramArray[0];
476477 // Link to each hidden object ID, $paramArray[1] is the url param
477 - $revert = '(' . Linker::link(
 478+ $revert = Linker::link(
478479 $revdel,
479480 $this->message['revdel-restore'],
480481 array(),
@@ -483,7 +484,8 @@
484485 'ids' => $query
485486 ),
486487 array( 'known', 'noclasses' )
487 - ) . ')';
 488+ );
 489+ $revert = wfMessage( 'parentheses' )->rawParams( $revert )->escaped();
488490 }
489491 // Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
490492 } else {
Index: trunk/phase3/includes/SkinLegacy.php
@@ -702,7 +702,7 @@
703703 global $wgOut;
704704
705705 if ( !$wgOut->isArticleRelated() ) {
706 - return '(' . wfMsg( 'notanarticle' ) . ')';
 706+ return wfMessage( 'parentheses', wfMessage( 'notanarticle' )->text() )->escaped();
707707 } else {
708708 return Linker::linkKnown(
709709 SpecialPage::getTitleFor( 'Recentchangeslinked', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
@@ -815,8 +815,9 @@
816816
817817 $talkLink = Linker::link( $wgUser->getTalkPage(),
818818 $wgLang->getNsText( NS_TALK ) );
 819+ $talkLink = wfMessage( 'parentheses' )->rawParams( $talkLink )->escaped();
819820
820 - $ret .= "$name ($talkLink)";
 821+ $ret .= "$name $talkLink";
821822 } else {
822823 $ret .= wfMsg( 'notloggedin' );
823824 }
@@ -837,10 +838,11 @@
838839 } else {
839840 $talkLink = Linker::link( $wgUser->getTalkPage(),
840841 $wgLang->getNsText( NS_TALK ) );
 842+ $talkLink = wfMessage( 'parentheses' )->rawParams( $talkLink )->escaped();
841843
842844 $ret .= Linker::link( $wgUser->getUserPage(),
843845 htmlspecialchars( $wgUser->getName() ) );
844 - $ret .= " ($talkLink)<br />";
 846+ $ret .= " $talkLink<br />";
845847 $ret .= $wgLang->pipeList( array(
846848 Linker::link(
847849 SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
@@ -860,6 +862,4 @@
861863
862864 return $ret;
863865 }
864 -
865866 }
866 -
Index: trunk/phase3/includes/specials/SpecialAllmessages.php
@@ -370,7 +370,7 @@
371371 array( 'broken' )
372372 );
373373 }
374 - return $title . ' (' . $talk . ')';
 374+ return $title . $this->msg( 'parentheses' )->rawParams( $talk )->escaped();
375375
376376 case 'am_default' :
377377 case 'am_actual' :
Index: trunk/phase3/includes/specials/SpecialUndelete.php
@@ -1233,9 +1233,9 @@
12341234 $pageLink = $this->getLanguage()->userTimeAndDate( $ts, $user );
12351235 }
12361236 $userLink = $this->getFileUser( $file );
1237 - $data = $this->msg( 'widthheight' )->numParams( $row->fa_width, $row->fa_height )->text() .
1238 - ' (' . $this->msg( 'nbytes' )->numParams( $row->fa_size )->text() . ')';
1239 - $data = htmlspecialchars( $data );
 1237+ $data = $this->msg( 'widthheight' )->numParams( $row->fa_width, $row->fa_height )->text();
 1238+ $bytes = $this->msg( 'parentheses' )->rawParams( $this->msg( 'nbytes' )->numParams( $row->fa_size )->text() )->plain();
 1239+ $data = htmlspecialchars( $data . ' ' . $bytes );
12401240 $comment = $this->getFileComment( $file );
12411241
12421242 // Add show/hide deletion links if available
Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -334,7 +334,7 @@
335335
336336 $ip = $this->getRequest()->getIP();
337337 if ( $currentUser->isDnsBlacklisted( $ip, true /* check $wgProxyWhitelist */ ) ) {
338 - $this->mainLoginForm( $this->msg( 'sorbs_create_account_reason' )->text() . ' (' . htmlspecialchars( $ip ) . ')' );
 338+ $this->mainLoginForm( $this->msg( 'sorbs_create_account_reason' )->text() . ' ' . $this->msg( 'parentheses' )->rawParams( htmlspecialchars( $ip ) )->escaped() );
339339 return false;
340340 }
341341
Index: trunk/phase3/includes/specials/SpecialListusers.php
@@ -158,14 +158,16 @@
159159 }
160160
161161 $userTalkPage = $userPage->getTalkPage();
162 - $talk = ' (' . Linker::link( $userTalkPage, wfMessage( 'talkpagelinktext' )->escaped() ) . ')';
 162+ $talk = Linker::link( $userTalkPage, wfMessage( 'talkpagelinktext' )->escaped() );
 163+ $talk = ' ' . wfMessage( 'parentheses' )->rawParams( $talk )->escaped();
163164
164165 $created = '';
165166 # Some rows may be NULL
166167 if( $row->creation ) {
167168 $d = $lang->date( wfTimestamp( TS_MW, $row->creation ), true );
168169 $t = $lang->time( wfTimestamp( TS_MW, $row->creation ), true );
169 - $created = ' (' . wfMsgExt( 'usercreated', array( 'parsemag', 'escape' ), $d, $t, $row->user_name ) . ')';
 170+ $created = wfMsgExt( 'usercreated', array( 'parsemag', 'escape' ), $d, $t, $row->user_name );
 171+ $created = ' ' . wfMessage( 'parentheses' )->rawParams( $created )->escaped();
170172 }
171173
172174 wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) );
Index: trunk/phase3/includes/specials/SpecialTags.php
@@ -75,12 +75,16 @@
7676 $newRow .= Xml::tags( 'td', null, Xml::element( 'tt', null, $tag ) );
7777
7878 $disp = ChangeTags::tagDescription( $tag );
79 - $disp .= ' (' . Linker::link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag" ), wfMsgHtml( 'tags-edit' ) ) . ')';
 79+ $disp .= ' ';
 80+ $editLink = Linker::link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag" ), wfMsgHtml( 'tags-edit' ) );
 81+ $disp .= $this->msg( 'parentheses' )->rawParams( $editLink )->escaped();
8082 $newRow .= Xml::tags( 'td', null, $disp );
8183
8284 $msg = wfMessage( "tag-$tag-description" );
8385 $desc = !$msg->exists() ? '' : $msg->parse();
84 - $desc .= ' (' . Linker::link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag-description" ), wfMsgHtml( 'tags-edit' ) ) . ')';
 86+ $desc .= ' ';
 87+ $editDescLink = Linker::link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag-description" ), wfMsgHtml( 'tags-edit' ) );
 88+ $desc .= $this->msg( 'parentheses' )->rawParams( $editDescLink )->escaped();
8589 $newRow .= Xml::tags( 'td', null, $desc );
8690
8791 $hitcount = wfMsgExt( 'tags-hitcount', array( 'parsemag' ), $this->getLanguage()->formatNum( $hitcount ) );

Follow-up revisions

RevisionCommit summaryAuthorDate
r112630fix r112591: re-add whitespace between message name and (talk)robin20:14, 28 February 2012
r113121No point doing it the hard way, ping r112591nikerabbit07:20, 6 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112410(bug 34702) Use localised parentheses in Special:Contributions.siebrand20:42, 25 February 2012
r112412Follow-up r112410: (bug 34702) Use localised parentheses for comment, too.siebrand20:53, 25 February 2012
r112433(bug 34702) Localised parentheses are now used in more special pages.siebrand13:08, 26 February 2012
r112589(bug 34702) More localised parentheses. Patch contributed by Yusuke Matsubara.siebrand11:56, 28 February 2012

Comments

#Comment by SPQRobin (talk | contribs)   20:17, 28 February 2012
- return $title . ' (' . $talk . ')';
+ return $title . $this->msg( 'parentheses' )->rawParams( $talk )->escaped();

Whitespace re-added in r112630

Status & tagging log