From c49ada7d75afeec3e6aacd2731516ef3c9552f49 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 23 Oct 2015 11:51:28 +0000 Subject: [PATCH] In `WP_Locale::init()`, replace space as a thousands separator with a non-breaking space. Also replace `' ` and ` ` 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. Built from https://develop.svn.wordpress.org/trunk@35372 git-svn-id: http://core.svn.wordpress.org/trunk@35336 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/locale.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wp-includes/locale.php b/wp-includes/locale.php index 64435f7127..2bda4bbf7b 100644 --- a/wp-includes/locale.php +++ b/wp-includes/locale.php @@ -176,12 +176,16 @@ class WP_Locale { // See http://php.net/number_format /* translators: $thousands_sep argument for http://php.net/number_format, default is , */ - $trans = __('number_format_thousands_sep'); - $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans; + $thousands_sep = __( 'number_format_thousands_sep' ); + // Replace space with a non-breaking space to avoid wrapping. Also replace entities with actual character. + $thousands_sep = str_replace( array( ' ', ' ', ' ' ), "\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 . */ - $trans = __('number_format_decimal_point'); - $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans; + $decimal_point = __( 'number_format_decimal_point' ); + + $this->number_format['decimal_point'] = ( 'number_format_decimal_point' === $decimal_point ) ? '.' : $decimal_point; // Set text direction. if ( isset( $GLOBALS['text_direction'] ) )