back LC_MONETARY with Python and OpenBSD

comp
publication: April 28 2020 15:48
last update: April 28 2020 15:48

For a reference on the problem, see:
http://openbsd-archive.7691.n7.nabble.com/Problems-trying-to-format-currency-with-python-td359235.html

Configuring Python locale with brazilian currency, for example:

import locale
locale._override_localeconv = {
    'int_curr_symbol': 'BRL ',
    'currency_symbol': 'R$',
    '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,
    'p_sep_by_space': 1,
    'n_cs_precedes': 1,
    'n_sep_by_space': 1,
    'p_sign_posn': 1,
    'n_sign_posn': 1,
    'decimal_point': ',',
    'thousands_sep': '.',
    'grouping': [3, 3, 0]
}
locale.localeconv()

get in touch