Skip to:
Content

BuddyPress.org

Changeset 8655


Ignore:
Timestamp:
07/20/2014 09:41:10 PM (10 years ago)
Author:
djpaul
Message:

i18n improvements in Message notifications

Add singular form of “you have x new private messages”, and use
bp_core_number_format to format the number correctly for the locale.

See #5767, props SGr33n

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/bp-messages-notifications.php

    r8616 r8655  
    123123 */
    124124function messages_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
     125    $total_items = (int) $total_items;
    125126
    126127    if ( 'new_message' === $action ) {
     
    128129        $title = __( 'Inbox', 'buddypress' );
    129130
    130         if ( (int) $total_items > 1 ) {
    131             $text   = sprintf( __( 'You have %d new messages', 'buddypress' ), (int) $total_items );
     131        if ( $total_items > 1 ) {
     132            $text   = sprintf( __( 'You have %d new messages', 'buddypress' ), $total_items );
    132133            $filter = 'bp_messages_multiple_new_message_notification';
    133134        } else {
     
    142143                $text = sprintf( __( '%s sent you a new private message', 'buddypress' ), bp_core_get_user_displayname( $secondary_item_id ) );
    143144            } else {
    144                 $text = sprintf( __( 'You have %d new private messages', 'buddypress' ), (int) $total_items );
     145                $text = sprintf( _n( 'You have %s new private message', 'You have %s new private messages', $total_items, 'buddypress' ), bp_core_number_format( $total_items ) );
    145146            }
    146147            $filter = 'bp_messages_single_new_message_notification';
Note: See TracChangeset for help on using the changeset viewer.