[wp-trac] [WordPress Trac] #10373: Proper number formatting related to i18n

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 10 08:09:14 UTC 2009


#10373: Proper number formatting related to i18n
---------------------------+------------------------------------------------
 Reporter:  honza.skypala  |       Owner:  nbachiyski           
     Type:  defect (bug)   |      Status:  new                  
 Priority:  normal         |   Milestone:  Unassigned           
Component:  i18n           |     Version:  2.8.1                
 Severity:  normal         |    Keywords:  number formating i18n
---------------------------+------------------------------------------------
 Hi there,

 Technical description of the situation: WordPress function
 number_format_i18n() uses native PHP function number_format() for
 formatting numbers. Unfortunately this PHP function is not able to handle
 separators (both decimal and thousands separators) that fall into one of
 the following categories:
 - separator would contain more than one char, e.g. " "; in this case
 only the first char from the supplied string is used, in the example given
 above it would be "&".
 - separator is ASCII > 128, e.g. ASCII 160;

 Impact: Although this is not a native bug to WordPress, the problem source
 is in PHP, the impact is caused also in WordPress. This situation is
 problematic for users in Eastern Europe (Czech Republic, Russia, etc.)
 where the standard thousands separator is " " (space). The users in these
 countries usually don't want to use real space (ASCII 32) as thousands
 separator, as it could be word wrapped and the number would be saparated
 into two lines. Unfortunatelly supplying both variants of non-breakable
 space (i.e. " " or ASCII 160) fails.

 Proposed solution: unforunatelly this bug is reported in PHP for years and
 nothing happens there. Because of this situation I suggest fixing such
 problem in the next level, i.e. in WordPress. This means to create a
 custom function for formatting numbers, with identical input params as
 number_format(), just that this one would be able to  handle separator
 types mentioned above.

 I have such change already deployed on my WordPress blog for several
 months, so I am going to attach a diff file for the latest SVN state
 dealing with this issue.

 Honza

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10373>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list