ZF-11908: Wrong arguments to Zend_Locale_Format::convertNumerals

Issue Type: Docs: Improvement Created: 2011-11-22T13:31:30.000+0000 Last Updated: 2011-11-22T13:31:30.000+0000 Status: Open Fix version(s): Reporter: fisharebest (fisharebest) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: Attachments:


The documentation (user and inline) says that the arguments to this function are the names of scripts.

But they are not. The arguments are actually the names of numbering systems.

For most locales, the numbering system name is simply a lower-case version of the script name. e.g.

Latn => latn Beng => beng Taml => taml

Upper/lower case are ignored, so the two are interchangeable.

But, for the arabic script, there are two sets of numbering systems. The Arabic language and Farsi both use the arabic script, but with different numerals. For illustration, these are

۰۱۲۳۴۵۶۷۸۹ - Arabic ٠١٢٣٤٥٦٧٨٩ - Farsi

Hence the file Zend/Locale/Data/numberingSystems.xml has two definitions: "arab" and "arabext".

I have confirmed that the code does actually use numbering-system-names, rather than script names. e.g.

echo Zend_Locale_Format::convertNumerals('0123456789', 'latn', 'arab'); // gives Arabic digits echo Zend_Locale_Format::convertNumerals('0123456789', 'latn', 'arabext'); // gives Farsi digits


  1. The documentation should be updated to reflect what the code actually does (use numbering system name, not script name)

Here is some sample code which illustrates the correct way to use this function.

To convert $number from $locale1 to $locale2,

$numbering_system1=Zend_Locale_Data::getContent($locale1, 'defaultnumberingsystem'); $numbering_system2=Zend_Locale_Data::getContent($locale2, 'defaultnumberingsystem'); echo Zend_Locale_Format::convertNumerals($number, $numbering_system1, $numbering_system2);


No comments to display

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.