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
German number separators not working using format language and locale "de_DE" #61148
Comments
Yesterday, I opened a question on Stackoverflow that explains my problem in detail. Please read this page first: http://stackoverflow.com/questions/14287051/german-number-separators-using-format-language-on-osx A short summary: I'm on OSX 10.8.2. I wanted to format numbers according to the German numbering convention using Python's format language and the locale setting "de_DE". Actually, the following should work to achieve that:
The result of the last expressions should be 1.234,56. However, my result is 1234,56. More examples are on Stackoverflow. According to what other SO members have found out, this is a problem with the locale settings of OSX because the grouping of numbers is not fully part of the locale "de_DE". On Windows, however, grouping works fine using the locale "deu_deu" which is not available on OSX. Is this a bug? At least, it doesn't seem to be documented anywhere and is probably not the correct behavior even on OSX. Others have reported similar problems on OSX as well. Do you have a quick solution for this issue? Thanks in advance. |
What is the output of this? >>> locale.localeconv()
{'mon_decimal_point': ',', 'frac_digits': 2, 'p_sign_posn': 1, 'thousands_sep': '.', 'p_sep_by_space': 1, 'int_curr_symbol': 'EUR ', 'decimal_point': ',', 'mon_thousands_sep': '.', 'n_sep_by_space': 1, 'int_frac_digits': 2, 'currency_symbol': 'EUR', 'negative_sign': '-', 'mon_grouping': [3, 3, 0], 'positive_sign': '', 'n_cs_precedes': 0, 'grouping': [3, 3, 0], 'n_sign_posn': 1, 'p_cs_precedes': 0} If 'grouping' is [], then this looks like a bug in OSX. Python gets |
Using the locale 'de_DE', the output is: {'mon_decimal_point': ',', 'int_frac_digits': 2, 'p_sep_by_space': 0, 'frac_digits': 2, 'thousands_sep': '', 'n_sign_posn': 1, 'decimal_point': ',', 'int_curr_symbol': 'EUR ', 'n_cs_precedes': 1, 'p_sign_posn': 1, 'mon_thousands_sep': '.', 'negative_sign': '-', 'currency_symbol': 'Eu', 'n_sep_by_space': 0, 'mon_grouping': [3, 3, 0], 'p_cs_precedes': 1, 'positive_sign': '', 'grouping': [127]} What does the number 127 mean? Am 12.01.2013 um 12:39 schrieb Stefan Krah <report@bugs.python.org>:
|
127 means "no-more-grouping", so Python behaves as instructed by the OS. As you see, the OS prescribes 1.345.677,222 for *monetary* quantities According to http://de.wikipedia.org/wiki/DIN_1333 , for non monetary Most operating systems use [3, 3, 0] also for de_DE 'grouping', but The only way out of this would be to introduce a new 'm' locale specifier |
I think this issue should be closed, since we're doing as we're instructed by the OS. If someone wants to open a new issue for the "m" format specifier type, I'd support that. |
I agree, we can't really do anything here. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: