New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

es_MX/MXN: format_currency using comma instead dot for decimal separator #97

Closed
chronossc opened this Issue May 22, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@chronossc

chronossc commented May 22, 2014

Hello. I did various tests and found that format_currency is formatting MXN currency (from Mexico, es_MX locale) wrong. There is a small code that compare it to python locale, that use posix data:

In [1]: import locale

In [2]: from babel.numbers import format_currency, Locale

In [3]: locale.setlocale(locale.LC_ALL, 'es_MX.UTF-8')
Out[3]: 'es_MX.UTF-8'

In [4]: locale.localeconv()['int_curr_symbol']
Out[4]: 'MXN '

In [5]: locale.localeconv()['currency_symbol']
Out[5]: '$'

In [6]: locale.localeconv()['decimal_point']
Out[6]: '.'

In [7]: locale.currency(50)
Out[7]: '$ 50.00'

In [8]: format_currency(50, currency='MXN', locale=Locale('es_MX'))
Out[8]: u'50,00\xa0$'

In my tests I updated CLDR data, from 23.1 to 25 and same issue happens.

This can be a issue in CLDR data?

@chronossc

This comment has been minimized.

chronossc commented May 22, 2014

I found that es_DO, es_GT, es_HN, es_MX, es_NI, es_PA, es_SV are affected.

@etanol

This comment has been minimized.

Contributor

etanol commented Dec 5, 2014

This is solved in #117. It is caused by not taking into account locale inheritance exceptions. All the spanish variations you mention should be inheriting from es_419 instead of just es.

etanol added a commit to etanol/babel that referenced this issue Aug 3, 2015

look for a parent locale exception first
when deriving the parent locale from the given name, look in the parent
exceptions first (e.g. the parent of "es_MX" is "es_419", not "es")

Fixes python-babel#97

etanol added a commit to etanol/babel that referenced this issue Aug 4, 2015

look for a parent locale exception first
when deriving the parent locale from the given name, look in the parent
exceptions first (e.g. the parent of "es_MX" is "es_419", not "es")

Fixes python-babel#97

etanol added a commit to etanol/babel that referenced this issue Aug 5, 2015

look for a parent locale exception first
when deriving the parent locale from the given name, look in the parent
exceptions first (e.g. the parent of "es_MX" is "es_419", not "es")

Fixes python-babel#97

etanol added a commit to etanol/babel that referenced this issue Aug 5, 2015

localedata: Check inheritance exceptions first
When deriving the parent locale from the given name, look first in the
inheritance exception list.  This will cover cases like "es_MX", which
parent is "es_419" and not "es".

Fixes python-babel#97

etanol added a commit to etanol/babel that referenced this issue Aug 5, 2015

localedata: Check inheritance exceptions first
When deriving the parent locale from the given name, look first in the
inheritance exception list.  This will cover cases like "es_MX", which
parent is "es_419" and not "es".

Fixes python-babel#97

@sils sils closed this in #180 Aug 5, 2015

erickwilder added a commit to erickwilder/babel that referenced this issue Sep 23, 2015

localedata: Check inheritance exceptions first
When deriving the parent locale from the given name, look first in the
inheritance exception list.  This will cover cases like "es_MX", which
parent is "es_419" and not "es".

Fixes python-babel#97

@pyup-bot pyup-bot referenced this issue Jul 4, 2017

Merged

Initial Update #2

@pyup-bot pyup-bot referenced this issue Oct 12, 2017

Merged

Initial Update #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment