<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][7439] trunk: Improved plural i18n for pagination links</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/7439">7439</a></dd>
<dt>Author</dt> <dd>boonebgorges</dd>
<dt>Date</dt> <dd>2013-10-17 16:24:33 +0000 (Thu, 17 Oct 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Improved plural i18n for pagination links

Cases where there is only one page of results will now read, eg, "...of 1
member" instead of "...of 1 members".

Where the pagination links are put through apply_filters(), this changeset
also adds the passing of the $from_num, $to_num, and $total values to the
filter.

Fixes <a href="http://buddypress.trac.wordpress.org/ticket/5107">#5107</a>

Props imath</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivitytemplatephp">trunk/bp-activity/bp-activity-template.php</a></li>
<li><a href="#trunkbpblogsbpblogstemplatephp">trunk/bp-blogs/bp-blogs-template.php</a></li>
<li><a href="#trunkbpforumsbpforumstemplatephp">trunk/bp-forums/bp-forums-template.php</a></li>
<li><a href="#trunkbpgroupsbpgroupstemplatephp">trunk/bp-groups/bp-groups-template.php</a></li>
<li><a href="#trunkbpmembersbpmemberstemplatephp">trunk/bp-members/bp-members-template.php</a></li>
<li><a href="#trunkbpmessagesbpmessagestemplatephp">trunk/bp-messages/bp-messages-template.php</a></li>
<li><a href="#trunkbptemplatesbplegacybuddypressmemberssinglegroupsinvitesphp">trunk/bp-templates/bp-legacy/buddypress/members/single/groups/invites.php</a></li>
<li><a href="#trunkbpthemesbpdefaultmemberssinglegroupsinvitesphp">trunk/bp-themes/bp-default/members/single/groups/invites.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivitytemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-template.php (7438 => 7439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-template.php       2013-10-17 16:12:08 UTC (rev 7438)
+++ trunk/bp-activity/bp-activity-template.php  2013-10-17 16:24:33 UTC (rev 7439)
</span><span class="lines">@@ -691,7 +691,7 @@
</span><span class="cx">          $to_num    = bp_core_number_format( ( $start_num + ( $activities_template->pag_num - 1 ) > $activities_template->total_activity_count ) ? $activities_template->total_activity_count : $start_num + ( $activities_template->pag_num - 1 ) );
</span><span class="cx">          $total     = bp_core_number_format( $activities_template->total_activity_count );
</span><span class="cx"> 
</span><del>-               return sprintf( __( 'Viewing item %1$s to %2$s (of %3$s items)', 'buddypress' ), $from_num, $to_num, $total );
</del><ins>+                return sprintf( _n( 'Viewing item %1$s to %2$s (of %3$s item)', 'Viewing item %1$s to %2$s (of %3$s items)', $total, 'buddypress' ), $from_num, $to_num, number_format_i18n( $total ) );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkbpblogsbpblogstemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-template.php (7438 => 7439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-template.php     2013-10-17 16:12:08 UTC (rev 7438)
+++ trunk/bp-blogs/bp-blogs-template.php        2013-10-17 16:24:33 UTC (rev 7439)
</span><span class="lines">@@ -420,7 +420,7 @@
</span><span class="cx">  $to_num    = bp_core_number_format( ( $start_num + ( $blogs_template->pag_num - 1 ) > $blogs_template->total_blog_count ) ? $blogs_template->total_blog_count : $start_num + ( $blogs_template->pag_num - 1 ) );
</span><span class="cx">  $total     = bp_core_number_format( $blogs_template->total_blog_count );
</span><span class="cx"> 
</span><del>-       echo sprintf( __( 'Viewing site %1$s to %2$s (of %3$s sites)', 'buddypress' ), $from_num, $to_num, $total );
</del><ins>+        echo sprintf( _n( 'Viewing site %1$s to %2$s (of %3$s site)', 'Viewing site %1$s to %2$s (of %3$s sites)', $total, 'buddypress' ), $from_num, $to_num, number_format_i18n( $total ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkbpforumsbpforumstemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-template.php (7438 => 7439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-template.php   2013-10-17 16:12:08 UTC (rev 7438)
+++ trunk/bp-forums/bp-forums-template.php      2013-10-17 16:24:33 UTC (rev 7439)
</span><span class="lines">@@ -965,7 +965,7 @@
</span><span class="cx">          if ( 'tags' == $forum_template->type && !empty( $forum_template->search_terms ) )
</span><span class="cx">                  $pag_filter = sprintf( __( ' matching tag "%s"', 'buddypress' ), $forum_template->search_terms );
</span><span class="cx"> 
</span><del>-               return apply_filters( 'bp_get_forum_pagination_count', sprintf( __( 'Viewing topic %s to %s (of %s total topics%s)', 'buddypress' ), $from_num, $to_num, $total, $pag_filter ) );
</del><ins>+                return apply_filters( 'bp_get_forum_pagination_count', sprintf( _n( 'Viewing topic %s to %s (of %d topic%s)', 'Viewing topic %s to %s (of %d total topics%s)', $total, 'buddypress' ), $from_num, $to_num, number_format_i18n( $total ), $pag_filter ), $from_num, $to_num, $total );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> function bp_is_edit_topic() {
</span><span class="lines">@@ -1305,7 +1305,7 @@
</span><span class="cx">  $to_num = bp_core_number_format( ( $start_num + ( $topic_template->pag_num - 1  ) > $topic_template->total_post_count ) ? $topic_template->total_post_count : $start_num + ( $topic_template->pag_num - 1 ) );
</span><span class="cx">  $total = bp_core_number_format( $topic_template->total_post_count );
</span><span class="cx"> 
</span><del>-       echo apply_filters( 'bp_the_topic_pagination_count', sprintf( __( 'Viewing post %1$s to %2$s (%3$s total posts)', 'buddypress' ), $from_num, $to_num, $total ) );
</del><ins>+        echo apply_filters( 'bp_the_topic_pagination_count', sprintf( _n( 'Viewing post %1$s to %2$s (%3$s post)', 'Viewing post %1$s to %2$s (%3$s total posts)', $total, 'buddypress' ), $from_num, $to_num, number_format_i18n( $total ) ), $from_num, $to_num, $total );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_the_topic_is_last_page() {
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupstemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-template.php (7438 => 7439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-template.php   2013-10-17 16:12:08 UTC (rev 7438)
+++ trunk/bp-groups/bp-groups-template.php      2013-10-17 16:24:33 UTC (rev 7439)
</span><span class="lines">@@ -929,7 +929,7 @@
</span><span class="cx">          $to_num    = bp_core_number_format( ( $start_num + ( $groups_template->pag_num - 1 ) > $groups_template->total_group_count ) ? $groups_template->total_group_count : $start_num + ( $groups_template->pag_num - 1 ) );
</span><span class="cx">          $total     = bp_core_number_format( $groups_template->total_group_count );
</span><span class="cx"> 
</span><del>-               return apply_filters( 'bp_get_groups_pagination_count', sprintf( __( 'Viewing group %1$s to %2$s (of %3$s groups)', 'buddypress' ), $from_num, $to_num, $total ) );
</del><ins>+                return apply_filters( 'bp_get_groups_pagination_count', sprintf( _n( 'Viewing group %1$s to %2$s (of %3$s group)', 'Viewing group %1$s to %2$s (of %3$s groups)', $total, 'buddypress' ), $from_num, $to_num, number_format_i18n( $total ) ), $from_num, $to_num, $total );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> function bp_groups_auto_join() {
</span><span class="lines">@@ -2150,7 +2150,7 @@
</span><span class="cx">          $to_num = bp_core_number_format( ( $start_num + ( $members_template->pag_num - 1 ) > $members_template->total_member_count ) ? $members_template->total_member_count : $start_num + ( $members_template->pag_num - 1 ) );
</span><span class="cx">          $total = bp_core_number_format( $members_template->total_member_count );
</span><span class="cx"> 
</span><del>-               return apply_filters( 'bp_get_group_member_pagination_count', sprintf( __( 'Viewing members %1$s to %2$s (of %3$s members)', 'buddypress' ), $from_num, $to_num, $total ) );
</del><ins>+                return apply_filters( 'bp_get_group_member_pagination_count', sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s member)', 'Viewing members %1$s to %2$s (of %3$s members)', $total, 'buddypress' ), $from_num, $to_num, number_format_i18n( $total ) ), $from_num, $to_num, $total );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> function bp_group_member_admin_pagination() {
</span></span></pre></div>
<a id="trunkbpmembersbpmemberstemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-members/bp-members-template.php (7438 => 7439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-members/bp-members-template.php 2013-10-17 16:12:08 UTC (rev 7438)
+++ trunk/bp-members/bp-members-template.php    2013-10-17 16:24:33 UTC (rev 7439)
</span><span class="lines">@@ -344,13 +344,13 @@
</span><span class="cx">          $total     = bp_core_number_format( $members_template->total_member_count );
</span><span class="cx"> 
</span><span class="cx">          if ( 'active' == $members_template->type )
</span><del>-                       $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s active members)', 'buddypress' ), $from_num, $to_num, $total );
</del><ins>+                        $pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s active member)', 'Viewing member %1$s to %2$s (of %3$s active members)', $total, 'buddypress' ), $from_num, $to_num, number_format_i18n( $total ) );
</ins><span class="cx">           else if ( 'popular' == $members_template->type )
</span><del>-                       $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members with friends)', 'buddypress' ), $from_num, $to_num, $total );
</del><ins>+                        $pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s member with friends)', 'Viewing member %1$s to %2$s (of %3$s members with friends)', $total, 'buddypress' ), $from_num, $to_num, number_format_i18n( $total ) );
</ins><span class="cx">           else if ( 'online' == $members_template->type )
</span><del>-                       $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members online)', 'buddypress' ), $from_num, $to_num, $total );
</del><ins>+                        $pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s member online)', 'Viewing member %1$s to %2$s (of %3$s members online)', $total, 'buddypress' ), $from_num, $to_num, number_format_i18n( $total ) );
</ins><span class="cx">           else
</span><del>-                       $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members)', 'buddypress' ), $from_num, $to_num, $total );
</del><ins>+                        $pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s member)', 'Viewing member %1$s to %2$s (of %3$s members)', $total, 'buddypress' ), $from_num, $to_num, number_format_i18n( $total ) );
</ins><span class="cx"> 
</span><span class="cx">          return apply_filters( 'bp_members_pagination_count', $pag );
</span><span class="cx">  }
</span></span></pre></div>
<a id="trunkbpmessagesbpmessagestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages/bp-messages-template.php (7438 => 7439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages/bp-messages-template.php       2013-10-17 16:12:08 UTC (rev 7438)
+++ trunk/bp-messages/bp-messages-template.php  2013-10-17 16:24:33 UTC (rev 7439)
</span><span class="lines">@@ -396,7 +396,7 @@
</span><span class="cx">  $to_num = bp_core_number_format( ( $start_num + ( $messages_template->pag_num - 1 ) > $messages_template->total_thread_count ) ? $messages_template->total_thread_count : $start_num + ( $messages_template->pag_num - 1 ) );
</span><span class="cx">  $total = bp_core_number_format( $messages_template->total_thread_count );
</span><span class="cx"> 
</span><del>-       echo sprintf( __( 'Viewing message %1$s to %2$s (of %3$s messages)', 'buddypress' ), $from_num, $to_num, $total ); ?><?php
</del><ins>+        echo sprintf( _n( 'Viewing message %1$s to %2$s (of %3$s message)', 'Viewing message %1$s to %2$s (of %3$s messages)', $total, 'buddypress' ), $from_num, $to_num, number_format_i18n( $total ) ); ?><?php
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkbptemplatesbplegacybuddypressmemberssinglegroupsinvitesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-templates/bp-legacy/buddypress/members/single/groups/invites.php (7438 => 7439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-templates/bp-legacy/buddypress/members/single/groups/invites.php        2013-10-17 16:12:08 UTC (rev 7438)
+++ trunk/bp-templates/bp-legacy/buddypress/members/single/groups/invites.php   2013-10-17 16:24:33 UTC (rev 7439)
</span><span class="lines">@@ -11,7 +11,7 @@
</span><span class="cx">                                  <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ); ?></a>
</span><span class="cx">                          </div>
</span><span class="cx"> 
</span><del>-                               <h4><a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a><span class="small"> - <?php printf( __( '%s members', 'buddypress' ), bp_group_total_members( false ) ); ?></span></h4>
</del><ins>+                                <h4><a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a><span class="small"> - <?php printf( _n( '1 member', '%d members', bp_get_group_total_members( false ), 'buddypress' )  ); ?></span></h4>
</ins><span class="cx"> 
</span><span class="cx">                          <p class="desc">
</span><span class="cx">                                  <?php bp_group_description_excerpt(); ?>
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultmemberssinglegroupsinvitesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/members/single/groups/invites.php (7438 => 7439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/members/single/groups/invites.php     2013-10-17 16:12:08 UTC (rev 7438)
+++ trunk/bp-themes/bp-default/members/single/groups/invites.php        2013-10-17 16:24:33 UTC (rev 7439)
</span><span class="lines">@@ -11,7 +11,7 @@
</span><span class="cx">                                  <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ); ?></a>
</span><span class="cx">                          </div>
</span><span class="cx"> 
</span><del>-                               <h4><a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a><span class="small"> - <?php printf( __( '%s members', 'buddypress' ), bp_group_total_members( false ) ); ?></span></h4>
</del><ins>+                                <h4><a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a><span class="small"> - <?php printf( _n( '1 member', '%d members', bp_get_group_total_members( false ), 'buddypress' )  ); ?></span></h4>
</ins><span class="cx"> 
</span><span class="cx">                          <p class="desc">
</span><span class="cx">                                  <?php bp_group_description_excerpt(); ?>
</span></span></pre>
</div>
</div>

</body>
</html>