Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/27/2014 12:49:45 AM (10 years ago)
Author:
boonebgorges
Message:

Use _n() for translations in bp_get_group_member_count()

The previous technique (manually switching between 1 and not-1) does not
provide adequate internationalizability for all languages.

Adds unit tests.

File:
1 edited

Legend:

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

    r9046 r9047  
    16341634        global $groups_template;
    16351635
    1636         if ( 1 == (int) $groups_template->group->total_member_count )
    1637             return apply_filters( 'bp_get_group_member_count', sprintf( __( '%s member', 'buddypress' ), bp_core_number_format( $groups_template->group->total_member_count ) ) );
    1638         else
    1639             return apply_filters( 'bp_get_group_member_count', sprintf( __( '%s members', 'buddypress' ), bp_core_number_format( $groups_template->group->total_member_count ) ) );
     1636        if ( isset( $groups_template->group->total_member_count ) ) {
     1637            $count = (int) $groups_template->group->total_member_count;
     1638        } else {
     1639            $count = 0;
     1640        }
     1641
     1642        $count_string = sprintf( _n( '%s member', '%s members', $count, 'buddypress' ), bp_core_number_format( $count ) );
     1643
     1644        return apply_filters( 'bp_get_group_member_count', $count_string );
    16401645    }
    16411646
Note: See TracChangeset for help on using the changeset viewer.