r112410 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112409‎ | r112410 | r112411 >
Date:20:42, 25 February 2012
Author:siebrand
Status:resolved (Comments)
Tags:i18nreview 
Comment:
(bug 34702) Use localised parentheses in Special:Contributions.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.20 (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/Pager.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -1440,7 +1440,7 @@
14411441 } else {
14421442 global $wgLang;
14431443 $stxt = wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $size ) );
1444 - $stxt = "($stxt)";
 1444+ $stxt = wfMessage( 'parentheses' )->rawParams( $stxt );
14451445 }
14461446 $stxt = htmlspecialchars( $stxt );
14471447 return "<span class=\"history-size\">$stxt</span>";
@@ -1869,7 +1869,7 @@
18701870 $html = $delete ? wfMsgHtml( 'rev-delundel' ) : wfMsgHtml( 'rev-showdeleted' );
18711871 $tag = $restricted ? 'strong' : 'span';
18721872 $link = self::link( $sp, $html, array(), $query, array( 'known', 'noclasses' ) );
1873 - return Xml::tags( $tag, array( 'class' => 'mw-revdelundel-link' ), "($link)" );
 1873+ return Xml::tags( $tag, array( 'class' => 'mw-revdelundel-link' ), wfMessage( 'parentheses' )->rawParams( $link ) );
18741874 }
18751875
18761876 /**
@@ -1882,7 +1882,7 @@
18831883 */
18841884 public static function revDeleteLinkDisabled( $delete = true ) {
18851885 $html = $delete ? wfMsgHtml( 'rev-delundel' ) : wfMsgHtml( 'rev-showdeleted' );
1886 - return Xml::tags( 'span', array( 'class' => 'mw-revdelundel-link' ), "($html)" );
 1886+ return Xml::tags( 'span', array( 'class' => 'mw-revdelundel-link' ), wfMessage( 'parentheses' )->rawParams( $html ) );
18871887 }
18881888
18891889 /* Deprecated methods */
Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -251,9 +251,11 @@
252252 // languages that want to put the "for" bit right after $user but before
253253 // $links. If 'contribsub' is around, use it for reverse compatibility,
254254 // otherwise use 'contribsub2'.
 255+ // @todo Should this be removed at some point?
255256 $oldMsg = $this->msg( 'contribsub' );
256257 if ( $oldMsg->exists() ) {
257 - return $oldMsg->rawParams( "$user ($links)" );
 258+ $linksWithParentheses = $this->msg( 'parenteses' )->rawParams( $links );
 259+ return $oldMsg->rawParams( "$user $linksWithParentheses" );
258260 } else {
259261 return $this->msg( 'contribsub2' )->rawParams( $user, $links );
260262 }
@@ -837,7 +839,7 @@
838840 $del .= ' ';
839841 }
840842
841 - $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')';
 843+ $diffHistLinks = $this->msg( 'parentheses' )->rawParams( $difftext . $this->messages['pipe-separator'] . $histlink );
842844 $ret = "{$del}{$d} {$diffHistLinks}{$chardiff}{$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
843845
844846 # Denote if username is redacted for this edit
Index: trunk/phase3/includes/Pager.php
@@ -769,15 +769,17 @@
770770 $pagingLinks = $this->getPagingLinks( $linkTexts );
771771 $limitLinks = $this->getLimitLinks();
772772 $limits = $this->getLanguage()->pipeList( $limitLinks );
 773+ $firstLastLinks = wfMessage( 'parentheses' )->rawParams( "{$pagingLinks['first']}" .
 774+ wfMsgExt( 'pipe-separator' , 'escapenoentities' ) .
 775+ "{$pagingLinks['last']}" );
773776
774 - $this->mNavigationBar = "({$pagingLinks['first']}" .
775 - wfMsgExt( 'pipe-separator' , 'escapenoentities' ) .
776 - "{$pagingLinks['last']}) " .
 777+ $this->mNavigationBar = $firstLastLinks . ' ' .
777778 wfMsgHTML(
778779 'viewprevnext',
779780 $pagingLinks['prev'], $pagingLinks['next'],
780781 $limits
781782 );
 783+
782784 return $this->mNavigationBar;
783785 }
784786
Index: trunk/phase3/RELEASE-NOTES-1.20
@@ -34,6 +34,7 @@
3535 copy/paste on supporting browsers
3636 * (bug 34428) Fixed incorrect hash mismatch errors in the DiffHistoryBlob
3737 history compression method.
 38+* (bug 34702) Special:Contributions now uses localised parentheses.
3839
3940 === API changes in 1.20 ===
4041 * (bug 34316) Add ability to retrieve maximum upload size from MediaWiki API.

Follow-up revisions

RevisionCommit summaryAuthorDate
r112412Follow-up r112410: (bug 34702) Use localised parentheses for comment, too.siebrand20:53, 25 February 2012
r112424Follow-up r112410, r112412: Cheaper processing using plain().siebrand11:49, 26 February 2012
r112427Wow. Messy. Follow-up r112426, r112424: Fix incorrect calls. Should have been...siebrand12:11, 26 February 2012
r112433(bug 34702) Localised parentheses are now used in more special pages.siebrand13:08, 26 February 2012
r112468Typofix, ping r112427demon02:40, 27 February 2012
r112589(bug 34702) More localised parentheses. Patch contributed by Yusuke Matsubara.siebrand11:56, 28 February 2012
r112591(bug 34702) More localised parentheses.siebrand12:41, 28 February 2012

Comments

#Comment by Nikerabbit (talk | contribs)   21:01, 25 February 2012

If you are not calling ->escaped() or similar, wfMessage uses the default output format for string conversion... which happens to be full parsing.

#Comment by Siebrand (talk | contribs)   22:23, 25 February 2012

Argh. I made that mistake before, indeed. So instead of for example:

wfMessage( 'parentheses' )->rawParams( $html )

I thought I should use:

wfMessage( 'parentheses' )->rawParams( $html )->plain()

That didn't work, however. (PHP Fatal error: Call to a member function rawParams() on a non-object). What should it be?

Status & tagging log