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.

git-svn-id: https://develop.svn.wordpress.org/trunk@35372 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2015-10-23 11:50:37 +00:00
parent f935d4c26b
commit f8fa5c0e53
1 changed files with 8 additions and 4 deletions

View File

@ -176,12 +176,16 @@ class WP_Locale {
// See http://php.net/number_format // See http://php.net/number_format
/* translators: $thousands_sep argument for http://php.net/number_format, default is , */ /* translators: $thousands_sep argument for http://php.net/number_format, default is , */
$trans = __('number_format_thousands_sep'); $thousands_sep = __( 'number_format_thousands_sep' );
$this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans; // Replace space with a non-breaking space to avoid wrapping. Also replace entities with actual character.
$thousands_sep = str_replace( array( ' ', '&nbsp;', '&#160;' ), "\xA0", $thousands_sep );
$this->number_format['thousands_sep'] = ( 'number_format_thousands_sep' === $thousands_sep ) ? ',' : $thousands_sep;
/* translators: $dec_point argument for http://php.net/number_format, default is . */ /* translators: $dec_point argument for http://php.net/number_format, default is . */
$trans = __('number_format_decimal_point'); $decimal_point = __( 'number_format_decimal_point' );
$this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
$this->number_format['decimal_point'] = ( 'number_format_decimal_point' === $decimal_point ) ? '.' : $decimal_point;
// Set text direction. // Set text direction.
if ( isset( $GLOBALS['text_direction'] ) ) if ( isset( $GLOBALS['text_direction'] ) )