Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/17/2015 01:27:06 PM (10 years ago)
Author:
boonebgorges
Message:

Improved plural forms for localizable strings.

Strings that are intended for use only in the case of a single item should not
be bundled with strings intended for use with plurals, as this pattern does not
work with languages that use the singular nominal form for numbers other than
one. See https://core.trac.wordpress.org/ticket/28502#comment:23.

This changeset also fixes a few places where a formatted string, rather than a
raw integer, was being passed as the $count value to _n().

Props SergeyBiryukov.
Fixes #6368.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-template.php

    r9706 r9765  
    17941794        $total     = bp_core_number_format( $groups_template->total_group_count );
    17951795
     1796        if ( 1 == $groups_template->total_group_count ) {
     1797            $message = __( 'Viewing 1 group', 'buddypress' );
     1798        } else {
     1799            $message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s group', 'Viewing %1$s - %2$s of %3$s groups', $groups_template->total_group_count, 'buddypress' ), $from_num, $to_num, $total );
     1800        }
     1801
    17961802        /**
    17971803         * Filters the "Viewing x-y of z groups" pagination message.
     
    18041810         * @param string $total    Total amount of groups found.
    18051811         */
    1806         return apply_filters( 'bp_get_groups_pagination_count', sprintf( _n( 'Viewing 1 group', 'Viewing %1$s - %2$s of %3$s groups', $total, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total );
     1812        return apply_filters( 'bp_get_groups_pagination_count', $message, $from_num, $to_num, $total );
    18071813    }
    18081814
     
    41164122        $total     = bp_core_number_format( $members_template->total_member_count );
    41174123
     4124        if ( 1 == $members_template->total_member_count ) {
     4125            $message = __( 'Viewing 1 member', 'buddypress' );
     4126        } else {
     4127            $message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s member', 'Viewing %1$s - %2$s of %3$s groups', $members_template->total_member_count, 'buddypress' ), $from_num, $to_num, $total );
     4128        }
     4129
    41184130        /**
    41194131         * Filters the "Viewing x-y of z members" pagination message.
     
    41264138         * @param string $total    Total amount of members found.
    41274139         */
    4128         return apply_filters( 'bp_get_group_member_pagination_count', sprintf( _n( 'Viewing 1 member', 'Viewing %1$s - %2$s of %3$s members', $total, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total );
     4140        return apply_filters( 'bp_get_group_member_pagination_count', $message, $from_num, $to_num, $total );
    41294141    }
    41304142
     
    52395251        $total     = bp_core_number_format( $requests_template->total_request_count );
    52405252
     5253        if ( 1 == $requests_template->total_request_count ) {
     5254            $message = __( 'Viewing 1 request', 'buddypress' );
     5255        } else {
     5256            $message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s request', 'Viewing %1$s - %2$s of %3$s requests', $requests_template->total_request_count, 'buddypress' ), $from_num, $to_num, $total );
     5257        }
     5258
    52415259        /**
    52425260         * Filters pagination count text for group membership requests.
     
    52465264         * @param string $value Pagination count text for group membership requests.
    52475265         */
    5248         return apply_filters( 'bp_get_group_requests_pagination_count', sprintf( _n( 'Viewing 1 request', 'Viewing %1$s - %2$s of %3$s requests', $total, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total );
     5266        return apply_filters( 'bp_get_group_requests_pagination_count', $message, $from_num, $to_num, $total );
    52495267    }
    52505268
     
    56095627        $total     = bp_core_number_format( $invites_template->total_invite_count );
    56105628
     5629        if ( 1 == $invites_template->total_invite_count ) {
     5630            $message = __( 'Viewing 1 invitation', 'buddypress' );
     5631        } else {
     5632            $message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s invitation', 'Viewing %1$s - %2$s of %3$s invitations', $invites_template->total_invite_count, 'buddypress' ), $from_num, $to_num, $total );
     5633        }
     5634
    56115635        /** This filter is documented in bp-groups/bp-groups-template.php */
    5612         return apply_filters( 'bp_get_groups_pagination_count', sprintf( _n( 'Viewing 1 invitation', 'Viewing %1$s - %2$s of %3$s invitations', $total, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total );
     5636        return apply_filters( 'bp_get_groups_pagination_count', $message, $from_num, $to_num, $total );
    56135637    }
    56145638
Note: See TracChangeset for help on using the changeset viewer.