[wp-trac] [WordPress Trac] #44531: Multiple bytes decimal point and thousands separator in number_format_i18n PHP < 5.4
WordPress Trac
noreply at wordpress.org
Fri Jul 6 10:33:04 UTC 2018
#44531: Multiple bytes decimal point and thousands separator in number_format_i18n
PHP < 5.4
-------------------------+-------------------------------------------------
Reporter: remcotolsma | Owner: (none)
Type: defect | Status: new
(bug) |
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version: trunk
Severity: normal | Keywords: has-patch has-unit-tests dev-
Focuses: | feedback 2nd-opinion
-------------------------+-------------------------------------------------
PHP `number_format` has only multiple bytes support in the decimal point
and thousands separator parameters since PHP 5.4.0. There is some code in
place in `wp-includes/class-wp-locale.php` to work around this:
{{{#!php
<?php
if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) {
// Replace space with a non-breaking space to avoid wrapping.
$thousands_sep = str_replace( ' ', ' ', $thousands_sep );
} else {
// PHP < 5.4.0 does not support multiple bytes in thousands
separator.
$thousands_sep = str_replace( array( ' ', ' ' ), ' ',
$thousands_sep );
}
}}}
Since we don't know how translators translate
`number_format_thousands_sep` and `number_format_decimal_point` i don't
think this is working in all cases. In the French translation files there
is currently a multibyte non-breaking space char. Above code will not
replace the multibyte non-breaking space char to a regular space.
Also see: https://make.wordpress.org/polyglots/2013/06/24/number_format-
bug/.
https://translate.wordpress.org/projects/wp/4.8.x/fr/default?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=5138840&filters%5Btranslation_id%5D=51885045
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44531>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list