views:

69

answers:

2

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' => $lang_LOCALE));

The output of $percentage is 133.3678.

Thanks.

+1  A: 

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.

Pindatjuh
Thanks. I should have done more research...just assumed it was different in other countries. Thanks again for helping me.
Ronedog
A: 

That's somewhat true, in arabic it is a different unicode character: ٪, not the same as %.

Jon