Make WordPress Core

Ticket #10373: 10373.3.diff

File 10373.3.diff, 1.7 KB (added by SergeyBiryukov, 9 years ago)
  • src/wp-includes/locale.php

     
    190190                // See http://php.net/number_format
    191191
    192192                /* translators: $thousands_sep argument for http://php.net/number_format, default is , */
    193                 $trans = __('number_format_thousands_sep');
    194                 $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
     193                $thousands_sep = __( 'number_format_thousands_sep' );
    195194
     195                if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) {
     196                        // Replace space with a non-breaking space to avoid wrapping.
     197                        $non_breaking_space = html_entity_decode( ' ', ENT_QUOTES, get_option( 'blog_charset' ) );
     198                        $thousands_sep = str_replace( ' ', $non_breaking_space, $thousands_sep );
     199                } else {
     200                        // PHP < 5.4.0 does not support multiple bytes in thousands separator.
     201                        $thousands_sep = str_replace( array( '&nbsp;', '&#160;' ), ' ', $thousands_sep );
     202                }
     203
     204                $this->number_format['thousands_sep'] = ( 'number_format_thousands_sep' === $thousands_sep ) ? ',' : $thousands_sep;
     205
    196206                /* translators: $dec_point argument for http://php.net/number_format, default is . */
    197                 $trans = __('number_format_decimal_point');
    198                 $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
     207                $decimal_point = __( 'number_format_decimal_point' );
    199208
     209                $this->number_format['decimal_point'] = ( 'number_format_decimal_point' === $decimal_point ) ? '.' : $decimal_point;
     210
    200211                // Set text direction.
    201212                if ( isset( $GLOBALS['text_direction'] ) )
    202213                        $this->text_direction = $GLOBALS['text_direction'];