开发者

Displaying locale percentage number with Zend Framework

Does anyone know how to display a percentage format based on the locale using the zend framework? I've tried this below and it doesn't work for some reason:

$xx = Zend_Locale::getTranslation(null, 'PercentNumber'); // This outputs: "#,##0%" for locale 'en_us'
$percentage = Zend_Locale_Format::getNumber(133.3678, array('number_format' => $xx, 'locale' => $lan开发者_如何学编程g_LOCALE));

The output of $percentage is 133.3678.

Thanks.


That's somewhat true, in Arabic it is a different Unicode character: ٪ (U+066A), not the same as % (U+0025).


See http://php.net/manual/en/class.numberformatter.php


There is no need in localizing a %. (Researched by checking out the Percentage article in Wikipedia)

Every country in the world uses the notation x % where x is 1 out of 100. The only difference is the number-representation: 1.00 in English for instance while 1,00 in Dutch. Arabic countries write right-to-left, thus % x.

I bet you can find out how to format numbers in Zend.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜