Skip to content
This repository has been archived by the owner on May 16, 2018. It is now read-only.

Zend_Locale does not honor parentLocale configuration #516

Closed
barbazul opened this issue Feb 20, 2015 · 7 comments
Closed

Zend_Locale does not honor parentLocale configuration #516

barbazul opened this issue Feb 20, 2015 · 7 comments
Assignees
Milestone

Comments

@barbazul
Copy link

This has become obvious after the update to CLDR 25 in which currency symbol position changed for es.xml but not for es_419.xml

All Latin American locales should inherit from es_419.xml as specified in supplementalData.xml line 409

<parentLocale parent="es_419" locales="es_AR es_BO es_CL es_CO es_CR es_CU es_DO es_EC es_GT es_HN es_MX es_NI es_PA es_PE es_PR es_PY es_SV es_US es_UY es_VE"/>

Try the following script:

$locale = new Zend_Locale('es_AR');
$curr = new Zend_Currency(null, $locale);
echo $curr->toCurrency(10);

Expected result $10

Actual result 10 $

@barbazul
Copy link
Author

For completion, here's the ticket I opened about this issue in CLDR http://unicode.org/cldr/trac/ticket/8194

@froschdesign
Copy link
Member

"parentLocales" is not supported in the current implementation of Zend_Locale.

(Note to me: Another reason to mark Zend_Locale as deprecated.)

@froschdesign
Copy link
Member

Workaround:

$fmt = new NumberFormatter('es_AR', NumberFormatter::CURRENCY);
echo $fmt->formatCurrency(10, 'ARS');

Output:

$10,00

@barbazul
Copy link
Author

Unfortunately, this workaround is not good for me as I am working in the
Magento e-commerce application and to apply this patch I would need to
modify (or override) core libraries that would render the aplication
unupgradeable.

The best fix in this scenario was to simply modify the XML files.

Proper support would be preferrable I suppose, but this simple fix worked
for me without issues so I stopped complaining.
El 18/05/2015 06:17, "Frank Brückner" notifications@github.com escribió:

Workaround:

$fmt = new NumberFormatter('es_AR', NumberFormatter::CURRENCY);echo $fmt->formatCurrency(10, 'ARS');

Output:

$10,00


Reply to this email directly or view it on GitHub
#516 (comment).

@froschdesign
Copy link
Member

I am working in the Magento e-commerce

Good to know.

The best fix in this scenario was to simply modify the XML files.

Bad idea, because all XML files come from an external library (CLDR) and we can not change this library.

@barbazul
Copy link
Author

Yes, I am aware. That is the reason why propper support would be
preferrable.

However, simply changing the symbol position in the XML files was the fix
with the lowest impact in the application and the one that was the easiest
to track in case of an upgrade.
El 18/05/2015 08:05, "Frank Brückner" notifications@github.com escribió:

I am working in the Magento e-commerce

Good to know.

The best fix in this scenario was to simply modify the XML files.

Bad idea, because all XML files come from an external library (CLDR
http://cldr.unicode.org/) and we can not change this library.


Reply to this email directly or view it on GitHub
#516 (comment).

@froschdesign froschdesign self-assigned this May 19, 2015
@froschdesign froschdesign added this to the 1.12.12 milestone May 19, 2015
@barbazul
Copy link
Author

Thank you for your fix. I tried it in a Magento application and it works perfectly

bgetsug pushed a commit to fisdap/zf1 that referenced this issue Aug 12, 2015
* 1.12.13: (668 commits)
  [1.12.13] Release readiness
  Fixes for unit tests
  Cast int and float to string when creating headers
  Bump to next dev version
  [1.12.12] Release readiness
  Updated README with ZF2015-04 details
  [ZF2015-04] Fix CRLF injections in HTTP and Mail
  Added test for zendframeworkGH-564
  Adds unit test for parent locale in Zend_Currency
  Fixes zendframework#516 - Zend_Locale does not honor parentLocale configuration
  Adds test for locale without parent local in Zend_Locale_DataTest
  Extends Zend_Locale_Data::getContent for reading parent locales
  Allow early suppressing of file not found warnings
  Fixes zendframework#561 - Zend_Date not expected year
  (sk) tfix
  Fixes zendframework#557 - Dependencies table unreadable
  Fixes wrong exceptions in Audioscrobbler unit test
  Fixes zendframework#550 - Zend_Http_UserAgent_AbstractDevice undefined index
  Fixed typo in Zend_View_Helper_Navigation_HelperAbstract
  Updated class name in PHPDoc
  ...

Conflicts:
	.gitignore
	README.md
	composer.json
dgiotas pushed a commit to tripsta/zf1 that referenced this issue Jun 17, 2016
antonis179 pushed a commit to tripsta/zf1 that referenced this issue Jan 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants