http://www.mediawiki.org/wiki/Special:Code/MediaWiki/60600
Revision: 60600 Author: siebrand Date: 2010-01-04 09:15:17 +0000 (Mon, 04 Jan 2010) Log Message: ----------- * 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 trunk/extensions/SocialProfile/UserActivity/UserActivity.i18n.php trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php Modified: trunk/extensions/SocialProfile/UserActivity/UserActivity.body.php =================================================================== --- trunk/extensions/SocialProfile/UserActivity/UserActivity.body.php 2010-01-04 08:28:50 UTC (rev 60599) +++ trunk/extensions/SocialProfile/UserActivity/UserActivity.body.php 2010-01-04 09:15:17 UTC (rev 60600) @@ -1,7 +1,6 @@ <?php class UserHome extends SpecialPage { - /** * Constructor */ @@ -62,32 +61,6 @@ $messages_sent = 1; } - /* - $output .= '<div class="user-home-links-container"> - <h2>' . wfMsg( 'useractivity-filter' ) . '</h2> - <div class="user-home-links">'; - - $lines = explode( "\n", wfMsgForContent( 'useractivity-filter' ) ); - foreach( $lines as $line ) { - if( strpos( $line, '*' ) !== 0 ) { - continue; - } else { - $line = explode( '|' , trim( $line, '* ' ), 3 ); - $filter = $line[0]; - $link_text = $line[1]; - $link_image = $line[2]; - $output .= '<a href="' . $this_title->escapeFullURL( "item_type={$filter}" ) . "\"> - <img src=\"{$wgScriptPath}/extensions/SocialProfile/images/" . UserActivity::getTypeIcon( $link_image ) . "\"/> - {$link_text} - </a>"; - } - } - - $output .= '<a href="' . $this_title->escapeFullURL() . '">' . wfMsg( 'useractivity-all' ) . '</a> - </div> - </div> - */ - $output .= '<div class="user-home-feed">'; $rel = new UserActivity( $wgUser->getName(), ( ( $rel_type == 1 ) ? ' friends' : 'foes' ), 50 ); Modified: trunk/extensions/SocialProfile/UserActivity/UserActivity.i18n.php =================================================================== --- trunk/extensions/SocialProfile/UserActivity/UserActivity.i18n.php 2010-01-04 08:28:50 UTC (rev 60599) +++ trunk/extensions/SocialProfile/UserActivity/UserActivity.i18n.php 2010-01-04 09:15:17 UTC (rev 60600) @@ -16,24 +16,30 @@ 'useractivity' => "Friends' activity", 'useractivity-award' => '$1 received an award', 'useractivity-all' => 'View all', - #'useractivity-comment' => '{{PLURAL:$1|commented on the page|commented on the following pages: }}', - #'useractivity-commentedpage' => 'commented on the page', - 'useractivity-edit' => '$1 {{PLURAL:$4|edited the page|edited the following pages:}} $3', - 'useractivity-foe' => '$1 {{PLURAL:$2|is now foes with|are now foes with}} $3', - 'useractivity-friend' => '$1 {{PLURAL:$2|is now friends with|are now friends with}} $3', - 'useractivity-gift' => '$1 received a gift from $2', - #'useractivity-gift-sent' => 'sent a gift to', - 'useractivity-group-edit' => '{{PLURAL:$1|one edit|$1 edits}}', - 'useractivity-group-comment' => '{{PLURAL:$1|one comment|$1 comments}}', - 'useractivity-group-user_message' => '{{PLURAL:$1|one message|$1 messages}}', - 'useractivity-group-friend' => '{{PLURAL:$1|one friend|$1 friends}}', - #'useractivity-filter' => 'Filter', + '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. + '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. + '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. + 'useractivity-gift' => '$1 received a gift from $2', // Supports GENDER for the editor ($1) as $6 if $1 is one user. + 'useractivity-group-edit' => '{{PLURAL:$1|one edit|$1 edits}}', // Supports GENDER for the one having made edits as $2 + 'useractivity-group-comment' => '{{PLURAL:$1|one comment|$1 comments}}', // Supports GENDER for the one having made comments as $2 + 'useractivity-group-user_message' => '{{PLURAL:$1|one message|$1 messages}}', // Supports GENDER for the one having messages as $2 + 'useractivity-group-friend' => '{{PLURAL:$1|one friend|$1 friends}}', // Supports GENDER for the one having friends as $2 'useractivity-siteactivity' => 'Site activity', 'useractivity-title' => "Friends' activity", - 'useractivity-user_message' => '$1 {{PLURAL:$4|sent a message to|sent messages to}} $3', - #'useractivity-votedpage' => 'voted for the page', + '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. ); +$messages['qqq'] = array( + 'useractivity-edit' => 'Supports GENDER for the editor ($1) as $6 if $1 is one user.', + 'useractivity-foe' => 'Supports GENDER for $1 as $6 if $1 is one user.', + 'useractivity-friend' => 'Supports GENDER for the $1 as $6 if $1 is one user.', + 'useractivity-gift' => 'Supports GENDER for the editor ($1) as $6 if $1 is one user.', + 'useractivity-group-edit' => 'Supports GENDER for the one having made edits as $2', + 'useractivity-group-comment' => 'Supports GENDER for the one having made comments as $2', + 'useractivity-group-user_message' => 'Supports GENDER for the one having messages as $2', + 'useractivity-group-friend' => 'Supports GENDER for the one having friends as $2', + 'useractivity-user_message' => 'Supports GENDER for the sender ($1) as $6 if $1 is one user.', +); /** Afrikaans (Afrikaans) * @author Naudefj */ Modified: trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php =================================================================== --- trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php 2010-01-04 08:28:50 UTC (rev 60599) +++ trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php 2010-01-04 09:15:17 UTC (rev 60600) @@ -84,7 +84,7 @@ $res = $dbr->query( $sql, __METHOD__ ); while ( $row = $dbr->fetchObject( $res ) ) { - // Special pages aren't editable, so ignore 'em + // Special pages aren't editable, so ignore them if ( $row->rc_namespace == NS_SPECIAL ) { continue; } @@ -670,7 +670,7 @@ $pages = ''; if ( $type == 'friend' || $type == 'foe' || $type == 'user_message' ) { - $page_title = Title::newFromText( 'User:' . $page_name ); + $page_title = Title::newFromText( $page_name, NS_USER ); } else { $page_title = Title::newFromText( $page_name ); } @@ -679,8 +679,11 @@ $user_index = 0; $pages_count = 0; + // Init empty variable to be used later on for GENDER processing + // if the event is only for one user. + $userNameForGender = ''; + foreach ( $page_data['users'] as $user_name => $action ) { - if ( $page_data['timestamp'] < $this->three_days_ago ) { continue; } @@ -692,7 +695,8 @@ $pages .= " <a href=\"{$page_title->escapeFullURL()}\">{$page_name}</a>"; if ( $count_users == 1 && $count_actions > 1 ) { - $pages .= ' (' . wfMsgExt( "useractivity-group-{$type}", 'parsemag', $count_actions ) . ')'; + $pages .= wfMsg( 'word-separator' ); + $pages .= wfMsg( 'parentheses', wfMsgExt( "useractivity-group-{$type}", 'parsemag', $count_actions, $user_name ) ); } $pages_count++; } @@ -700,6 +704,7 @@ // Single user on this action, // see if we can stack any other singles if ( $count_users == 1 ) { + $userNameForGender = $user_name; foreach ( $this->items_grouped[$type] as $page_name2 => $page_data2 ) { if ( !isset( $this->displayed[$type][$page_name2] ) && count( $page_data2['users'] ) == 1 @@ -713,7 +718,7 @@ $type == 'foe' || $type == 'user_message' ) { - $page_title2 = Title::newFromText( 'User:' . $page_name2 ); + $page_title2 = Title::newFromText( $page_name2, NS_USER ); } else { $page_title2 = Title::newFromText( $page_name2 ); } @@ -739,7 +744,7 @@ $user_index++; if ( $users && $count_users > 2 ) { - $users .= ', '; + $users .= wfMsg( 'comma-separator' ); } if ( $user_index == $count_users && $count_users > 1 ) { $users .= wfMsg( 'and' ); @@ -748,7 +753,7 @@ $user_title = Title::makeTitle( NS_USER, $user_name ); $user_name_short = substr( $user_name, 0, 15 ); if ( $user_name != $user_name_short ) { - $user_name_short .= '...'; + $user_name_short .= wfMsg( 'ellipsis' ); } $users .= " <b><a href=\"{$user_title->escapeFullURL()}\">{$user_name_short}</a></b>"; @@ -758,8 +763,9 @@ 'type' => $type, 'timestamp' => $page_data['timestamp'], 'data' => wfMsgExt( - "useractivity-{$type}", 'parsemag', - $users, $count_users, $pages, $pages_count + "useractivity-{$type}", + 'parsemag', + $users, $count_users, $pages, $pages_count, $userNameForGender ) ); } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs