Skip to content

Instantly share code, notes, and snippets.

@easydevmixin
Last active January 25, 2018 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save easydevmixin/8918a841fdaa0fe7d458af885c479e84 to your computer and use it in GitHub Desktop.
Save easydevmixin/8918a841fdaa0fe7d458af885c479e84 to your computer and use it in GitHub Desktop.
import locale
old_locale = locale.getlocale()
old_locale

('en_US', 'UTF-8')

locale.setlocale(locale.LC_ALL, 'es_ES')

'es_ES'

locale.localeconv()

{'currency_symbol': 'Eu', 'decimal_point': ',', 'frac_digits': 2, 'grouping': [127], 'int_curr_symbol': 'EUR ', 'int_frac_digits': 2, 'mon_decimal_point': ',', 'mon_grouping': [3, 3, 0], 'mon_thousands_sep': '.', 'n_cs_precedes': 0, 'n_sep_by_space': 1, 'n_sign_posn': 1, 'negative_sign': '-', 'p_cs_precedes': 0, 'p_sep_by_space': 1, 'p_sign_posn': 1, 'positive_sign': '', 'thousands_sep': ''}

locale.currency(1500)

'1500,00 Eu'

locale.setlocale(locale.LC_ALL, old_locale)

'en_US.UTF-8'

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