ZF2-161: InvalidArgumentException in CLDR lookup functions

Issue Type: Bug Created: 2012-02-12T17:35:00.000+0000 Last Updated: 2012-07-09T15:31:11.000+0000 Status: Resolved Fix version(s): Reporter: fisharebest (fisharebest) Assignee: Maks 3w (maks3w) Tags: - Zend\I18n

Related issues: - ZF2-167



Version: Github download 2012-02-11

Sample code:

echo \Zend\Locale\Locale::getTranslation('de', 'language', 'de'); echo \Zend\Locale\Data\Cldr::getContent('ar', 'defaultnumberingsystem');

Expected output:

"Deutsch" "arab"

Actual output:

Uncaught exception 'Zend\Locale\Exception\InvalidArgumentException' with message 'Unknown detail (language) for parsing locale data.' Uncaught exception 'Zend\Locale\Exception\InvalidArgumentException' with message 'Unknown detail (defaultnumberingsystem) for parsing locale data.'

These are the ZF2 equivalents of ZF1 functions, both of which produce the expected output:

Zend_Locale::getTranslation(); Zend_Locale_Data::getContent();

Possible solution:

The function \Zend\Locale\Data\Cldr::getContent() has a long switch statement (lines 900-1300) containing each of the possible CLDR lookups. It does not have the cases for 'language' or 'defaultnumberingsystem'. These could be added as follows:

case 'language': $temp = self::_getFile('main/' . $locale, '/ldml/localeDisplayNames/languages/language[@type=\'' . $value . '\']'); break;

case 'defaultnumberingsystem': $temp = self::_getFile('main/' . $locale, '/ldml/numbers/defaultNumberingSystem'); break;


Posted by Maks 3w (maks3w) on 2012-05-06T18:44:51.000+0000

This break was introduced in the following commit…

Now I'm studying the reasons behind this.

Posted by Maks 3w (maks3w) on 2012-05-08T16:08:03.000+0000

Finally this will not be fixed because there is a plan to remove this component.

With beta5 a new component will be released to cover this features.

As workaround you can use the functions provided by AbstractLocale (getDisplayLanguage, getDisplayScript, getDisplayRegion)

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.