Home | History | Annotate | Download | only in Lib
      1 """ Locale support.
      2 
      3     The module provides low-level access to the C lib's locale APIs
      4     and adds high level number formatting APIs as well as a locale
      5     aliasing engine to complement these.
      6 
      7     The aliasing engine includes support for many commonly used locale
      8     names and maps them to values suitable for passing to the C lib's
      9     setlocale() function. It also includes default encodings for all
     10     supported locale names.
     11 
     12 """
     13 
     14 import sys
     15 import encodings
     16 import encodings.aliases
     17 import re
     18 import operator
     19 import functools
     20 
     21 # Try importing the _locale module.

     22 #

     23 # If this fails, fall back on a basic 'C' locale emulation.

     24 
     25 # Yuck:  LC_MESSAGES is non-standard:  can't tell whether it exists before

     26 # trying the import.  So __all__ is also fiddled at the end of the file.

     27 __all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
     28            "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",
     29            "str", "atof", "atoi", "format", "format_string", "currency",
     30            "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
     31            "LC_NUMERIC", "LC_ALL", "CHAR_MAX"]
     32 
     33 try:
     34 
     35     from _locale import *
     36 
     37 except ImportError:
     38 
     39     # Locale emulation

     40 
     41     CHAR_MAX = 127
     42     LC_ALL = 6
     43     LC_COLLATE = 3
     44     LC_CTYPE = 0
     45     LC_MESSAGES = 5
     46     LC_MONETARY = 4
     47     LC_NUMERIC = 1
     48     LC_TIME = 2
     49     Error = ValueError
     50 
     51     def localeconv():
     52         """ localeconv() -> dict.
     53             Returns numeric and monetary locale-specific parameters.
     54         """
     55         # 'C' locale default values

     56         return {'grouping': [127],
     57                 'currency_symbol': '',
     58                 'n_sign_posn': 127,
     59                 'p_cs_precedes': 127,
     60                 'n_cs_precedes': 127,
     61                 'mon_grouping': [],
     62                 'n_sep_by_space': 127,
     63                 'decimal_point': '.',
     64                 'negative_sign': '',
     65                 'positive_sign': '',
     66                 'p_sep_by_space': 127,
     67                 'int_curr_symbol': '',
     68                 'p_sign_posn': 127,
     69                 'thousands_sep': '',
     70                 'mon_thousands_sep': '',
     71                 'frac_digits': 127,
     72                 'mon_decimal_point': '',
     73                 'int_frac_digits': 127}
     74 
     75     def setlocale(category, value=None):
     76         """ setlocale(integer,string=None) -> string.
     77             Activates/queries locale processing.
     78         """
     79         if value not in (None, '', 'C'):
     80             raise Error, '_locale emulation only supports "C" locale'
     81         return 'C'
     82 
     83     def strcoll(a,b):
     84         """ strcoll(string,string) -> int.
     85             Compares two strings according to the locale.
     86         """
     87         return cmp(a,b)
     88 
     89     def strxfrm(s):
     90         """ strxfrm(string) -> string.
     91             Returns a string that behaves for cmp locale-aware.
     92         """
     93         return s
     94 
     95 
     96 _localeconv = localeconv
     97 
     98 # With this dict, you can override some items of localeconv's return value.

     99 # This is useful for testing purposes.

    100 _override_localeconv = {}
    101 
    102 @functools.wraps(_localeconv)
    103 def localeconv():
    104     d = _localeconv()
    105     if _override_localeconv:
    106         d.update(_override_localeconv)
    107     return d
    108 
    109 
    110 ### Number formatting APIs

    111 
    112 # Author: Martin von Loewis

    113 # improved by Georg Brandl

    114 
    115 # Iterate over grouping intervals

    116 def _grouping_intervals(grouping):
    117     last_interval = None
    118     for interval in grouping:
    119         # if grouping is -1, we are done

    120         if interval == CHAR_MAX:
    121             return
    122         # 0: re-use last group ad infinitum

    123         if interval == 0:
    124             if last_interval is None:
    125                 raise ValueError("invalid grouping")
    126             while True:
    127                 yield last_interval
    128         yield interval
    129         last_interval = interval
    130 
    131 #perform the grouping from right to left

    132 def _group(s, monetary=False):
    133     conv = localeconv()
    134     thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
    135     grouping = conv[monetary and 'mon_grouping' or 'grouping']
    136     if not grouping:
    137         return (s, 0)
    138     result = ""
    139     seps = 0
    140     if s[-1] == ' ':
    141         stripped = s.rstrip()
    142         right_spaces = s[len(stripped):]
    143         s = stripped
    144     else:
    145         right_spaces = ''
    146     left_spaces = ''
    147     groups = []
    148     for interval in _grouping_intervals(grouping):
    149         if not s or s[-1] not in "0123456789":
    150             # only non-digit characters remain (sign, spaces)

    151             left_spaces = s
    152             s = ''
    153             break
    154         groups.append(s[-interval:])
    155         s = s[:-interval]
    156     if s:
    157         groups.append(s)
    158     groups.reverse()
    159     return (
    160         left_spaces + thousands_sep.join(groups) + right_spaces,
    161         len(thousands_sep) * (len(groups) - 1)
    162     )
    163 
    164 # Strip a given amount of excess padding from the given string

    165 def _strip_padding(s, amount):
    166     lpos = 0
    167     while amount and s[lpos] == ' ':
    168         lpos += 1
    169         amount -= 1
    170     rpos = len(s) - 1
    171     while amount and s[rpos] == ' ':
    172         rpos -= 1
    173         amount -= 1
    174     return s[lpos:rpos+1]
    175 
    176 _percent_re = re.compile(r'%(?:\((?P<key>.*?)\))?'
    177                          r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')
    178 
    179 def format(percent, value, grouping=False, monetary=False, *additional):
    180     """Returns the locale-aware substitution of a %? specifier
    181     (percent).
    182 
    183     additional is for format strings which contain one or more
    184     '*' modifiers."""
    185     # this is only for one-percent-specifier strings and this should be checked

    186     match = _percent_re.match(percent)
    187     if not match or len(match.group())!= len(percent):
    188         raise ValueError(("format() must be given exactly one %%char "
    189                          "format specifier, %s not valid") % repr(percent))
    190     return _format(percent, value, grouping, monetary, *additional)
    191 
    192 def _format(percent, value, grouping=False, monetary=False, *additional):
    193     if additional:
    194         formatted = percent % ((value,) + additional)
    195     else:
    196         formatted = percent % value
    197     # floats and decimal ints need special action!

    198     if percent[-1] in 'eEfFgG':
    199         seps = 0
    200         parts = formatted.split('.')
    201         if grouping:
    202             parts[0], seps = _group(parts[0], monetary=monetary)
    203         decimal_point = localeconv()[monetary and 'mon_decimal_point'
    204                                               or 'decimal_point']
    205         formatted = decimal_point.join(parts)
    206         if seps:
    207             formatted = _strip_padding(formatted, seps)
    208     elif percent[-1] in 'diu':
    209         seps = 0
    210         if grouping:
    211             formatted, seps = _group(formatted, monetary=monetary)
    212         if seps:
    213             formatted = _strip_padding(formatted, seps)
    214     return formatted
    215 
    216 def format_string(f, val, grouping=False):
    217     """Formats a string in the same way that the % formatting would use,
    218     but takes the current locale into account.
    219     Grouping is applied if the third parameter is true."""
    220     percents = list(_percent_re.finditer(f))
    221     new_f = _percent_re.sub('%s', f)
    222 
    223     if operator.isMappingType(val):
    224         new_val = []
    225         for perc in percents:
    226             if perc.group()[-1]=='%':
    227                 new_val.append('%')
    228             else:
    229                 new_val.append(format(perc.group(), val, grouping))
    230     else:
    231         if not isinstance(val, tuple):
    232             val = (val,)
    233         new_val = []
    234         i = 0
    235         for perc in percents:
    236             if perc.group()[-1]=='%':
    237                 new_val.append('%')
    238             else:
    239                 starcount = perc.group('modifiers').count('*')
    240                 new_val.append(_format(perc.group(),
    241                                       val[i],
    242                                       grouping,
    243                                       False,
    244                                       *val[i+1:i+1+starcount]))
    245                 i += (1 + starcount)
    246     val = tuple(new_val)
    247 
    248     return new_f % val
    249 
    250 def currency(val, symbol=True, grouping=False, international=False):
    251     """Formats val according to the currency settings
    252     in the current locale."""
    253     conv = localeconv()
    254 
    255     # check for illegal values

    256     digits = conv[international and 'int_frac_digits' or 'frac_digits']
    257     if digits == 127:
    258         raise ValueError("Currency formatting is not possible using "
    259                          "the 'C' locale.")
    260 
    261     s = format('%%.%if' % digits, abs(val), grouping, monetary=True)
    262     # '<' and '>' are markers if the sign must be inserted between symbol and value

    263     s = '<' + s + '>'
    264 
    265     if symbol:
    266         smb = conv[international and 'int_curr_symbol' or 'currency_symbol']
    267         precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']
    268         separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']
    269 
    270         if precedes:
    271             s = smb + (separated and ' ' or '') + s
    272         else:
    273             s = s + (separated and ' ' or '') + smb
    274 
    275     sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']
    276     sign = conv[val<0 and 'negative_sign' or 'positive_sign']
    277 
    278     if sign_pos == 0:
    279         s = '(' + s + ')'
    280     elif sign_pos == 1:
    281         s = sign + s
    282     elif sign_pos == 2:
    283         s = s + sign
    284     elif sign_pos == 3:
    285         s = s.replace('<', sign)
    286     elif sign_pos == 4:
    287         s = s.replace('>', sign)
    288     else:
    289         # the default if nothing specified;

    290         # this should be the most fitting sign position

    291         s = sign + s
    292 
    293     return s.replace('<', '').replace('>', '')
    294 
    295 def str(val):
    296     """Convert float to integer, taking the locale into account."""
    297     return format("%.12g", val)
    298 
    299 def atof(string, func=float):
    300     "Parses a string as a float according to the locale settings."
    301     #First, get rid of the grouping

    302     ts = localeconv()['thousands_sep']
    303     if ts:
    304         string = string.replace(ts, '')
    305     #next, replace the decimal point with a dot

    306     dd = localeconv()['decimal_point']
    307     if dd:
    308         string = string.replace(dd, '.')
    309     #finally, parse the string

    310     return func(string)
    311 
    312 def atoi(str):
    313     "Converts a string to an integer according to the locale settings."
    314     return atof(str, int)
    315 
    316 def _test():
    317     setlocale(LC_ALL, "")
    318     #do grouping

    319     s1 = format("%d", 123456789,1)
    320     print s1, "is", atoi(s1)
    321     #standard formatting

    322     s1 = str(3.14)
    323     print s1, "is", atof(s1)
    324 
    325 ### Locale name aliasing engine

    326 
    327 # Author: Marc-Andre Lemburg, mal (at] lemburg.com

    328 # Various tweaks by Fredrik Lundh <fredrik (at] pythonware.com>

    329 
    330 # store away the low-level version of setlocale (it's

    331 # overridden below)

    332 _setlocale = setlocale
    333 
    334 def normalize(localename):
    335 
    336     """ Returns a normalized locale code for the given locale
    337         name.
    338 
    339         The returned locale code is formatted for use with
    340         setlocale().
    341 
    342         If normalization fails, the original name is returned
    343         unchanged.
    344 
    345         If the given encoding is not known, the function defaults to
    346         the default encoding for the locale code just like setlocale()
    347         does.
    348 
    349     """
    350     # Normalize the locale name and extract the encoding

    351     fullname = localename.lower()
    352     if ':' in fullname:
    353         # ':' is sometimes used as encoding delimiter.

    354         fullname = fullname.replace(':', '.')
    355     if '.' in fullname:
    356         langname, encoding = fullname.split('.')[:2]
    357         fullname = langname + '.' + encoding
    358     else:
    359         langname = fullname
    360         encoding = ''
    361 
    362     # First lookup: fullname (possibly with encoding)

    363     norm_encoding = encoding.replace('-', '')
    364     norm_encoding = norm_encoding.replace('_', '')
    365     lookup_name = langname + '.' + encoding
    366     code = locale_alias.get(lookup_name, None)
    367     if code is not None:
    368         return code
    369     #print 'first lookup failed'

    370 
    371     # Second try: langname (without encoding)

    372     code = locale_alias.get(langname, None)
    373     if code is not None:
    374         #print 'langname lookup succeeded'

    375         if '.' in code:
    376             langname, defenc = code.split('.')
    377         else:
    378             langname = code
    379             defenc = ''
    380         if encoding:
    381             # Convert the encoding to a C lib compatible encoding string

    382             norm_encoding = encodings.normalize_encoding(encoding)
    383             #print 'norm encoding: %r' % norm_encoding

    384             norm_encoding = encodings.aliases.aliases.get(norm_encoding,
    385                                                           norm_encoding)
    386             #print 'aliased encoding: %r' % norm_encoding

    387             encoding = locale_encoding_alias.get(norm_encoding,
    388                                                  norm_encoding)
    389         else:
    390             encoding = defenc
    391         #print 'found encoding %r' % encoding

    392         if encoding:
    393             return langname + '.' + encoding
    394         else:
    395             return langname
    396 
    397     else:
    398         return localename
    399 
    400 def _parse_localename(localename):
    401 
    402     """ Parses the locale code for localename and returns the
    403         result as tuple (language code, encoding).
    404 
    405         The localename is normalized and passed through the locale
    406         alias engine. A ValueError is raised in case the locale name
    407         cannot be parsed.
    408 
    409         The language code corresponds to RFC 1766.  code and encoding
    410         can be None in case the values cannot be determined or are
    411         unknown to this implementation.
    412 
    413     """
    414     code = normalize(localename)
    415     if '@' in code:
    416         # Deal with locale modifiers

    417         code, modifier = code.split('@')
    418         if modifier == 'euro' and '.' not in code:
    419             # Assume Latin-9 for @euro locales. This is bogus,

    420             # since some systems may use other encodings for these

    421             # locales. Also, we ignore other modifiers.

    422             return code, 'iso-8859-15'
    423 
    424     if '.' in code:
    425         return tuple(code.split('.')[:2])
    426     elif code == 'C':
    427         return None, None
    428     raise ValueError, 'unknown locale: %s' % localename
    429 
    430 def _build_localename(localetuple):
    431 
    432     """ Builds a locale code from the given tuple (language code,
    433         encoding).
    434 
    435         No aliasing or normalizing takes place.
    436 
    437     """
    438     language, encoding = localetuple
    439     if language is None:
    440         language = 'C'
    441     if encoding is None:
    442         return language
    443     else:
    444         return language + '.' + encoding
    445 
    446 def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
    447 
    448     """ Tries to determine the default locale settings and returns
    449         them as tuple (language code, encoding).
    450 
    451         According to POSIX, a program which has not called
    452         setlocale(LC_ALL, "") runs using the portable 'C' locale.
    453         Calling setlocale(LC_ALL, "") lets it use the default locale as
    454         defined by the LANG variable. Since we don't want to interfere
    455         with the current locale setting we thus emulate the behavior
    456         in the way described above.
    457 
    458         To maintain compatibility with other platforms, not only the
    459         LANG variable is tested, but a list of variables given as
    460         envvars parameter. The first found to be defined will be
    461         used. envvars defaults to the search path used in GNU gettext;
    462         it must always contain the variable name 'LANG'.
    463 
    464         Except for the code 'C', the language code corresponds to RFC
    465         1766.  code and encoding can be None in case the values cannot
    466         be determined.
    467 
    468     """
    469 
    470     try:
    471         # check if it's supported by the _locale module

    472         import _locale
    473         code, encoding = _locale._getdefaultlocale()
    474     except (ImportError, AttributeError):
    475         pass
    476     else:
    477         # make sure the code/encoding values are valid

    478         if sys.platform == "win32" and code and code[:2] == "0x":
    479             # map windows language identifier to language name

    480             code = windows_locale.get(int(code, 0))
    481         # ...add other platform-specific processing here, if

    482         # necessary...

    483         return code, encoding
    484 
    485     # fall back on POSIX behaviour

    486     import os
    487     lookup = os.environ.get
    488     for variable in envvars:
    489         localename = lookup(variable,None)
    490         if localename:
    491             if variable == 'LANGUAGE':
    492                 localename = localename.split(':')[0]
    493             break
    494     else:
    495         localename = 'C'
    496     return _parse_localename(localename)
    497 
    498 
    499 def getlocale(category=LC_CTYPE):
    500 
    501     """ Returns the current setting for the given locale category as
    502         tuple (language code, encoding).
    503 
    504         category may be one of the LC_* value except LC_ALL. It
    505         defaults to LC_CTYPE.
    506 
    507         Except for the code 'C', the language code corresponds to RFC
    508         1766.  code and encoding can be None in case the values cannot
    509         be determined.
    510 
    511     """
    512     localename = _setlocale(category)
    513     if category == LC_ALL and ';' in localename:
    514         raise TypeError, 'category LC_ALL is not supported'
    515     return _parse_localename(localename)
    516 
    517 def setlocale(category, locale=None):
    518 
    519     """ Set the locale for the given category.  The locale can be
    520         a string, a locale tuple (language code, encoding), or None.
    521 
    522         Locale tuples are converted to strings the locale aliasing
    523         engine.  Locale strings are passed directly to the C lib.
    524 
    525         category may be given as one of the LC_* values.
    526 
    527     """
    528     if locale and type(locale) is not type(""):
    529         # convert to string

    530         locale = normalize(_build_localename(locale))
    531     return _setlocale(category, locale)
    532 
    533 def resetlocale(category=LC_ALL):
    534 
    535     """ Sets the locale for category to the default setting.
    536 
    537         The default setting is determined by calling
    538         getdefaultlocale(). category defaults to LC_ALL.
    539 
    540     """
    541     _setlocale(category, _build_localename(getdefaultlocale()))
    542 
    543 if sys.platform.startswith("win"):
    544     # On Win32, this will return the ANSI code page

    545     def getpreferredencoding(do_setlocale = True):
    546         """Return the charset that the user is likely using."""
    547         import _locale
    548         return _locale._getdefaultlocale()[1]
    549 else:
    550     # On Unix, if CODESET is available, use that.

    551     try:
    552         CODESET
    553     except NameError:
    554         # Fall back to parsing environment variables :-(

    555         def getpreferredencoding(do_setlocale = True):
    556             """Return the charset that the user is likely using,
    557             by looking at environment variables."""
    558             return getdefaultlocale()[1]
    559     else:
    560         def getpreferredencoding(do_setlocale = True):
    561             """Return the charset that the user is likely using,
    562             according to the system configuration."""
    563             if do_setlocale:
    564                 oldloc = setlocale(LC_CTYPE)
    565                 try:
    566                     setlocale(LC_CTYPE, "")
    567                 except Error:
    568                     pass
    569                 result = nl_langinfo(CODESET)
    570                 setlocale(LC_CTYPE, oldloc)
    571                 return result
    572             else:
    573                 return nl_langinfo(CODESET)
    574 
    575 
    576 ### Database

    577 #

    578 # The following data was extracted from the locale.alias file which

    579 # comes with X11 and then hand edited removing the explicit encoding

    580 # definitions and adding some more aliases. The file is usually

    581 # available as /usr/lib/X11/locale/locale.alias.

    582 #

    583 
    584 #

    585 # The local_encoding_alias table maps lowercase encoding alias names

    586 # to C locale encoding names (case-sensitive). Note that normalize()

    587 # first looks up the encoding in the encodings.aliases dictionary and

    588 # then applies this mapping to find the correct C lib name for the

    589 # encoding.

    590 #

    591 locale_encoding_alias = {
    592 
    593     # Mappings for non-standard encoding names used in locale names

    594     '437':                          'C',
    595     'c':                            'C',
    596     'en':                           'ISO8859-1',
    597     'jis':                          'JIS7',
    598     'jis7':                         'JIS7',
    599     'ajec':                         'eucJP',
    600 
    601     # Mappings from Python codec names to C lib encoding names

    602     'ascii':                        'ISO8859-1',
    603     'latin_1':                      'ISO8859-1',
    604     'iso8859_1':                    'ISO8859-1',
    605     'iso8859_10':                   'ISO8859-10',
    606     'iso8859_11':                   'ISO8859-11',
    607     'iso8859_13':                   'ISO8859-13',
    608     'iso8859_14':                   'ISO8859-14',
    609     'iso8859_15':                   'ISO8859-15',
    610     'iso8859_16':                   'ISO8859-16',
    611     'iso8859_2':                    'ISO8859-2',
    612     'iso8859_3':                    'ISO8859-3',
    613     'iso8859_4':                    'ISO8859-4',
    614     'iso8859_5':                    'ISO8859-5',
    615     'iso8859_6':                    'ISO8859-6',
    616     'iso8859_7':                    'ISO8859-7',
    617     'iso8859_8':                    'ISO8859-8',
    618     'iso8859_9':                    'ISO8859-9',
    619     'iso2022_jp':                   'JIS7',
    620     'shift_jis':                    'SJIS',
    621     'tactis':                       'TACTIS',
    622     'euc_jp':                       'eucJP',
    623     'euc_kr':                       'eucKR',
    624     'utf_8':                        'UTF-8',
    625     'koi8_r':                       'KOI8-R',
    626     'koi8_u':                       'KOI8-U',
    627     # XXX This list is still incomplete. If you know more

    628     # mappings, please file a bug report. Thanks.

    629 }
    630 
    631 #

    632 # The locale_alias table maps lowercase alias names to C locale names

    633 # (case-sensitive). Encodings are always separated from the locale

    634 # name using a dot ('.'); they should only be given in case the

    635 # language name is needed to interpret the given encoding alias

    636 # correctly (CJK codes often have this need).

    637 #

    638 # Note that the normalize() function which uses this tables

    639 # removes '_' and '-' characters from the encoding part of the

    640 # locale name before doing the lookup. This saves a lot of

    641 # space in the table.

    642 #

    643 # MAL 2004-12-10:

    644 # Updated alias mapping to most recent locale.alias file

    645 # from X.org distribution using makelocalealias.py.

    646 #

    647 # These are the differences compared to the old mapping (Python 2.4

    648 # and older):

    649 #

    650 #    updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'

    651 #    updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'

    652 #    updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'

    653 #    updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'

    654 #    updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'

    655 #    updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'

    656 #    updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1'

    657 #    updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'

    658 #    updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'

    659 #    updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'

    660 #    updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'

    661 #    updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'

    662 #    updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'

    663 #    updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP'

    664 #    updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13'

    665 #    updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13'

    666 #    updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'

    667 #    updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'

    668 #    updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11'

    669 #    updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312'

    670 #    updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5'

    671 #    updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5'

    672 #

    673 # MAL 2008-05-30:

    674 # Updated alias mapping to most recent locale.alias file

    675 # from X.org distribution using makelocalealias.py.

    676 #

    677 # These are the differences compared to the old mapping (Python 2.5

    678 # and older):

    679 #

    680 #    updated 'cs_cs.iso88592' -> 'cs_CZ.ISO8859-2' to 'cs_CS.ISO8859-2'

    681 #    updated 'serbocroatian' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'

    682 #    updated 'sh' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'

    683 #    updated 'sh_hr.iso88592' -> 'sh_HR.ISO8859-2' to 'hr_HR.ISO8859-2'

    684 #    updated 'sh_sp' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'

    685 #    updated 'sh_yu' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'

    686 #    updated 'sp' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'

    687 #    updated 'sp_yu' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'

    688 #    updated 'sr' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'

    689 #    updated 'sr@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'

    690 #    updated 'sr_sp' -> 'sr_SP.ISO8859-2' to 'sr_CS.ISO8859-2'

    691 #    updated 'sr_yu' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'

    692 #    updated 'sr_yu.cp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'

    693 #    updated 'sr_yu.iso88592' -> 'sr_YU.ISO8859-2' to 'sr_CS.ISO8859-2'

    694 #    updated 'sr_yu.iso88595' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'

    695 #    updated 'sr_yu.iso88595@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'

    696 #    updated 'sr_yu.microsoftcp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'

    697 #    updated 'sr_yu.utf8@cyrillic' -> 'sr_YU.UTF-8' to 'sr_CS.UTF-8'

    698 #    updated 'sr_yu@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'

    699 #

    700 # AP 2010-04-12:

    701 # Updated alias mapping to most recent locale.alias file

    702 # from X.org distribution using makelocalealias.py.

    703 #

    704 # These are the differences compared to the old mapping (Python 2.6.5

    705 # and older):

    706 #

    707 #    updated 'ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'

    708 #    updated 'ru_ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'

    709 #    updated 'serbocroatian' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'

    710 #    updated 'sh' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'

    711 #    updated 'sh_yu' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'

    712 #    updated 'sr' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'

    713 #    updated 'sr@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'

    714 #    updated 'sr@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'

    715 #    updated 'sr_cs.utf8@latn' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8@latin'

    716 #    updated 'sr_cs@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'

    717 #    updated 'sr_yu' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8@latin'

    718 #    updated 'sr_yu.utf8@cyrillic' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8'

    719 #    updated 'sr_yu@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'

    720 #

    721 
    722 locale_alias = {
    723     'a3':                                   'a3_AZ.KOI8-C',
    724     'a3_az':                                'a3_AZ.KOI8-C',
    725     'a3_az.koi8c':                          'a3_AZ.KOI8-C',
    726     'af':                                   'af_ZA.ISO8859-1',
    727     'af_za':                                'af_ZA.ISO8859-1',
    728     'af_za.iso88591':                       'af_ZA.ISO8859-1',
    729     'am':                                   'am_ET.UTF-8',
    730     'am_et':                                'am_ET.UTF-8',
    731     'american':                             'en_US.ISO8859-1',
    732     'american.iso88591':                    'en_US.ISO8859-1',
    733     'ar':                                   'ar_AA.ISO8859-6',
    734     'ar_aa':                                'ar_AA.ISO8859-6',
    735     'ar_aa.iso88596':                       'ar_AA.ISO8859-6',
    736     'ar_ae':                                'ar_AE.ISO8859-6',
    737     'ar_ae.iso88596':                       'ar_AE.ISO8859-6',
    738     'ar_bh':                                'ar_BH.ISO8859-6',
    739     'ar_bh.iso88596':                       'ar_BH.ISO8859-6',
    740     'ar_dz':                                'ar_DZ.ISO8859-6',
    741     'ar_dz.iso88596':                       'ar_DZ.ISO8859-6',
    742     'ar_eg':                                'ar_EG.ISO8859-6',
    743     'ar_eg.iso88596':                       'ar_EG.ISO8859-6',
    744     'ar_iq':                                'ar_IQ.ISO8859-6',
    745     'ar_iq.iso88596':                       'ar_IQ.ISO8859-6',
    746     'ar_jo':                                'ar_JO.ISO8859-6',
    747     'ar_jo.iso88596':                       'ar_JO.ISO8859-6',
    748     'ar_kw':                                'ar_KW.ISO8859-6',
    749     'ar_kw.iso88596':                       'ar_KW.ISO8859-6',
    750     'ar_lb':                                'ar_LB.ISO8859-6',
    751     'ar_lb.iso88596':                       'ar_LB.ISO8859-6',
    752     'ar_ly':                                'ar_LY.ISO8859-6',
    753     'ar_ly.iso88596':                       'ar_LY.ISO8859-6',
    754     'ar_ma':                                'ar_MA.ISO8859-6',
    755     'ar_ma.iso88596':                       'ar_MA.ISO8859-6',
    756     'ar_om':                                'ar_OM.ISO8859-6',
    757     'ar_om.iso88596':                       'ar_OM.ISO8859-6',
    758     'ar_qa':                                'ar_QA.ISO8859-6',
    759     'ar_qa.iso88596':                       'ar_QA.ISO8859-6',
    760     'ar_sa':                                'ar_SA.ISO8859-6',
    761     'ar_sa.iso88596':                       'ar_SA.ISO8859-6',
    762     'ar_sd':                                'ar_SD.ISO8859-6',
    763     'ar_sd.iso88596':                       'ar_SD.ISO8859-6',
    764     'ar_sy':                                'ar_SY.ISO8859-6',
    765     'ar_sy.iso88596':                       'ar_SY.ISO8859-6',
    766     'ar_tn':                                'ar_TN.ISO8859-6',
    767     'ar_tn.iso88596':                       'ar_TN.ISO8859-6',
    768     'ar_ye':                                'ar_YE.ISO8859-6',
    769     'ar_ye.iso88596':                       'ar_YE.ISO8859-6',
    770     'arabic':                               'ar_AA.ISO8859-6',
    771     'arabic.iso88596':                      'ar_AA.ISO8859-6',
    772     'as':                                   'as_IN.UTF-8',
    773     'az':                                   'az_AZ.ISO8859-9E',
    774     'az_az':                                'az_AZ.ISO8859-9E',
    775     'az_az.iso88599e':                      'az_AZ.ISO8859-9E',
    776     'be':                                   'be_BY.CP1251',
    777     'be@latin':                             'be_BY.UTF-8@latin',
    778     'be_by':                                'be_BY.CP1251',
    779     'be_by.cp1251':                         'be_BY.CP1251',
    780     'be_by.microsoftcp1251':                'be_BY.CP1251',
    781     'be_by.utf8@latin':                     'be_BY.UTF-8@latin',
    782     'be_by@latin':                          'be_BY.UTF-8@latin',
    783     'bg':                                   'bg_BG.CP1251',
    784     'bg_bg':                                'bg_BG.CP1251',
    785     'bg_bg.cp1251':                         'bg_BG.CP1251',
    786     'bg_bg.iso88595':                       'bg_BG.ISO8859-5',
    787     'bg_bg.koi8r':                          'bg_BG.KOI8-R',
    788     'bg_bg.microsoftcp1251':                'bg_BG.CP1251',
    789     'bn_in':                                'bn_IN.UTF-8',
    790     'bokmal':                               'nb_NO.ISO8859-1',
    791     'bokm\xe5l':                            'nb_NO.ISO8859-1',
    792     'br':                                   'br_FR.ISO8859-1',
    793     'br_fr':                                'br_FR.ISO8859-1',
    794     'br_fr.iso88591':                       'br_FR.ISO8859-1',
    795     'br_fr.iso885914':                      'br_FR.ISO8859-14',
    796     'br_fr.iso885915':                      'br_FR.ISO8859-15',
    797     'br_fr.iso885915@euro':                 'br_FR.ISO8859-15',
    798     'br_fr.utf8@euro':                      'br_FR.UTF-8',
    799     'br_fr@euro':                           'br_FR.ISO8859-15',
    800     'bs':                                   'bs_BA.ISO8859-2',
    801     'bs_ba':                                'bs_BA.ISO8859-2',
    802     'bs_ba.iso88592':                       'bs_BA.ISO8859-2',
    803     'bulgarian':                            'bg_BG.CP1251',
    804     'c':                                    'C',
    805     'c-french':                             'fr_CA.ISO8859-1',
    806     'c-french.iso88591':                    'fr_CA.ISO8859-1',
    807     'c.en':                                 'C',
    808     'c.iso88591':                           'en_US.ISO8859-1',
    809     'c_c':                                  'C',
    810     'c_c.c':                                'C',
    811     'ca':                                   'ca_ES.ISO8859-1',
    812     'ca_ad':                                'ca_AD.ISO8859-1',
    813     'ca_ad.iso88591':                       'ca_AD.ISO8859-1',
    814     'ca_ad.iso885915':                      'ca_AD.ISO8859-15',
    815     'ca_ad.iso885915@euro':                 'ca_AD.ISO8859-15',
    816     'ca_ad.utf8@euro':                      'ca_AD.UTF-8',
    817     'ca_ad@euro':                           'ca_AD.ISO8859-15',
    818     'ca_es':                                'ca_ES.ISO8859-1',
    819     'ca_es.iso88591':                       'ca_ES.ISO8859-1',
    820     'ca_es.iso885915':                      'ca_ES.ISO8859-15',
    821     'ca_es.iso885915@euro':                 'ca_ES.ISO8859-15',
    822     'ca_es.utf8@euro':                      'ca_ES.UTF-8',
    823     'ca_es@euro':                           'ca_ES.ISO8859-15',
    824     'ca_fr':                                'ca_FR.ISO8859-1',
    825     'ca_fr.iso88591':                       'ca_FR.ISO8859-1',
    826     'ca_fr.iso885915':                      'ca_FR.ISO8859-15',
    827     'ca_fr.iso885915@euro':                 'ca_FR.ISO8859-15',
    828     'ca_fr.utf8@euro':                      'ca_FR.UTF-8',
    829     'ca_fr@euro':                           'ca_FR.ISO8859-15',
    830     'ca_it':                                'ca_IT.ISO8859-1',
    831     'ca_it.iso88591':                       'ca_IT.ISO8859-1',
    832     'ca_it.iso885915':                      'ca_IT.ISO8859-15',
    833     'ca_it.iso885915@euro':                 'ca_IT.ISO8859-15',
    834     'ca_it.utf8@euro':                      'ca_IT.UTF-8',
    835     'ca_it@euro':                           'ca_IT.ISO8859-15',
    836     'catalan':                              'ca_ES.ISO8859-1',
    837     'cextend':                              'en_US.ISO8859-1',
    838     'cextend.en':                           'en_US.ISO8859-1',
    839     'chinese-s':                            'zh_CN.eucCN',
    840     'chinese-t':                            'zh_TW.eucTW',
    841     'croatian':                             'hr_HR.ISO8859-2',
    842     'cs':                                   'cs_CZ.ISO8859-2',
    843     'cs_cs':                                'cs_CZ.ISO8859-2',
    844     'cs_cs.iso88592':                       'cs_CS.ISO8859-2',
    845     'cs_cz':                                'cs_CZ.ISO8859-2',
    846     'cs_cz.iso88592':                       'cs_CZ.ISO8859-2',
    847     'cy':                                   'cy_GB.ISO8859-1',
    848     'cy_gb':                                'cy_GB.ISO8859-1',
    849     'cy_gb.iso88591':                       'cy_GB.ISO8859-1',
    850     'cy_gb.iso885914':                      'cy_GB.ISO8859-14',
    851     'cy_gb.iso885915':                      'cy_GB.ISO8859-15',
    852     'cy_gb@euro':                           'cy_GB.ISO8859-15',
    853     'cz':                                   'cs_CZ.ISO8859-2',
    854     'cz_cz':                                'cs_CZ.ISO8859-2',
    855     'czech':                                'cs_CZ.ISO8859-2',
    856     'da':                                   'da_DK.ISO8859-1',
    857     'da.iso885915':                         'da_DK.ISO8859-15',
    858     'da_dk':                                'da_DK.ISO8859-1',
    859     'da_dk.88591':                          'da_DK.ISO8859-1',
    860     'da_dk.885915':                         'da_DK.ISO8859-15',
    861     'da_dk.iso88591':                       'da_DK.ISO8859-1',
    862     'da_dk.iso885915':                      'da_DK.ISO8859-15',
    863     'da_dk@euro':                           'da_DK.ISO8859-15',
    864     'danish':                               'da_DK.ISO8859-1',
    865     'danish.iso88591':                      'da_DK.ISO8859-1',
    866     'dansk':                                'da_DK.ISO8859-1',
    867     'de':                                   'de_DE.ISO8859-1',
    868     'de.iso885915':                         'de_DE.ISO8859-15',
    869     'de_at':                                'de_AT.ISO8859-1',
    870     'de_at.iso88591':                       'de_AT.ISO8859-1',
    871     'de_at.iso885915':                      'de_AT.ISO8859-15',
    872     'de_at.iso885915@euro':                 'de_AT.ISO8859-15',
    873     'de_at.utf8@euro':                      'de_AT.UTF-8',
    874     'de_at@euro':                           'de_AT.ISO8859-15',
    875     'de_be':                                'de_BE.ISO8859-1',
    876     'de_be.iso88591':                       'de_BE.ISO8859-1',
    877     'de_be.iso885915':                      'de_BE.ISO8859-15',
    878     'de_be.iso885915@euro':                 'de_BE.ISO8859-15',
    879     'de_be.utf8@euro':                      'de_BE.UTF-8',
    880     'de_be@euro':                           'de_BE.ISO8859-15',
    881     'de_ch':                                'de_CH.ISO8859-1',
    882     'de_ch.iso88591':                       'de_CH.ISO8859-1',
    883     'de_ch.iso885915':                      'de_CH.ISO8859-15',
    884     'de_ch@euro':                           'de_CH.ISO8859-15',
    885     'de_de':                                'de_DE.ISO8859-1',
    886     'de_de.88591':                          'de_DE.ISO8859-1',
    887     'de_de.885915':                         'de_DE.ISO8859-15',
    888     'de_de.885915@euro':                    'de_DE.ISO8859-15',
    889     'de_de.iso88591':                       'de_DE.ISO8859-1',
    890     'de_de.iso885915':                      'de_DE.ISO8859-15',
    891     'de_de.iso885915@euro':                 'de_DE.ISO8859-15',
    892     'de_de.utf8@euro':                      'de_DE.UTF-8',
    893     'de_de@euro':                           'de_DE.ISO8859-15',
    894     'de_lu':                                'de_LU.ISO8859-1',
    895     'de_lu.iso88591':                       'de_LU.ISO8859-1',
    896     'de_lu.iso885915':                      'de_LU.ISO8859-15',
    897     'de_lu.iso885915@euro':                 'de_LU.ISO8859-15',
    898     'de_lu.utf8@euro':                      'de_LU.UTF-8',
    899     'de_lu@euro':                           'de_LU.ISO8859-15',
    900     'deutsch':                              'de_DE.ISO8859-1',
    901     'dutch':                                'nl_NL.ISO8859-1',
    902     'dutch.iso88591':                       'nl_BE.ISO8859-1',
    903     'ee':                                   'ee_EE.ISO8859-4',
    904     'ee_ee':                                'ee_EE.ISO8859-4',
    905     'ee_ee.iso88594':                       'ee_EE.ISO8859-4',
    906     'eesti':                                'et_EE.ISO8859-1',
    907     'el':                                   'el_GR.ISO8859-7',
    908     'el_gr':                                'el_GR.ISO8859-7',
    909     'el_gr.iso88597':                       'el_GR.ISO8859-7',
    910     'el_gr@euro':                           'el_GR.ISO8859-15',
    911     'en':                                   'en_US.ISO8859-1',
    912     'en.iso88591':                          'en_US.ISO8859-1',
    913     'en_au':                                'en_AU.ISO8859-1',
    914     'en_au.iso88591':                       'en_AU.ISO8859-1',
    915     'en_be':                                'en_BE.ISO8859-1',
    916     'en_be@euro':                           'en_BE.ISO8859-15',
    917     'en_bw':                                'en_BW.ISO8859-1',
    918     'en_bw.iso88591':                       'en_BW.ISO8859-1',
    919     'en_ca':                                'en_CA.ISO8859-1',
    920     'en_ca.iso88591':                       'en_CA.ISO8859-1',
    921     'en_gb':                                'en_GB.ISO8859-1',
    922     'en_gb.88591':                          'en_GB.ISO8859-1',
    923     'en_gb.iso88591':                       'en_GB.ISO8859-1',
    924     'en_gb.iso885915':                      'en_GB.ISO8859-15',
    925     'en_gb@euro':                           'en_GB.ISO8859-15',
    926     'en_hk':                                'en_HK.ISO8859-1',
    927     'en_hk.iso88591':                       'en_HK.ISO8859-1',
    928     'en_ie':                                'en_IE.ISO8859-1',
    929     'en_ie.iso88591':                       'en_IE.ISO8859-1',
    930     'en_ie.iso885915':                      'en_IE.ISO8859-15',
    931     'en_ie.iso885915@euro':                 'en_IE.ISO8859-15',
    932     'en_ie.utf8@euro':                      'en_IE.UTF-8',
    933     'en_ie@euro':                           'en_IE.ISO8859-15',
    934     'en_in':                                'en_IN.ISO8859-1',
    935     'en_nz':                                'en_NZ.ISO8859-1',
    936     'en_nz.iso88591':                       'en_NZ.ISO8859-1',
    937     'en_ph':                                'en_PH.ISO8859-1',
    938     'en_ph.iso88591':                       'en_PH.ISO8859-1',
    939     'en_sg':                                'en_SG.ISO8859-1',
    940     'en_sg.iso88591':                       'en_SG.ISO8859-1',
    941     'en_uk':                                'en_GB.ISO8859-1',
    942     'en_us':                                'en_US.ISO8859-1',
    943     'en_us.88591':                          'en_US.ISO8859-1',
    944     'en_us.885915':                         'en_US.ISO8859-15',
    945     'en_us.iso88591':                       'en_US.ISO8859-1',
    946     'en_us.iso885915':                      'en_US.ISO8859-15',
    947     'en_us.iso885915@euro':                 'en_US.ISO8859-15',
    948     'en_us@euro':                           'en_US.ISO8859-15',
    949     'en_us@euro@euro':                      'en_US.ISO8859-15',
    950     'en_za':                                'en_ZA.ISO8859-1',
    951     'en_za.88591':                          'en_ZA.ISO8859-1',
    952     'en_za.iso88591':                       'en_ZA.ISO8859-1',
    953     'en_za.iso885915':                      'en_ZA.ISO8859-15',
    954     'en_za@euro':                           'en_ZA.ISO8859-15',
    955     'en_zw':                                'en_ZW.ISO8859-1',
    956     'en_zw.iso88591':                       'en_ZW.ISO8859-1',
    957     'eng_gb':                               'en_GB.ISO8859-1',
    958     'eng_gb.8859':                          'en_GB.ISO8859-1',
    959     'english':                              'en_EN.ISO8859-1',
    960     'english.iso88591':                     'en_EN.ISO8859-1',
    961     'english_uk':                           'en_GB.ISO8859-1',
    962     'english_uk.8859':                      'en_GB.ISO8859-1',
    963     'english_united-states':                'en_US.ISO8859-1',
    964     'english_united-states.437':            'C',
    965     'english_us':                           'en_US.ISO8859-1',
    966     'english_us.8859':                      'en_US.ISO8859-1',
    967     'english_us.ascii':                     'en_US.ISO8859-1',
    968     'eo':                                   'eo_XX.ISO8859-3',
    969     'eo_eo':                                'eo_EO.ISO8859-3',
    970     'eo_eo.iso88593':                       'eo_EO.ISO8859-3',
    971     'eo_xx':                                'eo_XX.ISO8859-3',
    972     'eo_xx.iso88593':                       'eo_XX.ISO8859-3',
    973     'es':                                   'es_ES.ISO8859-1',
    974     'es_ar':                                'es_AR.ISO8859-1',
    975     'es_ar.iso88591':                       'es_AR.ISO8859-1',
    976     'es_bo':                                'es_BO.ISO8859-1',
    977     'es_bo.iso88591':                       'es_BO.ISO8859-1',
    978     'es_cl':                                'es_CL.ISO8859-1',
    979     'es_cl.iso88591':                       'es_CL.ISO8859-1',
    980     'es_co':                                'es_CO.ISO8859-1',
    981     'es_co.iso88591':                       'es_CO.ISO8859-1',
    982     'es_cr':                                'es_CR.ISO8859-1',
    983     'es_cr.iso88591':                       'es_CR.ISO8859-1',
    984     'es_do':                                'es_DO.ISO8859-1',
    985     'es_do.iso88591':                       'es_DO.ISO8859-1',
    986     'es_ec':                                'es_EC.ISO8859-1',
    987     'es_ec.iso88591':                       'es_EC.ISO8859-1',
    988     'es_es':                                'es_ES.ISO8859-1',
    989     'es_es.88591':                          'es_ES.ISO8859-1',
    990     'es_es.iso88591':                       'es_ES.ISO8859-1',
    991     'es_es.iso885915':                      'es_ES.ISO8859-15',
    992     'es_es.iso885915@euro':                 'es_ES.ISO8859-15',
    993     'es_es.utf8@euro':                      'es_ES.UTF-8',
    994     'es_es@euro':                           'es_ES.ISO8859-15',
    995     'es_gt':                                'es_GT.ISO8859-1',
    996     'es_gt.iso88591':                       'es_GT.ISO8859-1',
    997     'es_hn':                                'es_HN.ISO8859-1',
    998     'es_hn.iso88591':                       'es_HN.ISO8859-1',
    999     'es_mx':                                'es_MX.ISO8859-1',
   1000     'es_mx.iso88591':                       'es_MX.ISO8859-1',
   1001     'es_ni':                                'es_NI.ISO8859-1',
   1002     'es_ni.iso88591':                       'es_NI.ISO8859-1',
   1003     'es_pa':                                'es_PA.ISO8859-1',
   1004     'es_pa.iso88591':                       'es_PA.ISO8859-1',
   1005     'es_pa.iso885915':                      'es_PA.ISO8859-15',
   1006     'es_pa@euro':                           'es_PA.ISO8859-15',
   1007     'es_pe':                                'es_PE.ISO8859-1',
   1008     'es_pe.iso88591':                       'es_PE.ISO8859-1',
   1009     'es_pe.iso885915':                      'es_PE.ISO8859-15',
   1010     'es_pe@euro':                           'es_PE.ISO8859-15',
   1011     'es_pr':                                'es_PR.ISO8859-1',
   1012     'es_pr.iso88591':                       'es_PR.ISO8859-1',
   1013     'es_py':                                'es_PY.ISO8859-1',
   1014     'es_py.iso88591':                       'es_PY.ISO8859-1',
   1015     'es_py.iso885915':                      'es_PY.ISO8859-15',
   1016     'es_py@euro':                           'es_PY.ISO8859-15',
   1017     'es_sv':                                'es_SV.ISO8859-1',
   1018     'es_sv.iso88591':                       'es_SV.ISO8859-1',
   1019     'es_sv.iso885915':                      'es_SV.ISO8859-15',
   1020     'es_sv@euro':                           'es_SV.ISO8859-15',
   1021     'es_us':                                'es_US.ISO8859-1',
   1022     'es_us.iso88591':                       'es_US.ISO8859-1',
   1023     'es_uy':                                'es_UY.ISO8859-1',
   1024     'es_uy.iso88591':                       'es_UY.ISO8859-1',
   1025     'es_uy.iso885915':                      'es_UY.ISO8859-15',
   1026     'es_uy@euro':                           'es_UY.ISO8859-15',
   1027     'es_ve':                                'es_VE.ISO8859-1',
   1028     'es_ve.iso88591':                       'es_VE.ISO8859-1',
   1029     'es_ve.iso885915':                      'es_VE.ISO8859-15',
   1030     'es_ve@euro':                           'es_VE.ISO8859-15',
   1031     'estonian':                             'et_EE.ISO8859-1',
   1032     'et':                                   'et_EE.ISO8859-15',
   1033     'et_ee':                                'et_EE.ISO8859-15',
   1034     'et_ee.iso88591':                       'et_EE.ISO8859-1',
   1035     'et_ee.iso885913':                      'et_EE.ISO8859-13',
   1036     'et_ee.iso885915':                      'et_EE.ISO8859-15',
   1037     'et_ee.iso88594':                       'et_EE.ISO8859-4',
   1038     'et_ee@euro':                           'et_EE.ISO8859-15',
   1039     'eu':                                   'eu_ES.ISO8859-1',
   1040     'eu_es':                                'eu_ES.ISO8859-1',
   1041     'eu_es.iso88591':                       'eu_ES.ISO8859-1',
   1042     'eu_es.iso885915':                      'eu_ES.ISO8859-15',
   1043     'eu_es.iso885915@euro':                 'eu_ES.ISO8859-15',
   1044     'eu_es.utf8@euro':                      'eu_ES.UTF-8',
   1045     'eu_es@euro':                           'eu_ES.ISO8859-15',
   1046     'fa':                                   'fa_IR.UTF-8',
   1047     'fa_ir':                                'fa_IR.UTF-8',
   1048     'fa_ir.isiri3342':                      'fa_IR.ISIRI-3342',
   1049     'fi':                                   'fi_FI.ISO8859-15',
   1050     'fi.iso885915':                         'fi_FI.ISO8859-15',
   1051     'fi_fi':                                'fi_FI.ISO8859-15',
   1052     'fi_fi.88591':                          'fi_FI.ISO8859-1',
   1053     'fi_fi.iso88591':                       'fi_FI.ISO8859-1',
   1054     'fi_fi.iso885915':                      'fi_FI.ISO8859-15',
   1055     'fi_fi.iso885915@euro':                 'fi_FI.ISO8859-15',
   1056     'fi_fi.utf8@euro':                      'fi_FI.UTF-8',
   1057     'fi_fi@euro':                           'fi_FI.ISO8859-15',
   1058     'finnish':                              'fi_FI.ISO8859-1',
   1059     'finnish.iso88591':                     'fi_FI.ISO8859-1',
   1060     'fo':                                   'fo_FO.ISO8859-1',
   1061     'fo_fo':                                'fo_FO.ISO8859-1',
   1062     'fo_fo.iso88591':                       'fo_FO.ISO8859-1',
   1063     'fo_fo.iso885915':                      'fo_FO.ISO8859-15',
   1064     'fo_fo@euro':                           'fo_FO.ISO8859-15',
   1065     'fr':                                   'fr_FR.ISO8859-1',
   1066     'fr.iso885915':                         'fr_FR.ISO8859-15',
   1067     'fr_be':                                'fr_BE.ISO8859-1',
   1068     'fr_be.88591':                          'fr_BE.ISO8859-1',
   1069     'fr_be.iso88591':                       'fr_BE.ISO8859-1',
   1070     'fr_be.iso885915':                      'fr_BE.ISO8859-15',
   1071     'fr_be.iso885915@euro':                 'fr_BE.ISO8859-15',
   1072     'fr_be.utf8@euro':                      'fr_BE.UTF-8',
   1073     'fr_be@euro':                           'fr_BE.ISO8859-15',
   1074     'fr_ca':                                'fr_CA.ISO8859-1',
   1075     'fr_ca.88591':                          'fr_CA.ISO8859-1',
   1076     'fr_ca.iso88591':                       'fr_CA.ISO8859-1',
   1077     'fr_ca.iso885915':                      'fr_CA.ISO8859-15',
   1078     'fr_ca@euro':                           'fr_CA.ISO8859-15',
   1079     'fr_ch':                                'fr_CH.ISO8859-1',
   1080     'fr_ch.88591':                          'fr_CH.ISO8859-1',
   1081     'fr_ch.iso88591':                       'fr_CH.ISO8859-1',
   1082     'fr_ch.iso885915':                      'fr_CH.ISO8859-15',
   1083     'fr_ch@euro':                           'fr_CH.ISO8859-15',
   1084     'fr_fr':                                'fr_FR.ISO8859-1',
   1085     'fr_fr.88591':                          'fr_FR.ISO8859-1',
   1086     'fr_fr.iso88591':                       'fr_FR.ISO8859-1',
   1087     'fr_fr.iso885915':                      'fr_FR.ISO8859-15',
   1088     'fr_fr.iso885915@euro':                 'fr_FR.ISO8859-15',
   1089     'fr_fr.utf8@euro':                      'fr_FR.UTF-8',
   1090     'fr_fr@euro':                           'fr_FR.ISO8859-15',
   1091     'fr_lu':                                'fr_LU.ISO8859-1',
   1092     'fr_lu.88591':                          'fr_LU.ISO8859-1',
   1093     'fr_lu.iso88591':                       'fr_LU.ISO8859-1',
   1094     'fr_lu.iso885915':                      'fr_LU.ISO8859-15',
   1095     'fr_lu.iso885915@euro':                 'fr_LU.ISO8859-15',
   1096     'fr_lu.utf8@euro':                      'fr_LU.UTF-8',
   1097     'fr_lu@euro':                           'fr_LU.ISO8859-15',
   1098     'fran\xe7ais':                          'fr_FR.ISO8859-1',
   1099     'fre_fr':                               'fr_FR.ISO8859-1',
   1100     'fre_fr.8859':                          'fr_FR.ISO8859-1',
   1101     'french':                               'fr_FR.ISO8859-1',
   1102     'french.iso88591':                      'fr_CH.ISO8859-1',
   1103     'french_france':                        'fr_FR.ISO8859-1',
   1104     'french_france.8859':                   'fr_FR.ISO8859-1',
   1105     'ga':                                   'ga_IE.ISO8859-1',
   1106     'ga_ie':                                'ga_IE.ISO8859-1',
   1107     'ga_ie.iso88591':                       'ga_IE.ISO8859-1',
   1108     'ga_ie.iso885914':                      'ga_IE.ISO8859-14',
   1109     'ga_ie.iso885915':                      'ga_IE.ISO8859-15',
   1110     'ga_ie.iso885915@euro':                 'ga_IE.ISO8859-15',
   1111     'ga_ie.utf8@euro':                      'ga_IE.UTF-8',
   1112     'ga_ie@euro':                           'ga_IE.ISO8859-15',
   1113     'galego':                               'gl_ES.ISO8859-1',
   1114     'galician':                             'gl_ES.ISO8859-1',
   1115     'gd':                                   'gd_GB.ISO8859-1',
   1116     'gd_gb':                                'gd_GB.ISO8859-1',
   1117     'gd_gb.iso88591':                       'gd_GB.ISO8859-1',
   1118     'gd_gb.iso885914':                      'gd_GB.ISO8859-14',
   1119     'gd_gb.iso885915':                      'gd_GB.ISO8859-15',
   1120     'gd_gb@euro':                           'gd_GB.ISO8859-15',
   1121     'ger_de':                               'de_DE.ISO8859-1',
   1122     'ger_de.8859':                          'de_DE.ISO8859-1',
   1123     'german':                               'de_DE.ISO8859-1',
   1124     'german.iso88591':                      'de_CH.ISO8859-1',
   1125     'german_germany':                       'de_DE.ISO8859-1',
   1126     'german_germany.8859':                  'de_DE.ISO8859-1',
   1127     'gl':                                   'gl_ES.ISO8859-1',
   1128     'gl_es':                                'gl_ES.ISO8859-1',
   1129     'gl_es.iso88591':                       'gl_ES.ISO8859-1',
   1130     'gl_es.iso885915':                      'gl_ES.ISO8859-15',
   1131     'gl_es.iso885915@euro':                 'gl_ES.ISO8859-15',
   1132     'gl_es.utf8@euro':                      'gl_ES.UTF-8',
   1133     'gl_es@euro':                           'gl_ES.ISO8859-15',
   1134     'greek':                                'el_GR.ISO8859-7',
   1135     'greek.iso88597':                       'el_GR.ISO8859-7',
   1136     'gu_in':                                'gu_IN.UTF-8',
   1137     'gv':                                   'gv_GB.ISO8859-1',
   1138     'gv_gb':                                'gv_GB.ISO8859-1',
   1139     'gv_gb.iso88591':                       'gv_GB.ISO8859-1',
   1140     'gv_gb.iso885914':                      'gv_GB.ISO8859-14',
   1141     'gv_gb.iso885915':                      'gv_GB.ISO8859-15',
   1142     'gv_gb@euro':                           'gv_GB.ISO8859-15',
   1143     'he':                                   'he_IL.ISO8859-8',
   1144     'he_il':                                'he_IL.ISO8859-8',
   1145     'he_il.cp1255':                         'he_IL.CP1255',
   1146     'he_il.iso88598':                       'he_IL.ISO8859-8',
   1147     'he_il.microsoftcp1255':                'he_IL.CP1255',
   1148     'hebrew':                               'iw_IL.ISO8859-8',
   1149     'hebrew.iso88598':                      'iw_IL.ISO8859-8',
   1150     'hi':                                   'hi_IN.ISCII-DEV',
   1151     'hi_in':                                'hi_IN.ISCII-DEV',
   1152     'hi_in.isciidev':                       'hi_IN.ISCII-DEV',
   1153     'hne':                                  'hne_IN.UTF-8',
   1154     'hr':                                   'hr_HR.ISO8859-2',
   1155     'hr_hr':                                'hr_HR.ISO8859-2',
   1156     'hr_hr.iso88592':                       'hr_HR.ISO8859-2',
   1157     'hrvatski':                             'hr_HR.ISO8859-2',
   1158     'hu':                                   'hu_HU.ISO8859-2',
   1159     'hu_hu':                                'hu_HU.ISO8859-2',
   1160     'hu_hu.iso88592':                       'hu_HU.ISO8859-2',
   1161     'hungarian':                            'hu_HU.ISO8859-2',
   1162     'icelandic':                            'is_IS.ISO8859-1',
   1163     'icelandic.iso88591':                   'is_IS.ISO8859-1',
   1164     'id':                                   'id_ID.ISO8859-1',
   1165     'id_id':                                'id_ID.ISO8859-1',
   1166     'in':                                   'id_ID.ISO8859-1',
   1167     'in_id':                                'id_ID.ISO8859-1',
   1168     'is':                                   'is_IS.ISO8859-1',
   1169     'is_is':                                'is_IS.ISO8859-1',
   1170     'is_is.iso88591':                       'is_IS.ISO8859-1',
   1171     'is_is.iso885915':                      'is_IS.ISO8859-15',
   1172     'is_is@euro':                           'is_IS.ISO8859-15',
   1173     'iso-8859-1':                           'en_US.ISO8859-1',
   1174     'iso-8859-15':                          'en_US.ISO8859-15',
   1175     'iso8859-1':                            'en_US.ISO8859-1',
   1176     'iso8859-15':                           'en_US.ISO8859-15',
   1177     'iso_8859_1':                           'en_US.ISO8859-1',
   1178     'iso_8859_15':                          'en_US.ISO8859-15',
   1179     'it':                                   'it_IT.ISO8859-1',
   1180     'it.iso885915':                         'it_IT.ISO8859-15',
   1181     'it_ch':                                'it_CH.ISO8859-1',
   1182     'it_ch.iso88591':                       'it_CH.ISO8859-1',
   1183     'it_ch.iso885915':                      'it_CH.ISO8859-15',
   1184     'it_ch@euro':                           'it_CH.ISO8859-15',
   1185     'it_it':                                'it_IT.ISO8859-1',
   1186     'it_it.88591':                          'it_IT.ISO8859-1',
   1187     'it_it.iso88591':                       'it_IT.ISO8859-1',
   1188     'it_it.iso885915':                      'it_IT.ISO8859-15',
   1189     'it_it.iso885915@euro':                 'it_IT.ISO8859-15',
   1190     'it_it.utf8@euro':                      'it_IT.UTF-8',
   1191     'it_it@euro':                           'it_IT.ISO8859-15',
   1192     'italian':                              'it_IT.ISO8859-1',
   1193     'italian.iso88591':                     'it_IT.ISO8859-1',
   1194     'iu':                                   'iu_CA.NUNACOM-8',
   1195     'iu_ca':                                'iu_CA.NUNACOM-8',
   1196     'iu_ca.nunacom8':                       'iu_CA.NUNACOM-8',
   1197     'iw':                                   'he_IL.ISO8859-8',
   1198     'iw_il':                                'he_IL.ISO8859-8',
   1199     'iw_il.iso88598':                       'he_IL.ISO8859-8',
   1200     'ja':                                   'ja_JP.eucJP',
   1201     'ja.jis':                               'ja_JP.JIS7',
   1202     'ja.sjis':                              'ja_JP.SJIS',
   1203     'ja_jp':                                'ja_JP.eucJP',
   1204     'ja_jp.ajec':                           'ja_JP.eucJP',
   1205     'ja_jp.euc':                            'ja_JP.eucJP',
   1206     'ja_jp.eucjp':                          'ja_JP.eucJP',
   1207     'ja_jp.iso-2022-jp':                    'ja_JP.JIS7',
   1208     'ja_jp.iso2022jp':                      'ja_JP.JIS7',
   1209     'ja_jp.jis':                            'ja_JP.JIS7',
   1210     'ja_jp.jis7':                           'ja_JP.JIS7',
   1211     'ja_jp.mscode':                         'ja_JP.SJIS',
   1212     'ja_jp.pck':                            'ja_JP.SJIS',
   1213     'ja_jp.sjis':                           'ja_JP.SJIS',
   1214     'ja_jp.ujis':                           'ja_JP.eucJP',
   1215     'japan':                                'ja_JP.eucJP',
   1216     'japanese':                             'ja_JP.eucJP',
   1217     'japanese-euc':                         'ja_JP.eucJP',
   1218     'japanese.euc':                         'ja_JP.eucJP',
   1219     'japanese.sjis':                        'ja_JP.SJIS',
   1220     'jp_jp':                                'ja_JP.eucJP',
   1221     'ka':                                   'ka_GE.GEORGIAN-ACADEMY',
   1222     'ka_ge':                                'ka_GE.GEORGIAN-ACADEMY',
   1223     'ka_ge.georgianacademy':                'ka_GE.GEORGIAN-ACADEMY',
   1224     'ka_ge.georgianps':                     'ka_GE.GEORGIAN-PS',
   1225     'ka_ge.georgianrs':                     'ka_GE.GEORGIAN-ACADEMY',
   1226     'kl':                                   'kl_GL.ISO8859-1',
   1227     'kl_gl':                                'kl_GL.ISO8859-1',
   1228     'kl_gl.iso88591':                       'kl_GL.ISO8859-1',
   1229     'kl_gl.iso885915':                      'kl_GL.ISO8859-15',
   1230     'kl_gl@euro':                           'kl_GL.ISO8859-15',
   1231     'km_kh':                                'km_KH.UTF-8',
   1232     'kn':                                   'kn_IN.UTF-8',
   1233     'kn_in':                                'kn_IN.UTF-8',
   1234     'ko':                                   'ko_KR.eucKR',
   1235     'ko_kr':                                'ko_KR.eucKR',
   1236     'ko_kr.euc':                            'ko_KR.eucKR',
   1237     'ko_kr.euckr':                          'ko_KR.eucKR',
   1238     'korean':                               'ko_KR.eucKR',
   1239     'korean.euc':                           'ko_KR.eucKR',
   1240     'ks':                                   'ks_IN.UTF-8',
   1241     'ks_in@devanagari':                     'ks_IN (at] devanagari.UTF-8',
   1242     'kw':                                   'kw_GB.ISO8859-1',
   1243     'kw_gb':                                'kw_GB.ISO8859-1',
   1244     'kw_gb.iso88591':                       'kw_GB.ISO8859-1',
   1245     'kw_gb.iso885914':                      'kw_GB.ISO8859-14',
   1246     'kw_gb.iso885915':                      'kw_GB.ISO8859-15',
   1247     'kw_gb@euro':                           'kw_GB.ISO8859-15',
   1248     'ky':                                   'ky_KG.UTF-8',
   1249     'ky_kg':                                'ky_KG.UTF-8',
   1250     'lithuanian':                           'lt_LT.ISO8859-13',
   1251     'lo':                                   'lo_LA.MULELAO-1',
   1252     'lo_la':                                'lo_LA.MULELAO-1',
   1253     'lo_la.cp1133':                         'lo_LA.IBM-CP1133',
   1254     'lo_la.ibmcp1133':                      'lo_LA.IBM-CP1133',
   1255     'lo_la.mulelao1':                       'lo_LA.MULELAO-1',
   1256     'lt':                                   'lt_LT.ISO8859-13',
   1257     'lt_lt':                                'lt_LT.ISO8859-13',
   1258     'lt_lt.iso885913':                      'lt_LT.ISO8859-13',
   1259     'lt_lt.iso88594':                       'lt_LT.ISO8859-4',
   1260     'lv':                                   'lv_LV.ISO8859-13',
   1261     'lv_lv':                                'lv_LV.ISO8859-13',
   1262     'lv_lv.iso885913':                      'lv_LV.ISO8859-13',
   1263     'lv_lv.iso88594':                       'lv_LV.ISO8859-4',
   1264     'mai':                                  'mai_IN.UTF-8',
   1265     'mi':                                   'mi_NZ.ISO8859-1',
   1266     'mi_nz':                                'mi_NZ.ISO8859-1',
   1267     'mi_nz.iso88591':                       'mi_NZ.ISO8859-1',
   1268     'mk':                                   'mk_MK.ISO8859-5',
   1269     'mk_mk':                                'mk_MK.ISO8859-5',
   1270     'mk_mk.cp1251':                         'mk_MK.CP1251',
   1271     'mk_mk.iso88595':                       'mk_MK.ISO8859-5',
   1272     'mk_mk.microsoftcp1251':                'mk_MK.CP1251',
   1273     'ml':                                   'ml_IN.UTF-8',
   1274     'mr':                                   'mr_IN.UTF-8',
   1275     'mr_in':                                'mr_IN.UTF-8',
   1276     'ms':                                   'ms_MY.ISO8859-1',
   1277     'ms_my':                                'ms_MY.ISO8859-1',
   1278     'ms_my.iso88591':                       'ms_MY.ISO8859-1',
   1279     'mt':                                   'mt_MT.ISO8859-3',
   1280     'mt_mt':                                'mt_MT.ISO8859-3',
   1281     'mt_mt.iso88593':                       'mt_MT.ISO8859-3',
   1282     'nb':                                   'nb_NO.ISO8859-1',
   1283     'nb_no':                                'nb_NO.ISO8859-1',
   1284     'nb_no.88591':                          'nb_NO.ISO8859-1',
   1285     'nb_no.iso88591':                       'nb_NO.ISO8859-1',
   1286     'nb_no.iso885915':                      'nb_NO.ISO8859-15',
   1287     'nb_no@euro':                           'nb_NO.ISO8859-15',
   1288     'nl':                                   'nl_NL.ISO8859-1',
   1289     'nl.iso885915':                         'nl_NL.ISO8859-15',
   1290     'nl_be':                                'nl_BE.ISO8859-1',
   1291     'nl_be.88591':                          'nl_BE.ISO8859-1',
   1292     'nl_be.iso88591':                       'nl_BE.ISO8859-1',
   1293     'nl_be.iso885915':                      'nl_BE.ISO8859-15',
   1294     'nl_be.iso885915@euro':                 'nl_BE.ISO8859-15',
   1295     'nl_be.utf8@euro':                      'nl_BE.UTF-8',
   1296     'nl_be@euro':                           'nl_BE.ISO8859-15',
   1297     'nl_nl':                                'nl_NL.ISO8859-1',
   1298     'nl_nl.88591':                          'nl_NL.ISO8859-1',
   1299     'nl_nl.iso88591':                       'nl_NL.ISO8859-1',
   1300     'nl_nl.iso885915':                      'nl_NL.ISO8859-15',
   1301     'nl_nl.iso885915@euro':                 'nl_NL.ISO8859-15',
   1302     'nl_nl.utf8@euro':                      'nl_NL.UTF-8',
   1303     'nl_nl@euro':                           'nl_NL.ISO8859-15',
   1304     'nn':                                   'nn_NO.ISO8859-1',
   1305     'nn_no':                                'nn_NO.ISO8859-1',
   1306     'nn_no.88591':                          'nn_NO.ISO8859-1',
   1307     'nn_no.iso88591':                       'nn_NO.ISO8859-1',
   1308     'nn_no.iso885915':                      'nn_NO.ISO8859-15',
   1309     'nn_no@euro':                           'nn_NO.ISO8859-15',
   1310     'no':                                   'no_NO.ISO8859-1',
   1311     'no@nynorsk':                           'ny_NO.ISO8859-1',
   1312     'no_no':                                'no_NO.ISO8859-1',
   1313     'no_no.88591':                          'no_NO.ISO8859-1',
   1314     'no_no.iso88591':                       'no_NO.ISO8859-1',
   1315     'no_no.iso885915':                      'no_NO.ISO8859-15',
   1316     'no_no.iso88591@bokmal':                'no_NO.ISO8859-1',
   1317     'no_no.iso88591@nynorsk':               'no_NO.ISO8859-1',
   1318     'no_no@euro':                           'no_NO.ISO8859-15',
   1319     'norwegian':                            'no_NO.ISO8859-1',
   1320     'norwegian.iso88591':                   'no_NO.ISO8859-1',
   1321     'nr':                                   'nr_ZA.ISO8859-1',
   1322     'nr_za':                                'nr_ZA.ISO8859-1',
   1323     'nr_za.iso88591':                       'nr_ZA.ISO8859-1',
   1324     'nso':                                  'nso_ZA.ISO8859-15',
   1325     'nso_za':                               'nso_ZA.ISO8859-15',
   1326     'nso_za.iso885915':                     'nso_ZA.ISO8859-15',
   1327     'ny':                                   'ny_NO.ISO8859-1',
   1328     'ny_no':                                'ny_NO.ISO8859-1',
   1329     'ny_no.88591':                          'ny_NO.ISO8859-1',
   1330     'ny_no.iso88591':                       'ny_NO.ISO8859-1',
   1331     'ny_no.iso885915':                      'ny_NO.ISO8859-15',
   1332     'ny_no@euro':                           'ny_NO.ISO8859-15',
   1333     'nynorsk':                              'nn_NO.ISO8859-1',
   1334     'oc':                                   'oc_FR.ISO8859-1',
   1335     'oc_fr':                                'oc_FR.ISO8859-1',
   1336     'oc_fr.iso88591':                       'oc_FR.ISO8859-1',
   1337     'oc_fr.iso885915':                      'oc_FR.ISO8859-15',
   1338     'oc_fr@euro':                           'oc_FR.ISO8859-15',
   1339     'or':                                   'or_IN.UTF-8',
   1340     'pa':                                   'pa_IN.UTF-8',
   1341     'pa_in':                                'pa_IN.UTF-8',
   1342     'pd':                                   'pd_US.ISO8859-1',
   1343     'pd_de':                                'pd_DE.ISO8859-1',
   1344     'pd_de.iso88591':                       'pd_DE.ISO8859-1',
   1345     'pd_de.iso885915':                      'pd_DE.ISO8859-15',
   1346     'pd_de@euro':                           'pd_DE.ISO8859-15',
   1347     'pd_us':                                'pd_US.ISO8859-1',
   1348     'pd_us.iso88591':                       'pd_US.ISO8859-1',
   1349     'pd_us.iso885915':                      'pd_US.ISO8859-15',
   1350     'pd_us@euro':                           'pd_US.ISO8859-15',
   1351     'ph':                                   'ph_PH.ISO8859-1',
   1352     'ph_ph':                                'ph_PH.ISO8859-1',
   1353     'ph_ph.iso88591':                       'ph_PH.ISO8859-1',
   1354     'pl':                                   'pl_PL.ISO8859-2',
   1355     'pl_pl':                                'pl_PL.ISO8859-2',
   1356     'pl_pl.iso88592':                       'pl_PL.ISO8859-2',
   1357     'polish':                               'pl_PL.ISO8859-2',
   1358     'portuguese':                           'pt_PT.ISO8859-1',
   1359     'portuguese.iso88591':                  'pt_PT.ISO8859-1',
   1360     'portuguese_brazil':                    'pt_BR.ISO8859-1',
   1361     'portuguese_brazil.8859':               'pt_BR.ISO8859-1',
   1362     'posix':                                'C',
   1363     'posix-utf2':                           'C',
   1364     'pp':                                   'pp_AN.ISO8859-1',
   1365     'pp_an':                                'pp_AN.ISO8859-1',
   1366     'pp_an.iso88591':                       'pp_AN.ISO8859-1',
   1367     'pt':                                   'pt_PT.ISO8859-1',
   1368     'pt.iso885915':                         'pt_PT.ISO8859-15',
   1369     'pt_br':                                'pt_BR.ISO8859-1',
   1370     'pt_br.88591':                          'pt_BR.ISO8859-1',
   1371     'pt_br.iso88591':                       'pt_BR.ISO8859-1',
   1372     'pt_br.iso885915':                      'pt_BR.ISO8859-15',
   1373     'pt_br@euro':                           'pt_BR.ISO8859-15',
   1374     'pt_pt':                                'pt_PT.ISO8859-1',
   1375     'pt_pt.88591':                          'pt_PT.ISO8859-1',
   1376     'pt_pt.iso88591':                       'pt_PT.ISO8859-1',
   1377     'pt_pt.iso885915':                      'pt_PT.ISO8859-15',
   1378     'pt_pt.iso885915@euro':                 'pt_PT.ISO8859-15',
   1379     'pt_pt.utf8@euro':                      'pt_PT.UTF-8',
   1380     'pt_pt@euro':                           'pt_PT.ISO8859-15',
   1381     'ro':                                   'ro_RO.ISO8859-2',
   1382     'ro_ro':                                'ro_RO.ISO8859-2',
   1383     'ro_ro.iso88592':                       'ro_RO.ISO8859-2',
   1384     'romanian':                             'ro_RO.ISO8859-2',
   1385     'ru':                                   'ru_RU.UTF-8',
   1386     'ru.koi8r':                             'ru_RU.KOI8-R',
   1387     'ru_ru':                                'ru_RU.UTF-8',
   1388     'ru_ru.cp1251':                         'ru_RU.CP1251',
   1389     'ru_ru.iso88595':                       'ru_RU.ISO8859-5',
   1390     'ru_ru.koi8r':                          'ru_RU.KOI8-R',
   1391     'ru_ru.microsoftcp1251':                'ru_RU.CP1251',
   1392     'ru_ua':                                'ru_UA.KOI8-U',
   1393     'ru_ua.cp1251':                         'ru_UA.CP1251',
   1394     'ru_ua.koi8u':                          'ru_UA.KOI8-U',
   1395     'ru_ua.microsoftcp1251':                'ru_UA.CP1251',
   1396     'rumanian':                             'ro_RO.ISO8859-2',
   1397     'russian':                              'ru_RU.ISO8859-5',
   1398     'rw':                                   'rw_RW.ISO8859-1',
   1399     'rw_rw':                                'rw_RW.ISO8859-1',
   1400     'rw_rw.iso88591':                       'rw_RW.ISO8859-1',
   1401     'sd':                                   'sd_IN (at] devanagari.UTF-8',
   1402     'se_no':                                'se_NO.UTF-8',
   1403     'serbocroatian':                        'sr_RS.UTF-8@latin',
   1404     'sh':                                   'sr_RS.UTF-8@latin',
   1405     'sh_ba.iso88592@bosnia':                'sr_CS.ISO8859-2',
   1406     'sh_hr':                                'sh_HR.ISO8859-2',
   1407     'sh_hr.iso88592':                       'hr_HR.ISO8859-2',
   1408     'sh_sp':                                'sr_CS.ISO8859-2',
   1409     'sh_yu':                                'sr_RS.UTF-8@latin',
   1410     'si':                                   'si_LK.UTF-8',
   1411     'si_lk':                                'si_LK.UTF-8',
   1412     'sinhala':                              'si_LK.UTF-8',
   1413     'sk':                                   'sk_SK.ISO8859-2',
   1414     'sk_sk':                                'sk_SK.ISO8859-2',
   1415     'sk_sk.iso88592':                       'sk_SK.ISO8859-2',
   1416     'sl':                                   'sl_SI.ISO8859-2',
   1417     'sl_cs':                                'sl_CS.ISO8859-2',
   1418     'sl_si':                                'sl_SI.ISO8859-2',
   1419     'sl_si.iso88592':                       'sl_SI.ISO8859-2',
   1420     'slovak':                               'sk_SK.ISO8859-2',
   1421     'slovene':                              'sl_SI.ISO8859-2',
   1422     'slovenian':                            'sl_SI.ISO8859-2',
   1423     'sp':                                   'sr_CS.ISO8859-5',
   1424     'sp_yu':                                'sr_CS.ISO8859-5',
   1425     'spanish':                              'es_ES.ISO8859-1',
   1426     'spanish.iso88591':                     'es_ES.ISO8859-1',
   1427     'spanish_spain':                        'es_ES.ISO8859-1',
   1428     'spanish_spain.8859':                   'es_ES.ISO8859-1',
   1429     'sq':                                   'sq_AL.ISO8859-2',
   1430     'sq_al':                                'sq_AL.ISO8859-2',
   1431     'sq_al.iso88592':                       'sq_AL.ISO8859-2',
   1432     'sr':                                   'sr_RS.UTF-8',
   1433     'sr@cyrillic':                          'sr_RS.UTF-8',
   1434     'sr@latin':                             'sr_RS.UTF-8@latin',
   1435     'sr@latn':                              'sr_RS.UTF-8@latin',
   1436     'sr_cs':                                'sr_RS.UTF-8',
   1437     'sr_cs.iso88592':                       'sr_CS.ISO8859-2',
   1438     'sr_cs.iso88592@latn':                  'sr_CS.ISO8859-2',
   1439     'sr_cs.iso88595':                       'sr_CS.ISO8859-5',
   1440     'sr_cs.utf8@latn':                      'sr_RS.UTF-8@latin',
   1441     'sr_cs@latn':                           'sr_RS.UTF-8@latin',
   1442     'sr_me':                                'sr_ME.UTF-8',
   1443     'sr_rs':                                'sr_RS.UTF-8',
   1444     'sr_rs.utf8@latn':                      'sr_RS.UTF-8@latin',
   1445     'sr_rs@latin':                          'sr_RS.UTF-8@latin',
   1446     'sr_rs@latn':                           'sr_RS.UTF-8@latin',
   1447     'sr_sp':                                'sr_CS.ISO8859-2',
   1448     'sr_yu':                                'sr_RS.UTF-8@latin',
   1449     'sr_yu.cp1251@cyrillic':                'sr_CS.CP1251',
   1450     'sr_yu.iso88592':                       'sr_CS.ISO8859-2',
   1451     'sr_yu.iso88595':                       'sr_CS.ISO8859-5',
   1452     'sr_yu.iso88595@cyrillic':              'sr_CS.ISO8859-5',
   1453     'sr_yu.microsoftcp1251@cyrillic':       'sr_CS.CP1251',
   1454     'sr_yu.utf8@cyrillic':                  'sr_RS.UTF-8',
   1455     'sr_yu@cyrillic':                       'sr_RS.UTF-8',
   1456     'ss':                                   'ss_ZA.ISO8859-1',
   1457     'ss_za':                                'ss_ZA.ISO8859-1',
   1458     'ss_za.iso88591':                       'ss_ZA.ISO8859-1',
   1459     'st':                                   'st_ZA.ISO8859-1',
   1460     'st_za':                                'st_ZA.ISO8859-1',
   1461     'st_za.iso88591':                       'st_ZA.ISO8859-1',
   1462     'sv':                                   'sv_SE.ISO8859-1',
   1463     'sv.iso885915':                         'sv_SE.ISO8859-15',
   1464     'sv_fi':                                'sv_FI.ISO8859-1',
   1465     'sv_fi.iso88591':                       'sv_FI.ISO8859-1',
   1466     'sv_fi.iso885915':                      'sv_FI.ISO8859-15',
   1467     'sv_fi.iso885915@euro':                 'sv_FI.ISO8859-15',
   1468     'sv_fi.utf8@euro':                      'sv_FI.UTF-8',
   1469     'sv_fi@euro':                           'sv_FI.ISO8859-15',
   1470     'sv_se':                                'sv_SE.ISO8859-1',
   1471     'sv_se.88591':                          'sv_SE.ISO8859-1',
   1472     'sv_se.iso88591':                       'sv_SE.ISO8859-1',
   1473     'sv_se.iso885915':                      'sv_SE.ISO8859-15',
   1474     'sv_se@euro':                           'sv_SE.ISO8859-15',
   1475     'swedish':                              'sv_SE.ISO8859-1',
   1476     'swedish.iso88591':                     'sv_SE.ISO8859-1',
   1477     'ta':                                   'ta_IN.TSCII-0',
   1478     'ta_in':                                'ta_IN.TSCII-0',
   1479     'ta_in.tscii':                          'ta_IN.TSCII-0',
   1480     'ta_in.tscii0':                         'ta_IN.TSCII-0',
   1481     'te':                                   'te_IN.UTF-8',
   1482     'tg':                                   'tg_TJ.KOI8-C',
   1483     'tg_tj':                                'tg_TJ.KOI8-C',
   1484     'tg_tj.koi8c':                          'tg_TJ.KOI8-C',
   1485     'th':                                   'th_TH.ISO8859-11',
   1486     'th_th':                                'th_TH.ISO8859-11',
   1487     'th_th.iso885911':                      'th_TH.ISO8859-11',
   1488     'th_th.tactis':                         'th_TH.TIS620',
   1489     'th_th.tis620':                         'th_TH.TIS620',
   1490     'thai':                                 'th_TH.ISO8859-11',
   1491     'tl':                                   'tl_PH.ISO8859-1',
   1492     'tl_ph':                                'tl_PH.ISO8859-1',
   1493     'tl_ph.iso88591':                       'tl_PH.ISO8859-1',
   1494     'tn':                                   'tn_ZA.ISO8859-15',
   1495     'tn_za':                                'tn_ZA.ISO8859-15',
   1496     'tn_za.iso885915':                      'tn_ZA.ISO8859-15',
   1497     'tr':                                   'tr_TR.ISO8859-9',
   1498     'tr_tr':                                'tr_TR.ISO8859-9',
   1499     'tr_tr.iso88599':                       'tr_TR.ISO8859-9',
   1500     'ts':                                   'ts_ZA.ISO8859-1',
   1501     'ts_za':                                'ts_ZA.ISO8859-1',
   1502     'ts_za.iso88591':                       'ts_ZA.ISO8859-1',
   1503     'tt':                                   'tt_RU.TATAR-CYR',
   1504     'tt_ru':                                'tt_RU.TATAR-CYR',
   1505     'tt_ru.koi8c':                          'tt_RU.KOI8-C',
   1506     'tt_ru.tatarcyr':                       'tt_RU.TATAR-CYR',
   1507     'turkish':                              'tr_TR.ISO8859-9',
   1508     'turkish.iso88599':                     'tr_TR.ISO8859-9',
   1509     'uk':                                   'uk_UA.KOI8-U',
   1510     'uk_ua':                                'uk_UA.KOI8-U',
   1511     'uk_ua.cp1251':                         'uk_UA.CP1251',
   1512     'uk_ua.iso88595':                       'uk_UA.ISO8859-5',
   1513     'uk_ua.koi8u':                          'uk_UA.KOI8-U',
   1514     'uk_ua.microsoftcp1251':                'uk_UA.CP1251',
   1515     'univ':                                 'en_US.utf',
   1516     'universal':                            'en_US.utf',
   1517     'universal.utf8@ucs4':                  'en_US.UTF-8',
   1518     'ur':                                   'ur_PK.CP1256',
   1519     'ur_pk':                                'ur_PK.CP1256',
   1520     'ur_pk.cp1256':                         'ur_PK.CP1256',
   1521     'ur_pk.microsoftcp1256':                'ur_PK.CP1256',
   1522     'uz':                                   'uz_UZ.UTF-8',
   1523     'uz_uz':                                'uz_UZ.UTF-8',
   1524     'uz_uz.iso88591':                       'uz_UZ.ISO8859-1',
   1525     'uz_uz.utf8@cyrillic':                  'uz_UZ.UTF-8',
   1526     'uz_uz@cyrillic':                       'uz_UZ.UTF-8',
   1527     've':                                   've_ZA.UTF-8',
   1528     've_za':                                've_ZA.UTF-8',
   1529     'vi':                                   'vi_VN.TCVN',
   1530     'vi_vn':                                'vi_VN.TCVN',
   1531     'vi_vn.tcvn':                           'vi_VN.TCVN',
   1532     'vi_vn.tcvn5712':                       'vi_VN.TCVN',
   1533     'vi_vn.viscii':                         'vi_VN.VISCII',
   1534     'vi_vn.viscii111':                      'vi_VN.VISCII',
   1535     'wa':                                   'wa_BE.ISO8859-1',
   1536     'wa_be':                                'wa_BE.ISO8859-1',
   1537     'wa_be.iso88591':                       'wa_BE.ISO8859-1',
   1538     'wa_be.iso885915':                      'wa_BE.ISO8859-15',
   1539     'wa_be.iso885915@euro':                 'wa_BE.ISO8859-15',
   1540     'wa_be@euro':                           'wa_BE.ISO8859-15',
   1541     'xh':                                   'xh_ZA.ISO8859-1',
   1542     'xh_za':                                'xh_ZA.ISO8859-1',
   1543     'xh_za.iso88591':                       'xh_ZA.ISO8859-1',
   1544     'yi':                                   'yi_US.CP1255',
   1545     'yi_us':                                'yi_US.CP1255',
   1546     'yi_us.cp1255':                         'yi_US.CP1255',
   1547     'yi_us.microsoftcp1255':                'yi_US.CP1255',
   1548     'zh':                                   'zh_CN.eucCN',
   1549     'zh_cn':                                'zh_CN.gb2312',
   1550     'zh_cn.big5':                           'zh_TW.big5',
   1551     'zh_cn.euc':                            'zh_CN.eucCN',
   1552     'zh_cn.gb18030':                        'zh_CN.gb18030',
   1553     'zh_cn.gb2312':                         'zh_CN.gb2312',
   1554     'zh_cn.gbk':                            'zh_CN.gbk',
   1555     'zh_hk':                                'zh_HK.big5hkscs',
   1556     'zh_hk.big5':                           'zh_HK.big5',
   1557     'zh_hk.big5hk':                         'zh_HK.big5hkscs',
   1558     'zh_hk.big5hkscs':                      'zh_HK.big5hkscs',
   1559     'zh_tw':                                'zh_TW.big5',
   1560     'zh_tw.big5':                           'zh_TW.big5',
   1561     'zh_tw.euc':                            'zh_TW.eucTW',
   1562     'zh_tw.euctw':                          'zh_TW.eucTW',
   1563     'zu':                                   'zu_ZA.ISO8859-1',
   1564     'zu_za':                                'zu_ZA.ISO8859-1',
   1565     'zu_za.iso88591':                       'zu_ZA.ISO8859-1',
   1566 }
   1567 
   1568 #

   1569 # This maps Windows language identifiers to locale strings.

   1570 #

   1571 # This list has been updated from

   1572 # http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp

   1573 # to include every locale up to Windows Vista.

   1574 #

   1575 # NOTE: this mapping is incomplete.  If your language is missing, please

   1576 # submit a bug report to Python bug manager, which you can find via:

   1577 #     http://www.python.org/dev/

   1578 # Make sure you include the missing language identifier and the suggested

   1579 # locale code.

   1580 #

   1581 
   1582 windows_locale = {
   1583     0x0436: "af_ZA", # Afrikaans

   1584     0x041c: "sq_AL", # Albanian

   1585     0x0484: "gsw_FR",# Alsatian - France

   1586     0x045e: "am_ET", # Amharic - Ethiopia

   1587     0x0401: "ar_SA", # Arabic - Saudi Arabia

   1588     0x0801: "ar_IQ", # Arabic - Iraq

   1589     0x0c01: "ar_EG", # Arabic - Egypt

   1590     0x1001: "ar_LY", # Arabic - Libya

   1591     0x1401: "ar_DZ", # Arabic - Algeria

   1592     0x1801: "ar_MA", # Arabic - Morocco

   1593     0x1c01: "ar_TN", # Arabic - Tunisia

   1594     0x2001: "ar_OM", # Arabic - Oman

   1595     0x2401: "ar_YE", # Arabic - Yemen

   1596     0x2801: "ar_SY", # Arabic - Syria

   1597     0x2c01: "ar_JO", # Arabic - Jordan

   1598     0x3001: "ar_LB", # Arabic - Lebanon

   1599     0x3401: "ar_KW", # Arabic - Kuwait

   1600     0x3801: "ar_AE", # Arabic - United Arab Emirates

   1601     0x3c01: "ar_BH", # Arabic - Bahrain

   1602     0x4001: "ar_QA", # Arabic - Qatar

   1603     0x042b: "hy_AM", # Armenian

   1604     0x044d: "as_IN", # Assamese - India

   1605     0x042c: "az_AZ", # Azeri - Latin

   1606     0x082c: "az_AZ", # Azeri - Cyrillic

   1607     0x046d: "ba_RU", # Bashkir

   1608     0x042d: "eu_ES", # Basque - Russia

   1609     0x0423: "be_BY", # Belarusian

   1610     0x0445: "bn_IN", # Begali

   1611     0x201a: "bs_BA", # Bosnian - Cyrillic

   1612     0x141a: "bs_BA", # Bosnian - Latin

   1613     0x047e: "br_FR", # Breton - France

   1614     0x0402: "bg_BG", # Bulgarian

   1615 #    0x0455: "my_MM", # Burmese - Not supported

   1616     0x0403: "ca_ES", # Catalan

   1617     0x0004: "zh_CHS",# Chinese - Simplified

   1618     0x0404: "zh_TW", # Chinese - Taiwan

   1619     0x0804: "zh_CN", # Chinese - PRC

   1620     0x0c04: "zh_HK", # Chinese - Hong Kong S.A.R.

   1621     0x1004: "zh_SG", # Chinese - Singapore

   1622     0x1404: "zh_MO", # Chinese - Macao S.A.R.

   1623     0x7c04: "zh_CHT",# Chinese - Traditional

   1624     0x0483: "co_FR", # Corsican - France

   1625     0x041a: "hr_HR", # Croatian

   1626     0x101a: "hr_BA", # Croatian - Bosnia

   1627     0x0405: "cs_CZ", # Czech

   1628     0x0406: "da_DK", # Danish

   1629     0x048c: "gbz_AF",# Dari - Afghanistan

   1630     0x0465: "div_MV",# Divehi - Maldives

   1631     0x0413: "nl_NL", # Dutch - The Netherlands

   1632     0x0813: "nl_BE", # Dutch - Belgium

   1633     0x0409: "en_US", # English - United States

   1634     0x0809: "en_GB", # English - United Kingdom

   1635     0x0c09: "en_AU", # English - Australia

   1636     0x1009: "en_CA", # English - Canada

   1637     0x1409: "en_NZ", # English - New Zealand

   1638     0x1809: "en_IE", # English - Ireland

   1639     0x1c09: "en_ZA", # English - South Africa

   1640     0x2009: "en_JA", # English - Jamaica

   1641     0x2409: "en_CB", # English - Carribbean

   1642     0x2809: "en_BZ", # English - Belize

   1643     0x2c09: "en_TT", # English - Trinidad

   1644     0x3009: "en_ZW", # English - Zimbabwe

   1645     0x3409: "en_PH", # English - Philippines

   1646     0x4009: "en_IN", # English - India

   1647     0x4409: "en_MY", # English - Malaysia

   1648     0x4809: "en_IN", # English - Singapore

   1649     0x0425: "et_EE", # Estonian

   1650     0x0438: "fo_FO", # Faroese

   1651     0x0464: "fil_PH",# Filipino

   1652     0x040b: "fi_FI", # Finnish

   1653     0x040c: "fr_FR", # French - France

   1654     0x080c: "fr_BE", # French - Belgium

   1655     0x0c0c: "fr_CA", # French - Canada

   1656     0x100c: "fr_CH", # French - Switzerland

   1657     0x140c: "fr_LU", # French - Luxembourg

   1658     0x180c: "fr_MC", # French - Monaco

   1659     0x0462: "fy_NL", # Frisian - Netherlands

   1660     0x0456: "gl_ES", # Galician

   1661     0x0437: "ka_GE", # Georgian

   1662     0x0407: "de_DE", # German - Germany

   1663     0x0807: "de_CH", # German - Switzerland

   1664     0x0c07: "de_AT", # German - Austria

   1665     0x1007: "de_LU", # German - Luxembourg

   1666     0x1407: "de_LI", # German - Liechtenstein

   1667     0x0408: "el_GR", # Greek

   1668     0x046f: "kl_GL", # Greenlandic - Greenland

   1669     0x0447: "gu_IN", # Gujarati

   1670     0x0468: "ha_NG", # Hausa - Latin

   1671     0x040d: "he_IL", # Hebrew

   1672     0x0439: "hi_IN", # Hindi

   1673     0x040e: "hu_HU", # Hungarian

   1674     0x040f: "is_IS", # Icelandic

   1675     0x0421: "id_ID", # Indonesian

   1676     0x045d: "iu_CA", # Inuktitut - Syllabics

   1677     0x085d: "iu_CA", # Inuktitut - Latin

   1678     0x083c: "ga_IE", # Irish - Ireland

   1679     0x0410: "it_IT", # Italian - Italy

   1680     0x0810: "it_CH", # Italian - Switzerland

   1681     0x0411: "ja_JP", # Japanese

   1682     0x044b: "kn_IN", # Kannada - India

   1683     0x043f: "kk_KZ", # Kazakh

   1684     0x0453: "kh_KH", # Khmer - Cambodia

   1685     0x0486: "qut_GT",# K'iche - Guatemala

   1686     0x0487: "rw_RW", # Kinyarwanda - Rwanda

   1687     0x0457: "kok_IN",# Konkani

   1688     0x0412: "ko_KR", # Korean

   1689     0x0440: "ky_KG", # Kyrgyz

   1690     0x0454: "lo_LA", # Lao - Lao PDR

   1691     0x0426: "lv_LV", # Latvian

   1692     0x0427: "lt_LT", # Lithuanian

   1693     0x082e: "dsb_DE",# Lower Sorbian - Germany

   1694     0x046e: "lb_LU", # Luxembourgish

   1695     0x042f: "mk_MK", # FYROM Macedonian

   1696     0x043e: "ms_MY", # Malay - Malaysia

   1697     0x083e: "ms_BN", # Malay - Brunei Darussalam

   1698     0x044c: "ml_IN", # Malayalam - India

   1699     0x043a: "mt_MT", # Maltese

   1700     0x0481: "mi_NZ", # Maori

   1701     0x047a: "arn_CL",# Mapudungun

   1702     0x044e: "mr_IN", # Marathi

   1703     0x047c: "moh_CA",# Mohawk - Canada

   1704     0x0450: "mn_MN", # Mongolian - Cyrillic

   1705     0x0850: "mn_CN", # Mongolian - PRC

   1706     0x0461: "ne_NP", # Nepali

   1707     0x0414: "nb_NO", # Norwegian - Bokmal

   1708     0x0814: "nn_NO", # Norwegian - Nynorsk

   1709     0x0482: "oc_FR", # Occitan - France

   1710     0x0448: "or_IN", # Oriya - India

   1711     0x0463: "ps_AF", # Pashto - Afghanistan

   1712     0x0429: "fa_IR", # Persian

   1713     0x0415: "pl_PL", # Polish

   1714     0x0416: "pt_BR", # Portuguese - Brazil

   1715     0x0816: "pt_PT", # Portuguese - Portugal

   1716     0x0446: "pa_IN", # Punjabi

   1717     0x046b: "quz_BO",# Quechua (Bolivia)

   1718     0x086b: "quz_EC",# Quechua (Ecuador)

   1719     0x0c6b: "quz_PE",# Quechua (Peru)

   1720     0x0418: "ro_RO", # Romanian - Romania

   1721     0x0417: "rm_CH", # Romansh

   1722     0x0419: "ru_RU", # Russian

   1723     0x243b: "smn_FI",# Sami Finland

   1724     0x103b: "smj_NO",# Sami Norway

   1725     0x143b: "smj_SE",# Sami Sweden

   1726     0x043b: "se_NO", # Sami Northern Norway

   1727     0x083b: "se_SE", # Sami Northern Sweden

   1728     0x0c3b: "se_FI", # Sami Northern Finland

   1729     0x203b: "sms_FI",# Sami Skolt

   1730     0x183b: "sma_NO",# Sami Southern Norway

   1731     0x1c3b: "sma_SE",# Sami Southern Sweden

   1732     0x044f: "sa_IN", # Sanskrit

   1733     0x0c1a: "sr_SP", # Serbian - Cyrillic

   1734     0x1c1a: "sr_BA", # Serbian - Bosnia Cyrillic

   1735     0x081a: "sr_SP", # Serbian - Latin

   1736     0x181a: "sr_BA", # Serbian - Bosnia Latin

   1737     0x045b: "si_LK", # Sinhala - Sri Lanka

   1738     0x046c: "ns_ZA", # Northern Sotho

   1739     0x0432: "tn_ZA", # Setswana - Southern Africa

   1740     0x041b: "sk_SK", # Slovak

   1741     0x0424: "sl_SI", # Slovenian

   1742     0x040a: "es_ES", # Spanish - Spain

   1743     0x080a: "es_MX", # Spanish - Mexico

   1744     0x0c0a: "es_ES", # Spanish - Spain (Modern)

   1745     0x100a: "es_GT", # Spanish - Guatemala

   1746     0x140a: "es_CR", # Spanish - Costa Rica

   1747     0x180a: "es_PA", # Spanish - Panama

   1748     0x1c0a: "es_DO", # Spanish - Dominican Republic

   1749     0x200a: "es_VE", # Spanish - Venezuela

   1750     0x240a: "es_CO", # Spanish - Colombia

   1751     0x280a: "es_PE", # Spanish - Peru

   1752     0x2c0a: "es_AR", # Spanish - Argentina

   1753     0x300a: "es_EC", # Spanish - Ecuador

   1754     0x340a: "es_CL", # Spanish - Chile

   1755     0x380a: "es_UR", # Spanish - Uruguay

   1756     0x3c0a: "es_PY", # Spanish - Paraguay

   1757     0x400a: "es_BO", # Spanish - Bolivia

   1758     0x440a: "es_SV", # Spanish - El Salvador

   1759     0x480a: "es_HN", # Spanish - Honduras

   1760     0x4c0a: "es_NI", # Spanish - Nicaragua

   1761     0x500a: "es_PR", # Spanish - Puerto Rico

   1762     0x540a: "es_US", # Spanish - United States

   1763 #    0x0430: "", # Sutu - Not supported

   1764     0x0441: "sw_KE", # Swahili

   1765     0x041d: "sv_SE", # Swedish - Sweden

   1766     0x081d: "sv_FI", # Swedish - Finland

   1767     0x045a: "syr_SY",# Syriac

   1768     0x0428: "tg_TJ", # Tajik - Cyrillic

   1769     0x085f: "tmz_DZ",# Tamazight - Latin

   1770     0x0449: "ta_IN", # Tamil

   1771     0x0444: "tt_RU", # Tatar

   1772     0x044a: "te_IN", # Telugu

   1773     0x041e: "th_TH", # Thai

   1774     0x0851: "bo_BT", # Tibetan - Bhutan

   1775     0x0451: "bo_CN", # Tibetan - PRC

   1776     0x041f: "tr_TR", # Turkish

   1777     0x0442: "tk_TM", # Turkmen - Cyrillic

   1778     0x0480: "ug_CN", # Uighur - Arabic

   1779     0x0422: "uk_UA", # Ukrainian

   1780     0x042e: "wen_DE",# Upper Sorbian - Germany

   1781     0x0420: "ur_PK", # Urdu

   1782     0x0820: "ur_IN", # Urdu - India

   1783     0x0443: "uz_UZ", # Uzbek - Latin

   1784     0x0843: "uz_UZ", # Uzbek - Cyrillic

   1785     0x042a: "vi_VN", # Vietnamese

   1786     0x0452: "cy_GB", # Welsh

   1787     0x0488: "wo_SN", # Wolof - Senegal

   1788     0x0434: "xh_ZA", # Xhosa - South Africa

   1789     0x0485: "sah_RU",# Yakut - Cyrillic

   1790     0x0478: "ii_CN", # Yi - PRC

   1791     0x046a: "yo_NG", # Yoruba - Nigeria

   1792     0x0435: "zu_ZA", # Zulu

   1793 }
   1794 
   1795 def _print_locale():
   1796 
   1797     """ Test function.
   1798     """
   1799     categories = {}
   1800     def _init_categories(categories=categories):
   1801         for k,v in globals().items():
   1802             if k[:3] == 'LC_':
   1803                 categories[k] = v
   1804     _init_categories()
   1805     del categories['LC_ALL']
   1806 
   1807     print 'Locale defaults as determined by getdefaultlocale():'
   1808     print '-'*72
   1809     lang, enc = getdefaultlocale()
   1810     print 'Language: ', lang or '(undefined)'
   1811     print 'Encoding: ', enc or '(undefined)'
   1812     print
   1813 
   1814     print 'Locale settings on startup:'
   1815     print '-'*72
   1816     for name,category in categories.items():
   1817         print name, '...'
   1818         lang, enc = getlocale(category)
   1819         print '   Language: ', lang or '(undefined)'
   1820         print '   Encoding: ', enc or '(undefined)'
   1821         print
   1822 
   1823     print
   1824     print 'Locale settings after calling resetlocale():'
   1825     print '-'*72
   1826     resetlocale()
   1827     for name,category in categories.items():
   1828         print name, '...'
   1829         lang, enc = getlocale(category)
   1830         print '   Language: ', lang or '(undefined)'
   1831         print '   Encoding: ', enc or '(undefined)'
   1832         print
   1833 
   1834     try:
   1835         setlocale(LC_ALL, "")
   1836     except:
   1837         print 'NOTE:'
   1838         print 'setlocale(LC_ALL, "") does not support the default locale'
   1839         print 'given in the OS environment variables.'
   1840     else:
   1841         print
   1842         print 'Locale settings after calling setlocale(LC_ALL, ""):'
   1843         print '-'*72
   1844         for name,category in categories.items():
   1845             print name, '...'
   1846             lang, enc = getlocale(category)
   1847             print '   Language: ', lang or '(undefined)'
   1848             print '   Encoding: ', enc or '(undefined)'
   1849             print
   1850 
   1851 ###

   1852 
   1853 try:
   1854     LC_MESSAGES
   1855 except NameError:
   1856     pass
   1857 else:
   1858     __all__.append("LC_MESSAGES")
   1859 
   1860 if __name__=='__main__':
   1861     print 'Locale aliasing:'
   1862     print
   1863     _print_locale()
   1864     print
   1865     print 'Number formatting:'
   1866     print
   1867     _test()
   1868