r60600 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60599‎ | r60600 | r60601 >
Date:09:15, 4 January 2010
Author:siebrand
Status:deferred
Tags:
Comment:
* update i18n in some places (remove use of static text and add gender support where possible)
* remove commented out code
Modified paths:
  • /trunk/extensions/SocialProfile/UserActivity/UserActivity.body.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserActivity/UserActivity.i18n.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/UserActivity/UserActivity.i18n.php
@@ -16,24 +16,30 @@
1717 'useractivity' => "Friends' activity",
1818 'useractivity-award' => '$1 received an award',
1919 'useractivity-all' => 'View all',
20 - #'useractivity-comment' => '{{PLURAL:$1|commented on the page|commented on the following pages: }}',
21 - #'useractivity-commentedpage' => 'commented on the page',
22 - 'useractivity-edit' => '$1 {{PLURAL:$4|edited the page|edited the following pages:}} $3',
23 - 'useractivity-foe' => '$1 {{PLURAL:$2|is now foes with|are now foes with}} $3',
24 - 'useractivity-friend' => '$1 {{PLURAL:$2|is now friends with|are now friends with}} $3',
25 - 'useractivity-gift' => '$1 received a gift from $2',
26 - #'useractivity-gift-sent' => 'sent a gift to',
27 - 'useractivity-group-edit' => '{{PLURAL:$1|one edit|$1 edits}}',
28 - 'useractivity-group-comment' => '{{PLURAL:$1|one comment|$1 comments}}',
29 - 'useractivity-group-user_message' => '{{PLURAL:$1|one message|$1 messages}}',
30 - 'useractivity-group-friend' => '{{PLURAL:$1|one friend|$1 friends}}',
31 - #'useractivity-filter' => 'Filter',
 20+ 'useractivity-edit' => '$1 {{PLURAL:$4|edited the page|edited the following pages:}} $3', // Supports GENDER for the editor ($1) as $6 if $1 is one user.
 21+ 'useractivity-foe' => '$1 {{PLURAL:$2|is now foes with|are now foes with}} $3', // Supports GENDER for $1 as $6 if $1 is one user.
 22+ 'useractivity-friend' => '$1 {{PLURAL:$2|is now friends with|are now friends with}} $3', // Supports GENDER for the $1 as $6 if $1 is one user.
 23+ 'useractivity-gift' => '$1 received a gift from $2', // Supports GENDER for the editor ($1) as $6 if $1 is one user.
 24+ 'useractivity-group-edit' => '{{PLURAL:$1|one edit|$1 edits}}', // Supports GENDER for the one having made edits as $2
 25+ 'useractivity-group-comment' => '{{PLURAL:$1|one comment|$1 comments}}', // Supports GENDER for the one having made comments as $2
 26+ 'useractivity-group-user_message' => '{{PLURAL:$1|one message|$1 messages}}', // Supports GENDER for the one having messages as $2
 27+ 'useractivity-group-friend' => '{{PLURAL:$1|one friend|$1 friends}}', // Supports GENDER for the one having friends as $2
3228 'useractivity-siteactivity' => 'Site activity',
3329 'useractivity-title' => "Friends' activity",
34 - 'useractivity-user_message' => '$1 {{PLURAL:$4|sent a message to|sent messages to}} $3',
35 - #'useractivity-votedpage' => 'voted for the page',
 30+ 'useractivity-user_message' => '$1 {{PLURAL:$4|sent a message to|sent messages to}} $3', // Supports GENDER for the sender ($1) as $6 if $1 is one user.
3631 );
3732
 33+$messages['qqq'] = array(
 34+ 'useractivity-edit' => 'Supports GENDER for the editor ($1) as $6 if $1 is one user.',
 35+ 'useractivity-foe' => 'Supports GENDER for $1 as $6 if $1 is one user.',
 36+ 'useractivity-friend' => 'Supports GENDER for the $1 as $6 if $1 is one user.',
 37+ 'useractivity-gift' => 'Supports GENDER for the editor ($1) as $6 if $1 is one user.',
 38+ 'useractivity-group-edit' => 'Supports GENDER for the one having made edits as $2',
 39+ 'useractivity-group-comment' => 'Supports GENDER for the one having made comments as $2',
 40+ 'useractivity-group-user_message' => 'Supports GENDER for the one having messages as $2',
 41+ 'useractivity-group-friend' => 'Supports GENDER for the one having friends as $2',
 42+ 'useractivity-user_message' => 'Supports GENDER for the sender ($1) as $6 if $1 is one user.',
 43+);
3844 /** Afrikaans (Afrikaans)
3945 * @author Naudefj
4046 */
Index: trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php
@@ -84,7 +84,7 @@
8585 $res = $dbr->query( $sql, __METHOD__ );
8686
8787 while ( $row = $dbr->fetchObject( $res ) ) {
88 - // Special pages aren't editable, so ignore 'em
 88+ // Special pages aren't editable, so ignore them
8989 if ( $row->rc_namespace == NS_SPECIAL ) {
9090 continue;
9191 }
@@ -670,7 +670,7 @@
671671 $pages = '';
672672
673673 if ( $type == 'friend' || $type == 'foe' || $type == 'user_message' ) {
674 - $page_title = Title::newFromText( 'User:' . $page_name );
 674+ $page_title = Title::newFromText( $page_name, NS_USER );
675675 } else {
676676 $page_title = Title::newFromText( $page_name );
677677 }
@@ -679,8 +679,11 @@
680680 $user_index = 0;
681681 $pages_count = 0;
682682
 683+ // Init empty variable to be used later on for GENDER processing
 684+ // if the event is only for one user.
 685+ $userNameForGender = '';
 686+
683687 foreach ( $page_data['users'] as $user_name => $action ) {
684 -
685688 if ( $page_data['timestamp'] < $this->three_days_ago ) {
686689 continue;
687690 }
@@ -692,7 +695,8 @@
693696
694697 $pages .= " <a href=\"{$page_title->escapeFullURL()}\">{$page_name}</a>";
695698 if ( $count_users == 1 && $count_actions > 1 ) {
696 - $pages .= ' (' . wfMsgExt( "useractivity-group-{$type}", 'parsemag', $count_actions ) . ')';
 699+ $pages .= wfMsg( 'word-separator' );
 700+ $pages .= wfMsg( 'parentheses', wfMsgExt( "useractivity-group-{$type}", 'parsemag', $count_actions, $user_name ) );
697701 }
698702 $pages_count++;
699703 }
@@ -700,6 +704,7 @@
701705 // Single user on this action,
702706 // see if we can stack any other singles
703707 if ( $count_users == 1 ) {
 708+ $userNameForGender = $user_name;
704709 foreach ( $this->items_grouped[$type] as $page_name2 => $page_data2 ) {
705710 if ( !isset( $this->displayed[$type][$page_name2] ) &&
706711 count( $page_data2['users'] ) == 1
@@ -713,7 +718,7 @@
714719 $type == 'foe' ||
715720 $type == 'user_message'
716721 ) {
717 - $page_title2 = Title::newFromText( 'User:' . $page_name2 );
 722+ $page_title2 = Title::newFromText( $page_name2, NS_USER );
718723 } else {
719724 $page_title2 = Title::newFromText( $page_name2 );
720725 }
@@ -739,7 +744,7 @@
740745 $user_index++;
741746
742747 if ( $users && $count_users > 2 ) {
743 - $users .= ', ';
 748+ $users .= wfMsg( 'comma-separator' );
744749 }
745750 if ( $user_index == $count_users && $count_users > 1 ) {
746751 $users .= wfMsg( 'and' );
@@ -748,7 +753,7 @@
749754 $user_title = Title::makeTitle( NS_USER, $user_name );
750755 $user_name_short = substr( $user_name, 0, 15 );
751756 if ( $user_name != $user_name_short ) {
752 - $user_name_short .= '...';
 757+ $user_name_short .= wfMsg( 'ellipsis' );
753758 }
754759
755760 $users .= " <b><a href=\"{$user_title->escapeFullURL()}\">{$user_name_short}</a></b>";
@@ -758,8 +763,9 @@
759764 'type' => $type,
760765 'timestamp' => $page_data['timestamp'],
761766 'data' => wfMsgExt(
762 - "useractivity-{$type}", 'parsemag',
763 - $users, $count_users, $pages, $pages_count
 767+ "useractivity-{$type}",
 768+ 'parsemag',
 769+ $users, $count_users, $pages, $pages_count, $userNameForGender
764770 )
765771 );
766772 }
Index: trunk/extensions/SocialProfile/UserActivity/UserActivity.body.php
@@ -1,7 +1,6 @@
22 <?php
33
44 class UserHome extends SpecialPage {
5 -
65 /**
76 * Constructor
87 */
@@ -62,32 +61,6 @@
6362 $messages_sent = 1;
6463 }
6564
66 - /*
67 - $output .= '<div class="user-home-links-container">
68 - <h2>' . wfMsg( 'useractivity-filter' ) . '</h2>
69 - <div class="user-home-links">';
70 -
71 - $lines = explode( "\n", wfMsgForContent( 'useractivity-filter' ) );
72 - foreach( $lines as $line ) {
73 - if( strpos( $line, '*' ) !== 0 ) {
74 - continue;
75 - } else {
76 - $line = explode( '|' , trim( $line, '* ' ), 3 );
77 - $filter = $line[0];
78 - $link_text = $line[1];
79 - $link_image = $line[2];
80 - $output .= '<a href="' . $this_title->escapeFullURL( "item_type={$filter}" ) . "\">
81 - <img src=\"{$wgScriptPath}/extensions/SocialProfile/images/" . UserActivity::getTypeIcon( $link_image ) . "\"/>
82 - {$link_text}
83 - </a>";
84 - }
85 - }
86 -
87 - $output .= '<a href="' . $this_title->escapeFullURL() . '">' . wfMsg( 'useractivity-all' ) . '</a>
88 - </div>
89 - </div>
90 - */
91 -
9265 $output .= '<div class="user-home-feed">';
9366
9467 $rel = new UserActivity( $wgUser->getName(), ( ( $rel_type == 1 ) ? ' friends' : 'foes' ), 50 );

Status & tagging log