ZF-10875: Zend_Locale_Format does not honor Zend_Registry::set('Zend_Locale', ...);


The documentation states:

"... simply set an instance of Zend_Locale to the registry with the key 'Zend_Locale'. Then this instance will be used within all locale aware classes of Zend Framework. ..."

But with Zend_Locale_Format this is not true:

--- snip ---

// Just to be sure: set PHP locale to something else setlocale(LC_ALL, "de");

// Instantiate and register a new Zend_Locale $locale_en = new Zend_Locale('en'); Zend_Registry::set('Zend_Locale', $locale_en);

echo Zend_Locale_Format::toNumber(4711.0815); // WRONG: 4.711,0815 (german as per setlocale) echo "

// This works as expected: $date = new Zend_Date(); echo $date->get(Zend_Date::WEEKDAY); // OK - english weekday echo "

// This extra step is required to make it work: Zend_Locale_Format::setOptions(array("locale"=>$locale_en));

echo Zend_Locale_Format::toNumber(4711.0815); // OK: 4,711.0815 (english as per Zend_Locale) echo "

--- snap ---


A feature which does not exist in a class is an improvement and not a bug :-)