Skip to content
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

chronossc opened this issue May 22, 2014 · 2 comments


Copy link

@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?

Copy link

@chronossc chronossc commented May 22, 2014

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

Copy link

@etanol 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.

@sils sils closed this in #180 Aug 5, 2015
erickwilder added a commit to erickwilder/babel that referenced this issue Sep 23, 2015
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants