Changeset 6645 for trunk/src/includes/common/formatting.php
- Timestamp:
- 08/07/2017 08:33:36 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/formatting.php
r6573 r6645 624 624 625 625 // Setup the strings 626 $unknown_text = apply_filters( 'bbp_core_time_since_unknown_text', __( 'sometime', 'bbpress' ) );627 $right_now_text = apply_filters( 'bbp_core_time_since_right_now_text', __( 'right now', 'bbpress' ) );628 $ago_text = apply_filters( 'bbp_core_time_since_ago_text', __( '%s ago', 'bbpress' ) );626 $unknown_text = apply_filters( 'bbp_core_time_since_unknown_text', esc_html__( 'sometime', 'bbpress' ) ); 627 $right_now_text = apply_filters( 'bbp_core_time_since_right_now_text', esc_html__( 'right now', 'bbpress' ) ); 628 $ago_text = apply_filters( 'bbp_core_time_since_ago_text', esc_html__( '%s ago', 'bbpress' ) ); 629 629 630 630 // array of time period chunks 631 631 $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' ) ), 639 639 ); 640 640 … … 681 681 682 682 // 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' ), bbp_number_format_i18n( $count ) ); 684 684 685 685 // Step two: the second chunk 686 686 if ( $i + 2 < $j ) { 687 687 $seconds2 = $chunks[ $i + 1 ][0]; 688 $name2 = $chunks[ $i + 1 ][1];689 688 $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ); 690 689 691 690 // Add to output var 692 691 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' ), bbp_number_format_i18n( $count2 ) ); 694 694 } 695 695 }
Note: See TracChangeset
for help on using the changeset viewer.