[issue42156] Currency not correct for all locales

2020-10-29 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue42156] Currency not correct for all locales

2020-10-26 Thread Eric V. Smith
Eric V. Smith added the comment: And just to show that python is doing the right thing, if the locale is set up correctly, I'll show the following hack: >>> import locale >>> locale.setlocale(locale.LC_ALL, 'en_US') 'en_US' >>> locale.currency(24.99) '$24.99' >>>

[issue42156] Currency not correct for all locales

2020-10-26 Thread Eric V. Smith
Eric V. Smith added the comment: p_cs_precedes == 1 means "the currency_symbol or int_curr_symbol strings should precede the value of a monetary amount", per https://www.gnu.org/software/libc/manual/html_node/Currency-Symbol.html (I couldn't find a more authoritative source, but I think

[issue42156] Currency not correct for all locales

2020-10-26 Thread Stefan Völkl
Stefan Völkl added the comment: >>> locale.localeconv() {'int_curr_symbol': 'EUR ', 'currency_symbol': '€', 'mon_decimal_point': ',', 'mon_thousands_sep': '.', 'mon_grouping': [3, 3, 0], 'positive_sign': '', 'negative_sign': '-', 'int_frac_digits': 2, 'frac_digits': 2, 'p_cs_precedes': 1,

[issue42156] Currency not correct for all locales

2020-10-26 Thread Eric V. Smith
Eric V. Smith added the comment: What does locale.localeconv() return? >>> locale.localeconv() {'int_curr_symbol': '', 'currency_symbol': '', 'mon_decimal_point': '', 'mon_thousands_sep': '', 'mon_grouping': [], 'positive_sign': '', 'negative_sign': '', 'int_frac_digits': 127,

[issue42156] Currency not correct for all locales

2020-10-26 Thread Stefan Völkl
New submission from Stefan Völkl : I found that the currency formatting does not work correctly for all locales. For example: {{{ import locale amount = 24.99 locale.setlocale(locale.LC_ALL, 'it_IT.UTF-8') price = locale.currency(amount) print(price) }}} returns "€ 24,99". It should return