Skip to:
Content

bbPress.org

Ticket #3139: 3139.patch

File 3139.patch, 2.7 KB (added by SergeyBiryukov, 9 years ago)
  • src/includes/common/formatting.php

     
    629629
    630630                // array of time period chunks
    631631                $chunks = array(
    632                         array( 60 * 60 * 24 * 365 , __( 'year',   'bbpress' ), __( 'years',   'bbpress' ) ),
    633                         array( 60 * 60 * 24 * 30 ,  __( 'month',  'bbpress' ), __( 'months',  'bbpress' ) ),
    634                         array( 60 * 60 * 24 * 7,    __( 'week',   'bbpress' ), __( 'weeks',   'bbpress' ) ),
    635                         array( 60 * 60 * 24 ,       __( 'day',    'bbpress' ), __( 'days',    'bbpress' ) ),
    636                         array( 60 * 60 ,            __( 'hour',   'bbpress' ), __( 'hours',   'bbpress' ) ),
    637                         array( 60 ,                 __( 'minute', 'bbpress' ), __( 'minutes', 'bbpress' ) ),
    638                         array( 1,                   __( 'second', 'bbpress' ), __( 'seconds', 'bbpress' ) )
     632                        array( YEAR_IN_SECONDS,   '%s year',   '%s years',   _n_noop( '%s year',   '%s years',   'bbpress' ) ),
     633                        array( MONTH_IN_SECONDS,  '%s month',  '%s months',  _n_noop( '%s month',  '%s months',  'bbpress' ) ),
     634                        array( WEEK_IN_SECONDS,   '%s week',   '%s weeks',   _n_noop( '%s week',   '%s weeks',   'bbpress' ) ),
     635                        array( DAY_IN_SECONDS,    '%s day',    '%s days',    _n_noop( '%s day',    '%s days',    'bbpress' ) ),
     636                        array( HOUR_IN_SECONDS,   '%s hour',   '%s hours',   _n_noop( '%s hour',   '%s hours',   'bbpress' ) ),
     637                        array( MINUTE_IN_SECONDS, '%s minute', '%s minutes', _n_noop( '%s minute', '%s minutes', 'bbpress' ) ),
     638                        array( 1,                 '%s second', '%s seconds', _n_noop( '%s second', '%s seconds', 'bbpress' ) ),
    639639                );
    640640
    641641                if ( ! empty( $older_date ) && ! is_numeric( $older_date ) ) {
    … …  
    680680                        } else {
    681681
    682682                                // Set output var
    683                                 $output = ( 1 == $count ) ? '1 '. $chunks[ $i ][1] : $count . ' ' . $chunks[ $i ][2];
     683                                $output = sprintf( _n( $chunks[ $i ][1], $chunks[ $i ][2], $count, 'bbppress' ), number_format_i18n( $count ) );
    684684
    685685                                // Step two: the second chunk
    686686                                if ( $i + 2 < $j ) {
    687687                                        $seconds2 = $chunks[ $i + 1 ][0];
    688                                         $name2    = $chunks[ $i + 1 ][1];
    689688                                        $count2   = floor( ( $since - ( $seconds * $count ) ) / $seconds2 );
    690689
    691690                                        // Add to output var
    692691                                        if ( 0 != $count2 ) {
    693                                                 $output .= ( 1 == $count2 ) ? _x( ',', 'Separator in time since', 'bbpress' ) . ' 1 '. $name2 : _x( ',', 'Separator in time since', 'bbpress' ) . ' ' . $count2 . ' ' . $chunks[ $i + 1 ][2];
     692                                                $output .= _x( ',', 'Separator in time since', 'bbpress' ) . ' ';
     693                                                $output .= sprintf( _n( $chunks[ $i + 1 ][1], $chunks[ $i + 1 ][2], $count2, 'bbppress' ), number_format_i18n( $count2 ) );
    694694                                        }
    695695                                }
    696696