formatCurrency for non-en is different

I use this code to show money, it works. For positive number and negative, there is a brackets for negative.

<?php echo Yii::app()->numberFormatter->formatCurrency($n->amount, 'USD'); ?>


<?php echo Yii::app()->numberFormatter->formatCurrency($n->amount, 'JPY'); ?>


<?php echo Yii::app()->numberFormatter->formatCurrency($n->amount, 'TWD'); ?>

And then I tried to use i18n function and use this function to set language

<?php Yii::app()->setLanguage('en'); ?>


<?php Yii::app()->setLanguage('zh_tw'); ?>

<?php Yii::app()->setLanguage('ja'); ?>[/code]

But I found, the brackets for negative only shows in "en", for zh_cn, zh_tw, ja, it doesn't show brackets.

I think it is because is configurated like that in i18n folders. If you want brackets, you can configure it there.

Thanks, do you mean this document?

http://www.yiiframew…NumberFormatter

I only find the doc to change the pattern, it includes the following, but I didn't find bracket configuration. Do I read the correct doc?

dot (.): the decimal point. It will be replaced with the localized decimal point. 


comma (,): the grouping separator. It will be replaced with the localized grouping separator. 


zero (0): required digit. This specifies the places where a digit must appear (will pad 0 if not). 


hash (#): optional digit. This is mainly used to specify the location of decimal point and grouping separators. 


currency (¤): the currency placeholder. It will be replaced with the localized currency symbol. 


percentage (%): the percetage mark. If appearing, the number will be multiplied by 100 before being formatted. 


permillage (‰): the permillage mark. If appearing, the number will be multiplied by 1000 before being formatted. 


semicolon (;): the character separating positive and negative number sub-patterns. 

(Sorry, haven't seen your reply)

No, the configuration is in Yii/framework/i18n/data

See on en.php the 'currencyFormat' value: '¤#,##0.00;(¤#,##0.00)'

Now, open zh_cn.php and see the same variable: '¤#,##0.00'

So, if you want the brackets in zh_cn and others, change this currencyFormat configuration in each file you need.

Thanks, it works now. But is it possible to do this kind of configuration outside framework's directory? Because when we upgrade the framework, it's possible to overwrite it.