Skip to:
Content

BuddyPress.org

Changeset 463


Ignore:
Timestamp:
10/30/2008 10:24:01 AM (18 years ago)
Author:
apeatling
Message:

Improved ability to translate BuddyPress by removing concatenated strings and replacing with sprintf().

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs.php

    r461 r463  
    201201                return false;
    202202               
    203             return bp_core_get_userlink($blog->user_id) . ' ' . __('created a new blog:', 'buddypress') . ' <a href="' . get_blog_option( $blog->blog_id, 'siteurl' ) . '">' . get_blog_option( $blog->blog_id, 'blogname' ) . '</a> <span class="time-since">%s</span>';       
     203            return sprintf( __( '%s created a new blog: %s', 'buddypress' ), bp_core_get_userlink($blog->user_id), '<a href="' . get_blog_option( $blog->blog_id, 'siteurl' ) . '">' . get_blog_option( $blog->blog_id, 'blogname' ) . '</a>' ) . ' <span class="time-since">%s</span>';       
    204204        break;
    205205        case 'new_blog_post':
     
    214214                return false;
    215215
    216             $content = bp_core_get_userlink($post->post_author) . ' ' . __('wrote a new blog post', 'buddypress') . ' <a href="' . bp_post_get_permalink( $post, $post->blog_id ) . '">' . $post->post_title . '</a> <span class="time-since">%s</span>';       
     216            $content = sprintf( __( '%s wrote a new blog post:', 'buddypress' ), bp_core_get_userlink($post->post_author), '<a href="' . bp_post_get_permalink( $post, $post->blog_id ) . '">' . $post->post_title . '</a>' ) . ' <span class="time-since">%s</span>';     
    217217            $content .= '<blockquote>' . bp_create_excerpt($post->post_content) . '</blockquote>';
    218218            return $content;
     
    229229
    230230            $comment = BP_Blogs_Comment::fetch_comment_content($comment);
    231             $content = bp_core_get_userlink($comment->user_id) . ' ' . __('commented on the blog post ', 'buddypress') . ' <a href="' . bp_post_get_permalink( $comment->post, $comment->blog_id ) . '#comment-' . $comment->comment_ID . '">' . $comment->post->post_title . '</a> <span class="time-since">%s</span>';       
     231            $content = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink($comment->user_id), '<a href="' . bp_post_get_permalink( $comment->post, $comment->blog_id ) . '#comment-' . $comment->comment_ID . '">' . $comment->post->post_title . '</a>' ) . ' <span class="time-since">%s</span>';     
    232232            $content .= '<blockquote>' . bp_create_excerpt($comment->comment_content) . '</blockquote>';
    233233            return $content;
  • trunk/bp-core.php

    r457 r463  
    841841 * @uses bp_core_time_since() This function will return an English representation of the time elapsed.
    842842 */
    843 function bp_core_get_last_activity( $last_activity_date, $before, $after ) {
     843function bp_core_get_last_activity( $last_activity_date, $string ) {
    844844    if ( !$last_activity_date || $last_activity_date == '' ) {
    845845        $last_active = __('not recently active', 'buddypress');
    846846    } else {
    847         $last_active = $before;
    848        
    849847        if ( strstr( $last_activity_date, '-' ) ) {
    850             $last_active .= bp_core_time_since( strtotime( $last_activity_date ) );
     848            $last_active = bp_core_time_since( strtotime( $last_activity_date ) );
    851849        } else {
    852             $last_active .= bp_core_time_since( $last_activity_date );
     850            $last_active = bp_core_time_since( $last_activity_date );
    853851        }
    854852       
    855         $last_active .= $after;
     853        $last_active = sprintf( $string, $last_active );
    856854    }
    857855   
  • trunk/bp-core/bp-core-ajax.php

    r436 r463  
    3434                            <?php
    3535                            if ( $_POST['filter'] == 'newest-members') {
    36                                 echo bp_core_get_last_activity( $user->user_registered, __('registered ', 'buddypress'), __(' ago', 'buddypress') );
     36                                echo bp_core_get_last_activity( $user->user_registered, __( 'registered %s ago', 'buddypress' ) );
    3737                            } else if ( $_POST['filter'] == 'recently-active-members') {
    38                                 echo bp_core_get_last_activity( get_usermeta( $user->user_id, 'last_activity' ), __('active ', 'buddypress'), __(' ago', 'buddypress') );
     38                                echo bp_core_get_last_activity( get_usermeta( $user->user_id, 'last_activity' ), __( 'active %s ago', 'buddypress' ) );
    3939                            } else if ( $_POST['filter'] == 'popular-members') {
    4040                                if ( get_usermeta( $user->user_id, 'total_friend_count' ) == 1 )
  • trunk/bp-core/bp-core-classes.php

    r439 r463  
    6565        $this->fullname = bp_core_get_userlink( $this->id, true );
    6666        $this->email = bp_core_get_user_email( $this->id );
    67         $this->last_active = bp_core_get_last_activity( get_usermeta( $this->id, 'last_activity' ), __('active '), __(' ago') );
     67        $this->last_active = bp_core_get_last_activity( get_usermeta( $this->id, 'last_activity' ), __('active %s ago') );
    6868       
    6969        if ( function_exists('xprofile_install') ) {
  • trunk/bp-core/bp-core-templatetags.php

    r446 r463  
    241241        $user_id = $bp['current_userid'];
    242242   
    243     $last_activity = bp_core_get_last_activity( get_usermeta( $user_id, 'last_activity' ), __('active ', 'buddypress'), __(' ago', 'buddypress') );
     243    $last_activity = bp_core_get_last_activity( get_usermeta( $user_id, 'last_activity' ), __('active %s ago', 'buddypress') );
    244244
    245245    if ( $echo )
  • trunk/bp-core/bp-core-widgets.php

    r436 r463  
    114114                    <div class="item">
    115115                        <div class="item-title"><?php echo bp_core_get_userlink( $user->user_id ) ?></div>
    116                         <div class="item-meta"><span class="activity"><?php echo bp_core_get_last_activity( $user->user_registered, __('registered ', 'buddypress'), __(' ago', 'buddypress') ) ?></span></div>
     116                        <div class="item-meta"><span class="activity"><?php echo bp_core_get_last_activity( $user->user_registered, __('registered %s ago', 'buddypress') ) ?></span></div>
    117117                    </div>
    118118                </li>
  • trunk/bp-friends.php

    r462 r463  
    221221           
    222222            if ( $for_secondary_user ) {
    223                 return bp_core_get_userlink( $friendship->initiator_user_id ) . ' ' . __('and', 'buddypress') . ' ' . bp_core_get_userlink($friendship->friend_user_id, false, false, true) . ' ' . __('are now friends', 'buddypress') . '. <span class="time-since">%s</span>';               
     223                return sprintf( __( '%s and %s are now friends', 'buddypress' ), bp_core_get_userlink( $friendship->initiator_user_id ), bp_core_get_userlink($friendship->friend_user_id, false, false, true) ) . ' <span class="time-since">%s</span>';               
    224224            } else {
    225                 return bp_core_get_userlink( $friendship->friend_user_id ) . ' ' . __('and', 'buddypress') . ' ' . bp_core_get_userlink($friendship->initiator_user_id) . ' ' . __('are now friends', 'buddypress') . '. <span class="time-since">%s</span>';                               
     225                return sprintf( __( '%s and %s are now friends', 'buddypress' ), bp_core_get_userlink( $friendship->friend_user_id ), bp_core_get_userlink($friendship->initiator_user_id) ) . ' <span class="time-since">%s</span>';                               
    226226            }
    227227
  • trunk/bp-friends/bp-friends-templatetags.php

    r436 r463  
    242242   
    243243    if ( $friends_template->friendship->date_created != "0000-00-00 00:00:00" ) {
    244         echo __('requested', 'buddypress') . ' ' . bp_core_time_since( strtotime( $friends_template->friendship->date_created ) ) . ' ' . __('ago', 'buddypress');
     244        echo sprintf( __( 'requested %s ago', 'buddypress' ), bp_core_time_since( strtotime( $friends_template->friendship->date_created ) ) );
    245245    }
    246246}
  • trunk/bp-groups.php

    r453 r463  
    543543
    544544function groups_format_activity( $item_id, $action, $for_secondary_user = false  ) {
    545     global $bp;
     545    global $bp, $current_user;
    546546   
    547547    switch( $action ) {
     
    552552                return false;
    553553               
    554             return bp_core_get_userlink($bp['current_userid']) . ' ' . __('joined the group', 'buddypress') . ' ' . '<a href="' . $bp['current_domain'] . $bp['groups']['slug'] . '/' . $group->slug . '">' . $group->name . '</a>. <span class="time-since">%s</span>';
     554            return sprintf( __('%s joined the group %s', 'buddypress'), bp_core_get_userlink($current_user->id),  '<a href="' . site_url() . $bp['groups']['slug'] . '/' . $group->slug . '">' . $group->name . '</a>' ) . ' <span class="time-since">%s</span>';
    555555        break;
    556556        case 'created_group':
     
    560560                return false;
    561561               
    562             return bp_core_get_userlink($bp['current_userid']) . ' ' . __('created the group', 'buddypress') . ' ' . '<a href="' . $bp['current_domain'] . $bp['groups']['slug'] . '/' . $group->slug . '">' . $group->name . '</a>. <span class="time-since">%s</span>';
     562            return sprintf( __('%s created the group %s', 'buddypress'), bp_core_get_userlink($current_user->id), '<a href="' . site_url() . $bp['groups']['slug'] . '/' . $group->slug . '">' . $group->name . '</a>') . ' <span class="time-since">%s</span>';
    563563        break;
    564564        case 'new_wire_post':
     
    566566            $group = new BP_Groups_Group( $wire_post->item_id );
    567567           
    568             if ( !$group || !$wire_post )
     568            if ( !$group || !$wire_post || !$wire_post->content )
    569569                return false;       
    570570                   
    571             $content = bp_core_get_userlink($bp['current_userid']) . ' ' . __('wrote on the wire of the group', 'buddypress') . ' ' . '<a href="' . $bp['current_domain'] . $bp['groups']['slug'] . '/' . $group->slug . '">' . $group->name . '</a>: <span class="time-since">%s</span>';         
     571            $content = sprintf ( __('%s wrote on the wire of the group %s', 'buddypress'), bp_core_get_userlink($current_user->id), '<a href="' . site_url() . $bp['groups']['slug'] . '/' . $group->slug . '">' . $group->name . '</a>' ) . ' <span class="time-since">%s</span>';         
    572572            $content .= '<blockquote>' . bp_create_excerpt($wire_post->content) . '</blockquote>';
    573573            return $content;
  • trunk/bp-groups/bp-groups-ajax.php

    r431 r463  
    179179                            <?php
    180180                            if ( $_POST['filter'] == 'newest-groups') {
    181                                 echo bp_core_get_last_activity( $group->date_created, __('created ', 'buddypress'), __(' ago', 'buddypress') );
     181                                echo bp_core_get_last_activity( $group->date_created, __('created %s ago', 'buddypress') );
    182182                            } else if ( $_POST['filter'] == 'recently-active-groups') {
    183                                 echo bp_core_get_last_activity( groups_get_groupmeta( $group->id, 'last_activity' ), __('active ', 'buddypress'), __(' ago', 'buddypress') );
     183                                echo bp_core_get_last_activity( groups_get_groupmeta( $group->id, 'last_activity' ), __('active %s ago', 'buddypress') );
    184184                            } else if ( $_POST['filter'] == 'popular-groups') {
    185185                                if ( $group->total_member_count == 1 )
  • trunk/bp-xprofile.php

    r462 r463  
    266266
    267267function xprofile_format_activity( $item_id, $action, $for_secondary_user = false  ) {
    268     global $bp;
     268    global $bp, $current_user;
    269269   
    270270    switch( $action ) {
     
    276276
    277277            if ( ( $wire_post->item_id == $bp['loggedin_userid'] && $wire_post->user_id == $bp['loggedin_userid'] ) || ( $wire_post->item_id == $bp['current_userid'] && $wire_post->user_id == $bp['current_userid'] ) ) {
    278                 $content = bp_core_get_userlink($wire_post->user_id) . ' ' . __('wrote on their own wire', 'buddypress') . ': <span class="time-since">%s</span>';             
     278                $content = sprintf( __('%s wrote on their own wire', 'buddypress'), bp_core_get_userlink($wire_post->user_id) ) . ': <span class="time-since">%s</span>';               
    279279            } else if ( ( $wire_post->item_id != $bp['loggedin_userid'] && $wire_post->user_id == $bp['loggedin_userid'] ) || ( $wire_post->item_id != $bp['current_userid'] && $wire_post->user_id == $bp['current_userid'] ) ) {
    280                 $content = bp_core_get_userlink($wire_post->user_id) . ' ' . __('wrote on ', 'buddypress') . bp_core_get_userlink( $wire_post->item_id, false, false, true, true ) . ' wire: <span class="time-since">%s</span>';               
     280                $content = sprintf( __('%s wrote on %s wire', 'buddypress'), bp_core_get_userlink($wire_post->user_id), bp_core_get_userlink( $wire_post->item_id, false, false, true, true ) ) . ': <span class="time-since">%s</span>';               
    281281            }
    282282           
     
    290290                return false;
    291291               
    292             return bp_core_get_userlink($bp['current_userid']) . ' ' . __('updated the', 'buddypress') . ' "<a href="' . $bp['current_domain'] . $bp['profile']['slug'] . '">' . $profile_group->name . '</a>" ' . __('information on their profile', 'buddypress') . '. <span class="time-since">%s</span>';
     292            return sprintf( __('%s updated the "%s" information on their profile', 'buddypress'), bp_core_get_userlink($current_user->id), '<a href="' . $bp['current_domain'] . $bp['profile']['slug'] . '">' . $profile_group->name . '</a>' ) . ' <span class="time-since">%s</span>';
    293293        break;
    294294    }
Note: See TracChangeset for help on using the changeset viewer.