How to change Locale decimalFormat

I see that the decimalFormat property for the locale id "it_it" in I18N folder is not correct. It's #,##0.### but in Italy we usually use #.##0,###, so I want to change it but if I change I18N/it_it.php on next Yii release my changes will be overwritten, other solution is to change in start of my application the decimalFormat property but I see that Clocale class doesn't have a setDecimalFormat method. So is there a way to change this property or a way to create a copy of the file I18N/it_it.php in my application and point to it instead to the standard file?

thank you

hmm…The I18N data is from CLDR project. Could you check if they have any updates on this?

I check in the CLDR project, what I see is that in variables decimalFormat,  percentFormat, currencyFormat for all countries “.” is always used for decimal separator and “,” is always used for group separator even if this is not correct. I found some notes about this http://unicode.org/c…um=it&xpath=597 ) I don’t well understand but it seems this is done intentionally.

Fortunately the 2 property "decimal" and "group" in CLDR files are set correctly for different countries so I use them for my need (these properties can be read with Yii::app()->locale->getNumberSymbol('decimal') and Yii::app()->locale->getNumberSymbol('group')

 

Quote

I check in the CLDR project, what I see is that in variables decimalFormat,  percentFormat, currencyFormat for all countries "." is always used for decimal separator and "," is always used for group separator even if this is not correct. I found some notes about this http://unicode.org/c...um=it&xpath=597 ) I don't well understand but it seems this is done intentionally.

Fortunately the 2 property "decimal" and "group" in CLDR files are set correctly for different countries so I use them for my need (these properties can be read with Yii::app()->locale->getNumberSymbol('decimal') and Yii::app()->locale->getNumberSymbol('group')

That is correct, the pattern always uses . for decimal and , for group separation. During formatting, their respective locale decimal and group symbols should be used…

Is this not the case?

ah, yes. If you use CNumberFormatter to format a number, it will use correct separators.

Hi Qiang,

I'm using CNumberFormatter and I found this strange behavior, I do:

  $formatter=new CNumberFormatter('en_us');

  echo $formatter->format('#,##0.000' , '1400.345')

the result is correct: 1,400.345

but if I do

  echo $formatter->format('#,##0.###' , '1400.345')

the result is: 1,400.

so all decimals are truncated.

I initially found this problem by using the other method formatDecimal that use the CLDR constant 'decimalformat' (which is quite always #,##0.###)

What do you think about this?

Quote

  echo $formatter->format('#,##0.###' , '1400.345')

the result is: 1,400.

This looks like a bug, please create a new ticket.

http://code.google.c…yii/issues/list

Thanks!