WordPress.org

Make WordPress Core

Changeset 35372


Ignore:
Timestamp:
10/23/2015 11:50:37 AM (4 years ago)
Author:
SergeyBiryukov
Message:

In WP_Locale::init(), replace space as a thousands separator with a non-breaking space.

Also replace '&nbsp; and &#160; HTML entities with the actual character, since PHP < 5.4.0 does not allow multiple bytes to be used for decimal points or thousands separators.

Fixes #10373.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/locale.php

    r35336 r35372  
    177177
    178178        /* translators: $thousands_sep argument for http://php.net/number_format, default is , */
    179         $trans = __('number_format_thousands_sep');
    180         $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
     179        $thousands_sep = __( 'number_format_thousands_sep' );
     180        // Replace space with a non-breaking space to avoid wrapping. Also replace entities with actual character.
     181        $thousands_sep = str_replace( array( ' ', '&nbsp;', '&#160;' ), "\xA0", $thousands_sep );
     182
     183        $this->number_format['thousands_sep'] = ( 'number_format_thousands_sep' === $thousands_sep ) ? ',' : $thousands_sep;
    181184
    182185        /* translators: $dec_point argument for http://php.net/number_format, default is . */
    183         $trans = __('number_format_decimal_point');
    184         $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
     186        $decimal_point = __( 'number_format_decimal_point' );
     187
     188        $this->number_format['decimal_point'] = ( 'number_format_decimal_point' === $decimal_point ) ? '.' : $decimal_point;
    185189
    186190        // Set text direction.
Note: See TracChangeset for help on using the changeset viewer.