r46238 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46237‎ | r46238 | r46239 >
Date:23:24, 25 January 2009
Author:siebrand
Status:deferred (Comments)
Tags:
Comment:
Add plural support for user stats
Modified paths:
  • /trunk/extensions/SocialProfile/UserProfile/UserProfile.i18n.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php
@@ -145,15 +145,15 @@
146146 </div>
147147 <div class="cleared"></div>
148148 <div class="profile-info-container bold-fix">'.
149 - $this->getUserStatsRow(wfMsg('user-stats-edits'), $stats_data['edits']).
150 - $this->getUserStatsRow(wfMsg('user-stats-votes'), $stats_data['votes']).
151 - $this->getUserStatsRow(wfMsg('user-stats-comments'), $stats_data['comments']).
152 - $this->getUserStatsRow(wfMsg('user-stats-recruits'), $stats_data['recruits']).
153 - $this->getUserStatsRow(wfMsg('user-stats-poll-votes'), $stats_data['poll_votes']).
154 - $this->getUserStatsRow(wfMsg('user-stats-picture-game-votes'), $stats_data['picture_game_votes']).
155 - $this->getUserStatsRow(wfMsg('user-stats-quiz-points'), $stats_data['quiz_points']);
 149+ $this->getUserStatsRow( wfMsg( 'user-stats-edits', $stats_data['edits'] ), $stats_data['edits'] ) .
 150+ $this->getUserStatsRow( wfMsg( 'user-stats-votes', $stats_data['votes'] ), $stats_data['votes'] ) .
 151+ $this->getUserStatsRow( wfMsg( 'user-stats-comments', $stats_data['comments'] ), $stats_data['comments'] ) .
 152+ $this->getUserStatsRow( wfMsg( 'user-stats-recruits', $stats_data['recruits'] ), $stats_data['recruits'] ) .
 153+ $this->getUserStatsRow( wfMsg( 'user-stats-poll-votes', $stats_data['poll_votes'] ), $stats_data['poll_votes'] ) .
 154+ $this->getUserStatsRow( wfMsg( 'user-stats-picture-game-votes', $stats_data['picture_game_votes']), $stats_data['picture_game_votes'] ) .
 155+ $this->getUserStatsRow( wfMsg( 'user-stats-quiz-points', $stats_data['quiz_points'] ), $stats_data['quiz_points'] );
156156 if( $stats_data['currency'] != '10,000' )
157 - $output .= $this->getUserStatsRow( wfMsg('user-stats-pick-points'), $stats_data['currency'] );
 157+ $output .= $this->getUserStatsRow( wfMsg( 'user-stats-pick-points', $stats_data['currency'] ), $stats_data['currency'] );
158158 $output .= '</div>';
159159 }
160160
Index: trunk/extensions/SocialProfile/UserProfile/UserProfile.i18n.php
@@ -33,14 +33,14 @@
3434 'user-send-gift' => 'Send a gift',
3535 'user-contributions' => 'Contributions',
3636 'user-stats-title' => 'Statistics',
37 - 'user-stats-edits' => 'Edits',
38 - 'user-stats-votes' => 'Votes',
39 - 'user-stats-comments' => 'Comments',
40 - 'user-stats-recruits' => 'Recruits',
41 - 'user-stats-poll-votes' => 'Poll votes',
42 - 'user-stats-picture-game-votes' => 'Picture game votes',
43 - 'user-stats-quiz-points' => 'Quiz points',
44 - 'user-stats-pick-points' => 'Pick \'em points',
 37+ 'user-stats-edits' => '{{PLURAL:$1|Edit|Edits}}',
 38+ 'user-stats-votes' => '{{PLURAL:$1|Vote|Votes}}',
 39+ 'user-stats-comments' => '{{PLURAL:$1|Comment|Comments}}',
 40+ 'user-stats-recruits' => '{{PLURAL:$1|Recruit|Recruits}}',
 41+ 'user-stats-poll-votes' => 'Poll {{PLURAL:$1|vote|votes}}',
 42+ 'user-stats-picture-game-votes' => 'Picture game {{PLURAL:$1|vote|votes}}',
 43+ 'user-stats-quiz-points' => 'Quiz {{PLURAL:$1|point|points}}',
 44+ 'user-stats-pick-points' => 'Pick \'em {{PLURAL:$1|point|points}}',
4545 'other-info-title' => 'Other information',
4646 'user-friends-title' => 'Friends',
4747 'user-foes-title' => 'Foes',

Follow-up revisions

RevisionCommit summaryAuthorDate
r46254Fix on r46238. Actually support plural in code, too.siebrand11:35, 26 January 2009

Comments

#Comment by Sayuri (talk | contribs)   12:45, 26 January 2009

Hmm, I think those are going to end up looking rather funny. See File:Social user profile.png for the context of these messages — they'll be displayed under the "Statistics" header in social user profiles, if set so in LocalSettings.php. I'm not exactly so sure why it's better to display "Vote 1" than "Votes 1" - even though the former is grammatically more correct. I guess that the original developers intended that no-one would have only one edit or comment but they'd edit and comment more. ;-)

#Comment by Siebrand (talk | contribs)   13:08, 26 January 2009

Not all languages have 2 plural forms (one for !1 and one for 1). There are many languages with 3 plural forms, and we support one language with up to 6 plural forms. Nothing wrong here looking at the image you refer to...

Status & tagging log