[wp-polyglots] decimal number representation problem

Jovan Kostovski chombium at gmail.com
Wed Aug 5 17:14:12 UTC 2009


Hi,

I've noticed that there are problems in representation of decimal numbers.
The representation is defined by the following three values in the
translation file:
number_format_decimals, number_format_decimal_point and
number_format_thousands_sep.

In the Macedonian language translation of wordpress.pot which I
maintain, I've set this values to:
number_format_decimals = 3
number_format_decimal_point = ,
number_format_thousands_sep = .

This means that the decimal number representation would be 1.234,567

I've noticed that all the numbers including integers are shown with this format
so for example I get "23,000" posts on the dashboard instead of  "23"

I can fix this behavior by setting:
number_format_decimals = 0
in the translation, but if a floating point number has to be formated
it will be truncated to its integer part.

I dig trough the code of wp 2.8.3 and I've noticed that the
problematic function is number_format_i18n
located in wp-includes/functions.php
This function is the only place where php number_format function is
called with the parameters from the translation file.

The function number_format_i18n should be patched to check if the
number is float before converting it
to string with number_format.

Are there are any floating point numbers which are formated with this function?
Is it safe to set number_format_decimals = 0 and loose all the
floating point numbers?

Any advice would be highly appreciated.

BR, Jovan


References:
[1] http://php.net/number_format


More information about the wp-polyglots mailing list