How can I list all available windows locales in python console? How can I list all available windows locales in python console? python python

How can I list all available windows locales in python console?


>>> import locale>>> locale.locale_alias


You can look up available locale names on MSDN.

You have to pass the long version from "Language string" in the MSDN list as value to setlocale. The default L10N short codes like en_EN which are in locale_alias do NOT work in general.

I have already extracted some of them as dictionary:

LANGUAGES = {    'bg_BG': 'Bulgarian',    'cs_CZ': 'Czech',    'da_DK': 'Danish',    'de_DE': 'German',    'el_GR': 'Greek',    'en_US': 'English',    'es_ES': 'Spanish',    'et_EE': 'Estonian',    'fi_FI': 'Finnish',    'fr_FR': 'French',    'hr_HR': 'Croatian',    'hu_HU': 'Hungarian',    'it_IT': 'Italian',    'lt_LT': 'Lithuanian',    'lv_LV': 'Latvian',    'nl_NL': 'Dutch',    'no_NO': 'Norwegian',    'pl_PL': 'Polish',    'pt_PT': 'Portuguese',    'ro_RO': 'Romanian',    'ru_RU': 'Russian',    'sk_SK': 'Slovak',    'sl_SI': 'Slovenian',    'sv_SE': 'Swedish',    'tr_TR': 'Turkish',    'zh_CN': 'Chinese',}


the richest locale support i found in python is babel.

please install by:

pip install babel

then,

import babelall_ids = babel.localedata.locale_identifiers()

there is also extensive support for common terms translation etc.babel is being used in various other packages.

hth,alex