source: titan/mediathek/localhoster/lib/python2.7/locale.py @ 40114

Last change on this file since 40114 was 40094, checked in by obi, 7 years ago

tithek add yoztube-dl support

File size: 97.1 KB
Line 
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
14import sys
15import encodings
16import encodings.aliases
17import re
18import operator
19import functools
20
21try:
22    _unicode = unicode
23except NameError:
24    # If Python is built without Unicode support, the unicode type
25    # will not exist. Fake one.
26    class _unicode(object):
27        pass
28
29# Try importing the _locale module.
30#
31# If this fails, fall back on a basic 'C' locale emulation.
32
33# Yuck:  LC_MESSAGES is non-standard:  can't tell whether it exists before
34# trying the import.  So __all__ is also fiddled at the end of the file.
35__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
36           "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",
37           "str", "atof", "atoi", "format", "format_string", "currency",
38           "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
39           "LC_NUMERIC", "LC_ALL", "CHAR_MAX"]
40
41try:
42
43    from _locale import *
44
45except ImportError:
46
47    # Locale emulation
48
49    CHAR_MAX = 127
50    LC_ALL = 6
51    LC_COLLATE = 3
52    LC_CTYPE = 0
53    LC_MESSAGES = 5
54    LC_MONETARY = 4
55    LC_NUMERIC = 1
56    LC_TIME = 2
57    Error = ValueError
58
59    def localeconv():
60        """ localeconv() -> dict.
61            Returns numeric and monetary locale-specific parameters.
62        """
63        # 'C' locale default values
64        return {'grouping': [127],
65                'currency_symbol': '',
66                'n_sign_posn': 127,
67                'p_cs_precedes': 127,
68                'n_cs_precedes': 127,
69                'mon_grouping': [],
70                'n_sep_by_space': 127,
71                'decimal_point': '.',
72                'negative_sign': '',
73                'positive_sign': '',
74                'p_sep_by_space': 127,
75                'int_curr_symbol': '',
76                'p_sign_posn': 127,
77                'thousands_sep': '',
78                'mon_thousands_sep': '',
79                'frac_digits': 127,
80                'mon_decimal_point': '',
81                'int_frac_digits': 127}
82
83    def setlocale(category, value=None):
84        """ setlocale(integer,string=None) -> string.
85            Activates/queries locale processing.
86        """
87        if value not in (None, '', 'C'):
88            raise Error, '_locale emulation only supports "C" locale'
89        return 'C'
90
91    def strcoll(a,b):
92        """ strcoll(string,string) -> int.
93            Compares two strings according to the locale.
94        """
95        return cmp(a,b)
96
97    def strxfrm(s):
98        """ strxfrm(string) -> string.
99            Returns a string that behaves for cmp locale-aware.
100        """
101        return s
102
103
104_localeconv = localeconv
105
106# With this dict, you can override some items of localeconv's return value.
107# This is useful for testing purposes.
108_override_localeconv = {}
109
110@functools.wraps(_localeconv)
111def localeconv():
112    d = _localeconv()
113    if _override_localeconv:
114        d.update(_override_localeconv)
115    return d
116
117
118### Number formatting APIs
119
120# Author: Martin von Loewis
121# improved by Georg Brandl
122
123# Iterate over grouping intervals
124def _grouping_intervals(grouping):
125    last_interval = None
126    for interval in grouping:
127        # if grouping is -1, we are done
128        if interval == CHAR_MAX:
129            return
130        # 0: re-use last group ad infinitum
131        if interval == 0:
132            if last_interval is None:
133                raise ValueError("invalid grouping")
134            while True:
135                yield last_interval
136        yield interval
137        last_interval = interval
138
139#perform the grouping from right to left
140def _group(s, monetary=False):
141    conv = localeconv()
142    thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
143    grouping = conv[monetary and 'mon_grouping' or 'grouping']
144    if not grouping:
145        return (s, 0)
146    if s[-1] == ' ':
147        stripped = s.rstrip()
148        right_spaces = s[len(stripped):]
149        s = stripped
150    else:
151        right_spaces = ''
152    left_spaces = ''
153    groups = []
154    for interval in _grouping_intervals(grouping):
155        if not s or s[-1] not in "0123456789":
156            # only non-digit characters remain (sign, spaces)
157            left_spaces = s
158            s = ''
159            break
160        groups.append(s[-interval:])
161        s = s[:-interval]
162    if s:
163        groups.append(s)
164    groups.reverse()
165    return (
166        left_spaces + thousands_sep.join(groups) + right_spaces,
167        len(thousands_sep) * (len(groups) - 1)
168    )
169
170# Strip a given amount of excess padding from the given string
171def _strip_padding(s, amount):
172    lpos = 0
173    while amount and s[lpos] == ' ':
174        lpos += 1
175        amount -= 1
176    rpos = len(s) - 1
177    while amount and s[rpos] == ' ':
178        rpos -= 1
179        amount -= 1
180    return s[lpos:rpos+1]
181
182_percent_re = re.compile(r'%(?:\((?P<key>.*?)\))?'
183                         r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')
184
185def format(percent, value, grouping=False, monetary=False, *additional):
186    """Returns the locale-aware substitution of a %? specifier
187    (percent).
188
189    additional is for format strings which contain one or more
190    '*' modifiers."""
191    # this is only for one-percent-specifier strings and this should be checked
192    match = _percent_re.match(percent)
193    if not match or len(match.group())!= len(percent):
194        raise ValueError(("format() must be given exactly one %%char "
195                         "format specifier, %s not valid") % repr(percent))
196    return _format(percent, value, grouping, monetary, *additional)
197
198def _format(percent, value, grouping=False, monetary=False, *additional):
199    if additional:
200        formatted = percent % ((value,) + additional)
201    else:
202        formatted = percent % value
203    # floats and decimal ints need special action!
204    if percent[-1] in 'eEfFgG':
205        seps = 0
206        parts = formatted.split('.')
207        if grouping:
208            parts[0], seps = _group(parts[0], monetary=monetary)
209        decimal_point = localeconv()[monetary and 'mon_decimal_point'
210                                              or 'decimal_point']
211        formatted = decimal_point.join(parts)
212        if seps:
213            formatted = _strip_padding(formatted, seps)
214    elif percent[-1] in 'diu':
215        seps = 0
216        if grouping:
217            formatted, seps = _group(formatted, monetary=monetary)
218        if seps:
219            formatted = _strip_padding(formatted, seps)
220    return formatted
221
222def format_string(f, val, grouping=False):
223    """Formats a string in the same way that the % formatting would use,
224    but takes the current locale into account.
225    Grouping is applied if the third parameter is true."""
226    percents = list(_percent_re.finditer(f))
227    new_f = _percent_re.sub('%s', f)
228
229    if operator.isMappingType(val):
230        new_val = []
231        for perc in percents:
232            if perc.group()[-1]=='%':
233                new_val.append('%')
234            else:
235                new_val.append(format(perc.group(), val, grouping))
236    else:
237        if not isinstance(val, tuple):
238            val = (val,)
239        new_val = []
240        i = 0
241        for perc in percents:
242            if perc.group()[-1]=='%':
243                new_val.append('%')
244            else:
245                starcount = perc.group('modifiers').count('*')
246                new_val.append(_format(perc.group(),
247                                      val[i],
248                                      grouping,
249                                      False,
250                                      *val[i+1:i+1+starcount]))
251                i += (1 + starcount)
252    val = tuple(new_val)
253
254    return new_f % val
255
256def currency(val, symbol=True, grouping=False, international=False):
257    """Formats val according to the currency settings
258    in the current locale."""
259    conv = localeconv()
260
261    # check for illegal values
262    digits = conv[international and 'int_frac_digits' or 'frac_digits']
263    if digits == 127:
264        raise ValueError("Currency formatting is not possible using "
265                         "the 'C' locale.")
266
267    s = format('%%.%if' % digits, abs(val), grouping, monetary=True)
268    # '<' and '>' are markers if the sign must be inserted between symbol and value
269    s = '<' + s + '>'
270
271    if symbol:
272        smb = conv[international and 'int_curr_symbol' or 'currency_symbol']
273        precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']
274        separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']
275
276        if precedes:
277            s = smb + (separated and ' ' or '') + s
278        else:
279            s = s + (separated and ' ' or '') + smb
280
281    sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']
282    sign = conv[val<0 and 'negative_sign' or 'positive_sign']
283
284    if sign_pos == 0:
285        s = '(' + s + ')'
286    elif sign_pos == 1:
287        s = sign + s
288    elif sign_pos == 2:
289        s = s + sign
290    elif sign_pos == 3:
291        s = s.replace('<', sign)
292    elif sign_pos == 4:
293        s = s.replace('>', sign)
294    else:
295        # the default if nothing specified;
296        # this should be the most fitting sign position
297        s = sign + s
298
299    return s.replace('<', '').replace('>', '')
300
301def str(val):
302    """Convert float to integer, taking the locale into account."""
303    return format("%.12g", val)
304
305def atof(string, func=float):
306    "Parses a string as a float according to the locale settings."
307    #First, get rid of the grouping
308    ts = localeconv()['thousands_sep']
309    if ts:
310        string = string.replace(ts, '')
311    #next, replace the decimal point with a dot
312    dd = localeconv()['decimal_point']
313    if dd:
314        string = string.replace(dd, '.')
315    #finally, parse the string
316    return func(string)
317
318def atoi(str):
319    "Converts a string to an integer according to the locale settings."
320    return atof(str, int)
321
322def _test():
323    setlocale(LC_ALL, "")
324    #do grouping
325    s1 = format("%d", 123456789,1)
326    print s1, "is", atoi(s1)
327    #standard formatting
328    s1 = str(3.14)
329    print s1, "is", atof(s1)
330
331### Locale name aliasing engine
332
333# Author: Marc-Andre Lemburg, mal@lemburg.com
334# Various tweaks by Fredrik Lundh <fredrik@pythonware.com>
335
336# store away the low-level version of setlocale (it's
337# overridden below)
338_setlocale = setlocale
339
340# Avoid relying on the locale-dependent .lower() method
341# (see issue #1813).
342_ascii_lower_map = ''.join(
343    chr(x + 32 if x >= ord('A') and x <= ord('Z') else x)
344    for x in range(256)
345)
346
347def _replace_encoding(code, encoding):
348    if '.' in code:
349        langname = code[:code.index('.')]
350    else:
351        langname = code
352    # Convert the encoding to a C lib compatible encoding string
353    norm_encoding = encodings.normalize_encoding(encoding)
354    #print('norm encoding: %r' % norm_encoding)
355    norm_encoding = encodings.aliases.aliases.get(norm_encoding,
356                                                  norm_encoding)
357    #print('aliased encoding: %r' % norm_encoding)
358    encoding = locale_encoding_alias.get(norm_encoding,
359                                         norm_encoding)
360    #print('found encoding %r' % encoding)
361    return langname + '.' + encoding
362
363def normalize(localename):
364
365    """ Returns a normalized locale code for the given locale
366        name.
367
368        The returned locale code is formatted for use with
369        setlocale().
370
371        If normalization fails, the original name is returned
372        unchanged.
373
374        If the given encoding is not known, the function defaults to
375        the default encoding for the locale code just like setlocale()
376        does.
377
378    """
379    # Normalize the locale name and extract the encoding and modifier
380    if isinstance(localename, _unicode):
381        localename = localename.encode('ascii')
382    code = localename.translate(_ascii_lower_map)
383    if ':' in code:
384        # ':' is sometimes used as encoding delimiter.
385        code = code.replace(':', '.')
386    if '@' in code:
387        code, modifier = code.split('@', 1)
388    else:
389        modifier = ''
390    if '.' in code:
391        langname, encoding = code.split('.')[:2]
392    else:
393        langname = code
394        encoding = ''
395
396    # First lookup: fullname (possibly with encoding and modifier)
397    lang_enc = langname
398    if encoding:
399        norm_encoding = encoding.replace('-', '')
400        norm_encoding = norm_encoding.replace('_', '')
401        lang_enc += '.' + norm_encoding
402    lookup_name = lang_enc
403    if modifier:
404        lookup_name += '@' + modifier
405    code = locale_alias.get(lookup_name, None)
406    if code is not None:
407        return code
408    #print('first lookup failed')
409
410    if modifier:
411        # Second try: fullname without modifier (possibly with encoding)
412        code = locale_alias.get(lang_enc, None)
413        if code is not None:
414            #print('lookup without modifier succeeded')
415            if '@' not in code:
416                return code + '@' + modifier
417            if code.split('@', 1)[1].translate(_ascii_lower_map) == modifier:
418                return code
419        #print('second lookup failed')
420
421    if encoding:
422        # Third try: langname (without encoding, possibly with modifier)
423        lookup_name = langname
424        if modifier:
425            lookup_name += '@' + modifier
426        code = locale_alias.get(lookup_name, None)
427        if code is not None:
428            #print('lookup without encoding succeeded')
429            if '@' not in code:
430                return _replace_encoding(code, encoding)
431            code, modifier = code.split('@', 1)
432            return _replace_encoding(code, encoding) + '@' + modifier
433
434        if modifier:
435            # Fourth try: langname (without encoding and modifier)
436            code = locale_alias.get(langname, None)
437            if code is not None:
438                #print('lookup without modifier and encoding succeeded')
439                if '@' not in code:
440                    return _replace_encoding(code, encoding) + '@' + modifier
441                code, defmod = code.split('@', 1)
442                if defmod.translate(_ascii_lower_map) == modifier:
443                    return _replace_encoding(code, encoding) + '@' + defmod
444
445    return localename
446
447def _parse_localename(localename):
448
449    """ Parses the locale code for localename and returns the
450        result as tuple (language code, encoding).
451
452        The localename is normalized and passed through the locale
453        alias engine. A ValueError is raised in case the locale name
454        cannot be parsed.
455
456        The language code corresponds to RFC 1766.  code and encoding
457        can be None in case the values cannot be determined or are
458        unknown to this implementation.
459
460    """
461    code = normalize(localename)
462    if '@' in code:
463        # Deal with locale modifiers
464        code, modifier = code.split('@', 1)
465        if modifier == 'euro' and '.' not in code:
466            # Assume Latin-9 for @euro locales. This is bogus,
467            # since some systems may use other encodings for these
468            # locales. Also, we ignore other modifiers.
469            return code, 'iso-8859-15'
470
471    if '.' in code:
472        return tuple(code.split('.')[:2])
473    elif code == 'C':
474        return None, None
475    raise ValueError, 'unknown locale: %s' % localename
476
477def _build_localename(localetuple):
478
479    """ Builds a locale code from the given tuple (language code,
480        encoding).
481
482        No aliasing or normalizing takes place.
483
484    """
485    language, encoding = localetuple
486    if language is None:
487        language = 'C'
488    if encoding is None:
489        return language
490    else:
491        return language + '.' + encoding
492
493def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
494
495    """ Tries to determine the default locale settings and returns
496        them as tuple (language code, encoding).
497
498        According to POSIX, a program which has not called
499        setlocale(LC_ALL, "") runs using the portable 'C' locale.
500        Calling setlocale(LC_ALL, "") lets it use the default locale as
501        defined by the LANG variable. Since we don't want to interfere
502        with the current locale setting we thus emulate the behavior
503        in the way described above.
504
505        To maintain compatibility with other platforms, not only the
506        LANG variable is tested, but a list of variables given as
507        envvars parameter. The first found to be defined will be
508        used. envvars defaults to the search path used in GNU gettext;
509        it must always contain the variable name 'LANG'.
510
511        Except for the code 'C', the language code corresponds to RFC
512        1766.  code and encoding can be None in case the values cannot
513        be determined.
514
515    """
516
517    try:
518        # check if it's supported by the _locale module
519        import _locale
520        code, encoding = _locale._getdefaultlocale()
521    except (ImportError, AttributeError):
522        pass
523    else:
524        # make sure the code/encoding values are valid
525        if sys.platform == "win32" and code and code[:2] == "0x":
526            # map windows language identifier to language name
527            code = windows_locale.get(int(code, 0))
528        # ...add other platform-specific processing here, if
529        # necessary...
530        return code, encoding
531
532    # fall back on POSIX behaviour
533    import os
534    lookup = os.environ.get
535    for variable in envvars:
536        localename = lookup(variable,None)
537        if localename:
538            if variable == 'LANGUAGE':
539                localename = localename.split(':')[0]
540            break
541    else:
542        localename = 'C'
543    return _parse_localename(localename)
544
545
546def getlocale(category=LC_CTYPE):
547
548    """ Returns the current setting for the given locale category as
549        tuple (language code, encoding).
550
551        category may be one of the LC_* value except LC_ALL. It
552        defaults to LC_CTYPE.
553
554        Except for the code 'C', the language code corresponds to RFC
555        1766.  code and encoding can be None in case the values cannot
556        be determined.
557
558    """
559    localename = _setlocale(category)
560    if category == LC_ALL and ';' in localename:
561        raise TypeError, 'category LC_ALL is not supported'
562    return _parse_localename(localename)
563
564def setlocale(category, locale=None):
565
566    """ Set the locale for the given category.  The locale can be
567        a string, an iterable of two strings (language code and encoding),
568        or None.
569
570        Iterables are converted to strings using the locale aliasing
571        engine.  Locale strings are passed directly to the C lib.
572
573        category may be given as one of the LC_* values.
574
575    """
576    if locale and type(locale) is not type(""):
577        # convert to string
578        locale = normalize(_build_localename(locale))
579    return _setlocale(category, locale)
580
581def resetlocale(category=LC_ALL):
582
583    """ Sets the locale for category to the default setting.
584
585        The default setting is determined by calling
586        getdefaultlocale(). category defaults to LC_ALL.
587
588    """
589    _setlocale(category, _build_localename(getdefaultlocale()))
590
591if sys.platform.startswith("win"):
592    # On Win32, this will return the ANSI code page
593    def getpreferredencoding(do_setlocale = True):
594        """Return the charset that the user is likely using."""
595        import _locale
596        return _locale._getdefaultlocale()[1]
597else:
598    # On Unix, if CODESET is available, use that.
599    try:
600        CODESET
601    except NameError:
602        # Fall back to parsing environment variables :-(
603        def getpreferredencoding(do_setlocale = True):
604            """Return the charset that the user is likely using,
605            by looking at environment variables."""
606            return getdefaultlocale()[1]
607    else:
608        def getpreferredencoding(do_setlocale = True):
609            """Return the charset that the user is likely using,
610            according to the system configuration."""
611            if do_setlocale:
612                oldloc = setlocale(LC_CTYPE)
613                try:
614                    setlocale(LC_CTYPE, "")
615                except Error:
616                    pass
617                result = nl_langinfo(CODESET)
618                setlocale(LC_CTYPE, oldloc)
619                return result
620            else:
621                return nl_langinfo(CODESET)
622
623
624### Database
625#
626# The following data was extracted from the locale.alias file which
627# comes with X11 and then hand edited removing the explicit encoding
628# definitions and adding some more aliases. The file is usually
629# available as /usr/lib/X11/locale/locale.alias.
630#
631
632#
633# The local_encoding_alias table maps lowercase encoding alias names
634# to C locale encoding names (case-sensitive). Note that normalize()
635# first looks up the encoding in the encodings.aliases dictionary and
636# then applies this mapping to find the correct C lib name for the
637# encoding.
638#
639locale_encoding_alias = {
640
641    # Mappings for non-standard encoding names used in locale names
642    '437':                          'C',
643    'c':                            'C',
644    'en':                           'ISO8859-1',
645    'jis':                          'JIS7',
646    'jis7':                         'JIS7',
647    'ajec':                         'eucJP',
648
649    # Mappings from Python codec names to C lib encoding names
650    'ascii':                        'ISO8859-1',
651    'latin_1':                      'ISO8859-1',
652    'iso8859_1':                    'ISO8859-1',
653    'iso8859_10':                   'ISO8859-10',
654    'iso8859_11':                   'ISO8859-11',
655    'iso8859_13':                   'ISO8859-13',
656    'iso8859_14':                   'ISO8859-14',
657    'iso8859_15':                   'ISO8859-15',
658    'iso8859_16':                   'ISO8859-16',
659    'iso8859_2':                    'ISO8859-2',
660    'iso8859_3':                    'ISO8859-3',
661    'iso8859_4':                    'ISO8859-4',
662    'iso8859_5':                    'ISO8859-5',
663    'iso8859_6':                    'ISO8859-6',
664    'iso8859_7':                    'ISO8859-7',
665    'iso8859_8':                    'ISO8859-8',
666    'iso8859_9':                    'ISO8859-9',
667    'iso2022_jp':                   'JIS7',
668    'shift_jis':                    'SJIS',
669    'tactis':                       'TACTIS',
670    'euc_jp':                       'eucJP',
671    'euc_kr':                       'eucKR',
672    'utf_8':                        'UTF-8',
673    'koi8_r':                       'KOI8-R',
674    'koi8_u':                       'KOI8-U',
675    # XXX This list is still incomplete. If you know more
676    # mappings, please file a bug report. Thanks.
677}
678
679#
680# The locale_alias table maps lowercase alias names to C locale names
681# (case-sensitive). Encodings are always separated from the locale
682# name using a dot ('.'); they should only be given in case the
683# language name is needed to interpret the given encoding alias
684# correctly (CJK codes often have this need).
685#
686# Note that the normalize() function which uses this tables
687# removes '_' and '-' characters from the encoding part of the
688# locale name before doing the lookup. This saves a lot of
689# space in the table.
690#
691# MAL 2004-12-10:
692# Updated alias mapping to most recent locale.alias file
693# from X.org distribution using makelocalealias.py.
694#
695# These are the differences compared to the old mapping (Python 2.4
696# and older):
697#
698#    updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
699#    updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
700#    updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
701#    updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
702#    updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
703#    updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
704#    updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1'
705#    updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
706#    updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
707#    updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
708#    updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
709#    updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
710#    updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
711#    updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP'
712#    updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13'
713#    updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13'
714#    updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
715#    updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
716#    updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11'
717#    updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312'
718#    updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5'
719#    updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5'
720#
721# MAL 2008-05-30:
722# Updated alias mapping to most recent locale.alias file
723# from X.org distribution using makelocalealias.py.
724#
725# These are the differences compared to the old mapping (Python 2.5
726# and older):
727#
728#    updated 'cs_cs.iso88592' -> 'cs_CZ.ISO8859-2' to 'cs_CS.ISO8859-2'
729#    updated 'serbocroatian' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
730#    updated 'sh' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
731#    updated 'sh_hr.iso88592' -> 'sh_HR.ISO8859-2' to 'hr_HR.ISO8859-2'
732#    updated 'sh_sp' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
733#    updated 'sh_yu' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
734#    updated 'sp' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
735#    updated 'sp_yu' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
736#    updated 'sr' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
737#    updated 'sr@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
738#    updated 'sr_sp' -> 'sr_SP.ISO8859-2' to 'sr_CS.ISO8859-2'
739#    updated 'sr_yu' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
740#    updated 'sr_yu.cp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'
741#    updated 'sr_yu.iso88592' -> 'sr_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
742#    updated 'sr_yu.iso88595' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
743#    updated 'sr_yu.iso88595@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
744#    updated 'sr_yu.microsoftcp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'
745#    updated 'sr_yu.utf8@cyrillic' -> 'sr_YU.UTF-8' to 'sr_CS.UTF-8'
746#    updated 'sr_yu@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
747#
748# AP 2010-04-12:
749# Updated alias mapping to most recent locale.alias file
750# from X.org distribution using makelocalealias.py.
751#
752# These are the differences compared to the old mapping (Python 2.6.5
753# and older):
754#
755#    updated 'ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
756#    updated 'ru_ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
757#    updated 'serbocroatian' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
758#    updated 'sh' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
759#    updated 'sh_yu' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
760#    updated 'sr' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
761#    updated 'sr@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
762#    updated 'sr@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
763#    updated 'sr_cs.utf8@latn' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8@latin'
764#    updated 'sr_cs@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
765#    updated 'sr_yu' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8@latin'
766#    updated 'sr_yu.utf8@cyrillic' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8'
767#    updated 'sr_yu@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
768#
769# SS 2013-12-20:
770# Updated alias mapping to most recent locale.alias file
771# from X.org distribution using makelocalealias.py.
772#
773# These are the differences compared to the old mapping (Python 2.7.6
774# and older):
775#
776#    updated 'a3' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
777#    updated 'a3_az' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
778#    updated 'a3_az.koi8c' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
779#    updated 'cs_cs.iso88592' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
780#    updated 'hebrew' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
781#    updated 'hebrew.iso88598' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
782#    updated 'sd' -> 'sd_IN@devanagari.UTF-8' to 'sd_IN.UTF-8'
783#    updated 'sr@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
784#    updated 'sr_cs' -> 'sr_RS.UTF-8' to 'sr_CS.UTF-8'
785#    updated 'sr_cs.utf8@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
786#    updated 'sr_cs@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
787#
788# SS 2014-10-01:
789# Updated alias mapping with glibc 2.19 supported locales.
790
791locale_alias = {
792    'a3':                                   'az_AZ.KOI8-C',
793    'a3_az':                                'az_AZ.KOI8-C',
794    'a3_az.koi8c':                          'az_AZ.KOI8-C',
795    'a3_az.koic':                           'az_AZ.KOI8-C',
796    'aa_dj':                                'aa_DJ.ISO8859-1',
797    'aa_er':                                'aa_ER.UTF-8',
798    'aa_et':                                'aa_ET.UTF-8',
799    'af':                                   'af_ZA.ISO8859-1',
800    'af_za':                                'af_ZA.ISO8859-1',
801    'af_za.iso88591':                       'af_ZA.ISO8859-1',
802    'am':                                   'am_ET.UTF-8',
803    'am_et':                                'am_ET.UTF-8',
804    'american':                             'en_US.ISO8859-1',
805    'american.iso88591':                    'en_US.ISO8859-1',
806    'an_es':                                'an_ES.ISO8859-15',
807    'ar':                                   'ar_AA.ISO8859-6',
808    'ar_aa':                                'ar_AA.ISO8859-6',
809    'ar_aa.iso88596':                       'ar_AA.ISO8859-6',
810    'ar_ae':                                'ar_AE.ISO8859-6',
811    'ar_ae.iso88596':                       'ar_AE.ISO8859-6',
812    'ar_bh':                                'ar_BH.ISO8859-6',
813    'ar_bh.iso88596':                       'ar_BH.ISO8859-6',
814    'ar_dz':                                'ar_DZ.ISO8859-6',
815    'ar_dz.iso88596':                       'ar_DZ.ISO8859-6',
816    'ar_eg':                                'ar_EG.ISO8859-6',
817    'ar_eg.iso88596':                       'ar_EG.ISO8859-6',
818    'ar_in':                                'ar_IN.UTF-8',
819    'ar_iq':                                'ar_IQ.ISO8859-6',
820    'ar_iq.iso88596':                       'ar_IQ.ISO8859-6',
821    'ar_jo':                                'ar_JO.ISO8859-6',
822    'ar_jo.iso88596':                       'ar_JO.ISO8859-6',
823    'ar_kw':                                'ar_KW.ISO8859-6',
824    'ar_kw.iso88596':                       'ar_KW.ISO8859-6',
825    'ar_lb':                                'ar_LB.ISO8859-6',
826    'ar_lb.iso88596':                       'ar_LB.ISO8859-6',
827    'ar_ly':                                'ar_LY.ISO8859-6',
828    'ar_ly.iso88596':                       'ar_LY.ISO8859-6',
829    'ar_ma':                                'ar_MA.ISO8859-6',
830    'ar_ma.iso88596':                       'ar_MA.ISO8859-6',
831    'ar_om':                                'ar_OM.ISO8859-6',
832    'ar_om.iso88596':                       'ar_OM.ISO8859-6',
833    'ar_qa':                                'ar_QA.ISO8859-6',
834    'ar_qa.iso88596':                       'ar_QA.ISO8859-6',
835    'ar_sa':                                'ar_SA.ISO8859-6',
836    'ar_sa.iso88596':                       'ar_SA.ISO8859-6',
837    'ar_sd':                                'ar_SD.ISO8859-6',
838    'ar_sd.iso88596':                       'ar_SD.ISO8859-6',
839    'ar_sy':                                'ar_SY.ISO8859-6',
840    'ar_sy.iso88596':                       'ar_SY.ISO8859-6',
841    'ar_tn':                                'ar_TN.ISO8859-6',
842    'ar_tn.iso88596':                       'ar_TN.ISO8859-6',
843    'ar_ye':                                'ar_YE.ISO8859-6',
844    'ar_ye.iso88596':                       'ar_YE.ISO8859-6',
845    'arabic':                               'ar_AA.ISO8859-6',
846    'arabic.iso88596':                      'ar_AA.ISO8859-6',
847    'as':                                   'as_IN.UTF-8',
848    'as_in':                                'as_IN.UTF-8',
849    'ast_es':                               'ast_ES.ISO8859-15',
850    'ayc_pe':                               'ayc_PE.UTF-8',
851    'az':                                   'az_AZ.ISO8859-9E',
852    'az_az':                                'az_AZ.ISO8859-9E',
853    'az_az.iso88599e':                      'az_AZ.ISO8859-9E',
854    'be':                                   'be_BY.CP1251',
855    'be@latin':                             'be_BY.UTF-8@latin',
856    'be_bg.utf8':                           'bg_BG.UTF-8',
857    'be_by':                                'be_BY.CP1251',
858    'be_by.cp1251':                         'be_BY.CP1251',
859    'be_by.microsoftcp1251':                'be_BY.CP1251',
860    'be_by.utf8@latin':                     'be_BY.UTF-8@latin',
861    'be_by@latin':                          'be_BY.UTF-8@latin',
862    'bem_zm':                               'bem_ZM.UTF-8',
863    'ber_dz':                               'ber_DZ.UTF-8',
864    'ber_ma':                               'ber_MA.UTF-8',
865    'bg':                                   'bg_BG.CP1251',
866    'bg_bg':                                'bg_BG.CP1251',
867    'bg_bg.cp1251':                         'bg_BG.CP1251',
868    'bg_bg.iso88595':                       'bg_BG.ISO8859-5',
869    'bg_bg.koi8r':                          'bg_BG.KOI8-R',
870    'bg_bg.microsoftcp1251':                'bg_BG.CP1251',
871    'bho_in':                               'bho_IN.UTF-8',
872    'bn_bd':                                'bn_BD.UTF-8',
873    'bn_in':                                'bn_IN.UTF-8',
874    'bo_cn':                                'bo_CN.UTF-8',
875    'bo_in':                                'bo_IN.UTF-8',
876    'bokmal':                               'nb_NO.ISO8859-1',
877    'bokm\xe5l':                            'nb_NO.ISO8859-1',
878    'br':                                   'br_FR.ISO8859-1',
879    'br_fr':                                'br_FR.ISO8859-1',
880    'br_fr.iso88591':                       'br_FR.ISO8859-1',
881    'br_fr.iso885914':                      'br_FR.ISO8859-14',
882    'br_fr.iso885915':                      'br_FR.ISO8859-15',
883    'br_fr.iso885915@euro':                 'br_FR.ISO8859-15',
884    'br_fr.utf8@euro':                      'br_FR.UTF-8',
885    'br_fr@euro':                           'br_FR.ISO8859-15',
886    'brx_in':                               'brx_IN.UTF-8',
887    'bs':                                   'bs_BA.ISO8859-2',
888    'bs_ba':                                'bs_BA.ISO8859-2',
889    'bs_ba.iso88592':                       'bs_BA.ISO8859-2',
890    'bulgarian':                            'bg_BG.CP1251',
891    'byn_er':                               'byn_ER.UTF-8',
892    'c':                                    'C',
893    'c-french':                             'fr_CA.ISO8859-1',
894    'c-french.iso88591':                    'fr_CA.ISO8859-1',
895    'c.ascii':                              'C',
896    'c.en':                                 'C',
897    'c.iso88591':                           'en_US.ISO8859-1',
898    'c.utf8':                               'en_US.UTF-8',
899    'c_c':                                  'C',
900    'c_c.c':                                'C',
901    'ca':                                   'ca_ES.ISO8859-1',
902    'ca_ad':                                'ca_AD.ISO8859-1',
903    'ca_ad.iso88591':                       'ca_AD.ISO8859-1',
904    'ca_ad.iso885915':                      'ca_AD.ISO8859-15',
905    'ca_ad.iso885915@euro':                 'ca_AD.ISO8859-15',
906    'ca_ad.utf8@euro':                      'ca_AD.UTF-8',
907    'ca_ad@euro':                           'ca_AD.ISO8859-15',
908    'ca_es':                                'ca_ES.ISO8859-1',
909    'ca_es.iso88591':                       'ca_ES.ISO8859-1',
910    'ca_es.iso885915':                      'ca_ES.ISO8859-15',
911    'ca_es.iso885915@euro':                 'ca_ES.ISO8859-15',
912    'ca_es.utf8@euro':                      'ca_ES.UTF-8',
913    'ca_es@valencia':                       'ca_ES.ISO8859-15@valencia',
914    'ca_es@euro':                           'ca_ES.ISO8859-15',
915    'ca_fr':                                'ca_FR.ISO8859-1',
916    'ca_fr.iso88591':                       'ca_FR.ISO8859-1',
917    'ca_fr.iso885915':                      'ca_FR.ISO8859-15',
918    'ca_fr.iso885915@euro':                 'ca_FR.ISO8859-15',
919    'ca_fr.utf8@euro':                      'ca_FR.UTF-8',
920    'ca_fr@euro':                           'ca_FR.ISO8859-15',
921    'ca_it':                                'ca_IT.ISO8859-1',
922    'ca_it.iso88591':                       'ca_IT.ISO8859-1',
923    'ca_it.iso885915':                      'ca_IT.ISO8859-15',
924    'ca_it.iso885915@euro':                 'ca_IT.ISO8859-15',
925    'ca_it.utf8@euro':                      'ca_IT.UTF-8',
926    'ca_it@euro':                           'ca_IT.ISO8859-15',
927    'catalan':                              'ca_ES.ISO8859-1',
928    'cextend':                              'en_US.ISO8859-1',
929    'cextend.en':                           'en_US.ISO8859-1',
930    'chinese-s':                            'zh_CN.eucCN',
931    'chinese-t':                            'zh_TW.eucTW',
932    'crh_ua':                               'crh_UA.UTF-8',
933    'croatian':                             'hr_HR.ISO8859-2',
934    'cs':                                   'cs_CZ.ISO8859-2',
935    'cs_cs':                                'cs_CZ.ISO8859-2',
936    'cs_cs.iso88592':                       'cs_CZ.ISO8859-2',
937    'cs_cz':                                'cs_CZ.ISO8859-2',
938    'cs_cz.iso88592':                       'cs_CZ.ISO8859-2',
939    'csb_pl':                               'csb_PL.UTF-8',
940    'cv_ru':                                'cv_RU.UTF-8',
941    'cy':                                   'cy_GB.ISO8859-1',
942    'cy_gb':                                'cy_GB.ISO8859-1',
943    'cy_gb.iso88591':                       'cy_GB.ISO8859-1',
944    'cy_gb.iso885914':                      'cy_GB.ISO8859-14',
945    'cy_gb.iso885915':                      'cy_GB.ISO8859-15',
946    'cy_gb@euro':                           'cy_GB.ISO8859-15',
947    'cz':                                   'cs_CZ.ISO8859-2',
948    'cz_cz':                                'cs_CZ.ISO8859-2',
949    'czech':                                'cs_CZ.ISO8859-2',
950    'da':                                   'da_DK.ISO8859-1',
951    'da.iso885915':                         'da_DK.ISO8859-15',
952    'da_dk':                                'da_DK.ISO8859-1',
953    'da_dk.88591':                          'da_DK.ISO8859-1',
954    'da_dk.885915':                         'da_DK.ISO8859-15',
955    'da_dk.iso88591':                       'da_DK.ISO8859-1',
956    'da_dk.iso885915':                      'da_DK.ISO8859-15',
957    'da_dk@euro':                           'da_DK.ISO8859-15',
958    'danish':                               'da_DK.ISO8859-1',
959    'danish.iso88591':                      'da_DK.ISO8859-1',
960    'dansk':                                'da_DK.ISO8859-1',
961    'de':                                   'de_DE.ISO8859-1',
962    'de.iso885915':                         'de_DE.ISO8859-15',
963    'de_at':                                'de_AT.ISO8859-1',
964    'de_at.iso88591':                       'de_AT.ISO8859-1',
965    'de_at.iso885915':                      'de_AT.ISO8859-15',
966    'de_at.iso885915@euro':                 'de_AT.ISO8859-15',
967    'de_at.utf8@euro':                      'de_AT.UTF-8',
968    'de_at@euro':                           'de_AT.ISO8859-15',
969    'de_be':                                'de_BE.ISO8859-1',
970    'de_be.iso88591':                       'de_BE.ISO8859-1',
971    'de_be.iso885915':                      'de_BE.ISO8859-15',
972    'de_be.iso885915@euro':                 'de_BE.ISO8859-15',
973    'de_be.utf8@euro':                      'de_BE.UTF-8',
974    'de_be@euro':                           'de_BE.ISO8859-15',
975    'de_ch':                                'de_CH.ISO8859-1',
976    'de_ch.iso88591':                       'de_CH.ISO8859-1',
977    'de_ch.iso885915':                      'de_CH.ISO8859-15',
978    'de_ch@euro':                           'de_CH.ISO8859-15',
979    'de_de':                                'de_DE.ISO8859-1',
980    'de_de.88591':                          'de_DE.ISO8859-1',
981    'de_de.885915':                         'de_DE.ISO8859-15',
982    'de_de.885915@euro':                    'de_DE.ISO8859-15',
983    'de_de.iso88591':                       'de_DE.ISO8859-1',
984    'de_de.iso885915':                      'de_DE.ISO8859-15',
985    'de_de.iso885915@euro':                 'de_DE.ISO8859-15',
986    'de_de.utf8@euro':                      'de_DE.UTF-8',
987    'de_de@euro':                           'de_DE.ISO8859-15',
988    'de_li.utf8':                           'de_LI.UTF-8',
989    'de_lu':                                'de_LU.ISO8859-1',
990    'de_lu.iso88591':                       'de_LU.ISO8859-1',
991    'de_lu.iso885915':                      'de_LU.ISO8859-15',
992    'de_lu.iso885915@euro':                 'de_LU.ISO8859-15',
993    'de_lu.utf8@euro':                      'de_LU.UTF-8',
994    'de_lu@euro':                           'de_LU.ISO8859-15',
995    'deutsch':                              'de_DE.ISO8859-1',
996    'doi_in':                               'doi_IN.UTF-8',
997    'dutch':                                'nl_NL.ISO8859-1',
998    'dutch.iso88591':                       'nl_BE.ISO8859-1',
999    'dv_mv':                                'dv_MV.UTF-8',
1000    'dz_bt':                                'dz_BT.UTF-8',
1001    'ee':                                   'ee_EE.ISO8859-4',
1002    'ee_ee':                                'ee_EE.ISO8859-4',
1003    'ee_ee.iso88594':                       'ee_EE.ISO8859-4',
1004    'eesti':                                'et_EE.ISO8859-1',
1005    'el':                                   'el_GR.ISO8859-7',
1006    'el_cy':                                'el_CY.ISO8859-7',
1007    'el_gr':                                'el_GR.ISO8859-7',
1008    'el_gr.iso88597':                       'el_GR.ISO8859-7',
1009    'el_gr@euro':                           'el_GR.ISO8859-15',
1010    'en':                                   'en_US.ISO8859-1',
1011    'en.iso88591':                          'en_US.ISO8859-1',
1012    'en_ag':                                'en_AG.UTF-8',
1013    'en_au':                                'en_AU.ISO8859-1',
1014    'en_au.iso88591':                       'en_AU.ISO8859-1',
1015    'en_be':                                'en_BE.ISO8859-1',
1016    'en_be@euro':                           'en_BE.ISO8859-15',
1017    'en_bw':                                'en_BW.ISO8859-1',
1018    'en_bw.iso88591':                       'en_BW.ISO8859-1',
1019    'en_ca':                                'en_CA.ISO8859-1',
1020    'en_ca.iso88591':                       'en_CA.ISO8859-1',
1021    'en_dk':                                'en_DK.ISO8859-1',
1022    'en_dl.utf8':                           'en_DL.UTF-8',
1023    'en_gb':                                'en_GB.ISO8859-1',
1024    'en_gb.88591':                          'en_GB.ISO8859-1',
1025    'en_gb.iso88591':                       'en_GB.ISO8859-1',
1026    'en_gb.iso885915':                      'en_GB.ISO8859-15',
1027    'en_gb@euro':                           'en_GB.ISO8859-15',
1028    'en_hk':                                'en_HK.ISO8859-1',
1029    'en_hk.iso88591':                       'en_HK.ISO8859-1',
1030    'en_ie':                                'en_IE.ISO8859-1',
1031    'en_ie.iso88591':                       'en_IE.ISO8859-1',
1032    'en_ie.iso885915':                      'en_IE.ISO8859-15',
1033    'en_ie.iso885915@euro':                 'en_IE.ISO8859-15',
1034    'en_ie.utf8@euro':                      'en_IE.UTF-8',
1035    'en_ie@euro':                           'en_IE.ISO8859-15',
1036    'en_in':                                'en_IN.ISO8859-1',
1037    'en_ng':                                'en_NG.UTF-8',
1038    'en_nz':                                'en_NZ.ISO8859-1',
1039    'en_nz.iso88591':                       'en_NZ.ISO8859-1',
1040    'en_ph':                                'en_PH.ISO8859-1',
1041    'en_ph.iso88591':                       'en_PH.ISO8859-1',
1042    'en_sg':                                'en_SG.ISO8859-1',
1043    'en_sg.iso88591':                       'en_SG.ISO8859-1',
1044    'en_uk':                                'en_GB.ISO8859-1',
1045    'en_us':                                'en_US.ISO8859-1',
1046    'en_us.88591':                          'en_US.ISO8859-1',
1047    'en_us.885915':                         'en_US.ISO8859-15',
1048    'en_us.iso88591':                       'en_US.ISO8859-1',
1049    'en_us.iso885915':                      'en_US.ISO8859-15',
1050    'en_us.iso885915@euro':                 'en_US.ISO8859-15',
1051    'en_us@euro':                           'en_US.ISO8859-15',
1052    'en_us@euro@euro':                      'en_US.ISO8859-15',
1053    'en_za':                                'en_ZA.ISO8859-1',
1054    'en_za.88591':                          'en_ZA.ISO8859-1',
1055    'en_za.iso88591':                       'en_ZA.ISO8859-1',
1056    'en_za.iso885915':                      'en_ZA.ISO8859-15',
1057    'en_za@euro':                           'en_ZA.ISO8859-15',
1058    'en_zm':                                'en_ZM.UTF-8',
1059    'en_zw':                                'en_ZW.ISO8859-1',
1060    'en_zw.iso88591':                       'en_ZW.ISO8859-1',
1061    'en_zw.utf8':                           'en_ZS.UTF-8',
1062    'eng_gb':                               'en_GB.ISO8859-1',
1063    'eng_gb.8859':                          'en_GB.ISO8859-1',
1064    'english':                              'en_EN.ISO8859-1',
1065    'english.iso88591':                     'en_EN.ISO8859-1',
1066    'english_uk':                           'en_GB.ISO8859-1',
1067    'english_uk.8859':                      'en_GB.ISO8859-1',
1068    'english_united-states':                'en_US.ISO8859-1',
1069    'english_united-states.437':            'C',
1070    'english_us':                           'en_US.ISO8859-1',
1071    'english_us.8859':                      'en_US.ISO8859-1',
1072    'english_us.ascii':                     'en_US.ISO8859-1',
1073    'eo':                                   'eo_XX.ISO8859-3',
1074    'eo.utf8':                              'eo.UTF-8',
1075    'eo_eo':                                'eo_EO.ISO8859-3',
1076    'eo_eo.iso88593':                       'eo_EO.ISO8859-3',
1077    'eo_us.utf8':                           'eo_US.UTF-8',
1078    'eo_xx':                                'eo_XX.ISO8859-3',
1079    'eo_xx.iso88593':                       'eo_XX.ISO8859-3',
1080    'es':                                   'es_ES.ISO8859-1',
1081    'es_ar':                                'es_AR.ISO8859-1',
1082    'es_ar.iso88591':                       'es_AR.ISO8859-1',
1083    'es_bo':                                'es_BO.ISO8859-1',
1084    'es_bo.iso88591':                       'es_BO.ISO8859-1',
1085    'es_cl':                                'es_CL.ISO8859-1',
1086    'es_cl.iso88591':                       'es_CL.ISO8859-1',
1087    'es_co':                                'es_CO.ISO8859-1',
1088    'es_co.iso88591':                       'es_CO.ISO8859-1',
1089    'es_cr':                                'es_CR.ISO8859-1',
1090    'es_cr.iso88591':                       'es_CR.ISO8859-1',
1091    'es_cu':                                'es_CU.UTF-8',
1092    'es_do':                                'es_DO.ISO8859-1',
1093    'es_do.iso88591':                       'es_DO.ISO8859-1',
1094    'es_ec':                                'es_EC.ISO8859-1',
1095    'es_ec.iso88591':                       'es_EC.ISO8859-1',
1096    'es_es':                                'es_ES.ISO8859-1',
1097    'es_es.88591':                          'es_ES.ISO8859-1',
1098    'es_es.iso88591':                       'es_ES.ISO8859-1',
1099    'es_es.iso885915':                      'es_ES.ISO8859-15',
1100    'es_es.iso885915@euro':                 'es_ES.ISO8859-15',
1101    'es_es.utf8@euro':                      'es_ES.UTF-8',
1102    'es_es@euro':                           'es_ES.ISO8859-15',
1103    'es_gt':                                'es_GT.ISO8859-1',
1104    'es_gt.iso88591':                       'es_GT.ISO8859-1',
1105    'es_hn':                                'es_HN.ISO8859-1',
1106    'es_hn.iso88591':                       'es_HN.ISO8859-1',
1107    'es_mx':                                'es_MX.ISO8859-1',
1108    'es_mx.iso88591':                       'es_MX.ISO8859-1',
1109    'es_ni':                                'es_NI.ISO8859-1',
1110    'es_ni.iso88591':                       'es_NI.ISO8859-1',
1111    'es_pa':                                'es_PA.ISO8859-1',
1112    'es_pa.iso88591':                       'es_PA.ISO8859-1',
1113    'es_pa.iso885915':                      'es_PA.ISO8859-15',
1114    'es_pa@euro':                           'es_PA.ISO8859-15',
1115    'es_pe':                                'es_PE.ISO8859-1',
1116    'es_pe.iso88591':                       'es_PE.ISO8859-1',
1117    'es_pe.iso885915':                      'es_PE.ISO8859-15',
1118    'es_pe@euro':                           'es_PE.ISO8859-15',
1119    'es_pr':                                'es_PR.ISO8859-1',
1120    'es_pr.iso88591':                       'es_PR.ISO8859-1',
1121    'es_py':                                'es_PY.ISO8859-1',
1122    'es_py.iso88591':                       'es_PY.ISO8859-1',
1123    'es_py.iso885915':                      'es_PY.ISO8859-15',
1124    'es_py@euro':                           'es_PY.ISO8859-15',
1125    'es_sv':                                'es_SV.ISO8859-1',
1126    'es_sv.iso88591':                       'es_SV.ISO8859-1',
1127    'es_sv.iso885915':                      'es_SV.ISO8859-15',
1128    'es_sv@euro':                           'es_SV.ISO8859-15',
1129    'es_us':                                'es_US.ISO8859-1',
1130    'es_us.iso88591':                       'es_US.ISO8859-1',
1131    'es_uy':                                'es_UY.ISO8859-1',
1132    'es_uy.iso88591':                       'es_UY.ISO8859-1',
1133    'es_uy.iso885915':                      'es_UY.ISO8859-15',
1134    'es_uy@euro':                           'es_UY.ISO8859-15',
1135    'es_ve':                                'es_VE.ISO8859-1',
1136    'es_ve.iso88591':                       'es_VE.ISO8859-1',
1137    'es_ve.iso885915':                      'es_VE.ISO8859-15',
1138    'es_ve@euro':                           'es_VE.ISO8859-15',
1139    'estonian':                             'et_EE.ISO8859-1',
1140    'et':                                   'et_EE.ISO8859-15',
1141    'et_ee':                                'et_EE.ISO8859-15',
1142    'et_ee.iso88591':                       'et_EE.ISO8859-1',
1143    'et_ee.iso885913':                      'et_EE.ISO8859-13',
1144    'et_ee.iso885915':                      'et_EE.ISO8859-15',
1145    'et_ee.iso88594':                       'et_EE.ISO8859-4',
1146    'et_ee@euro':                           'et_EE.ISO8859-15',
1147    'eu':                                   'eu_ES.ISO8859-1',
1148    'eu_es':                                'eu_ES.ISO8859-1',
1149    'eu_es.iso88591':                       'eu_ES.ISO8859-1',
1150    'eu_es.iso885915':                      'eu_ES.ISO8859-15',
1151    'eu_es.iso885915@euro':                 'eu_ES.ISO8859-15',
1152    'eu_es.utf8@euro':                      'eu_ES.UTF-8',
1153    'eu_es@euro':                           'eu_ES.ISO8859-15',
1154    'eu_fr':                                'eu_FR.ISO8859-1',
1155    'fa':                                   'fa_IR.UTF-8',
1156    'fa_ir':                                'fa_IR.UTF-8',
1157    'fa_ir.isiri3342':                      'fa_IR.ISIRI-3342',
1158    'ff_sn':                                'ff_SN.UTF-8',
1159    'fi':                                   'fi_FI.ISO8859-15',
1160    'fi.iso885915':                         'fi_FI.ISO8859-15',
1161    'fi_fi':                                'fi_FI.ISO8859-15',
1162    'fi_fi.88591':                          'fi_FI.ISO8859-1',
1163    'fi_fi.iso88591':                       'fi_FI.ISO8859-1',
1164    'fi_fi.iso885915':                      'fi_FI.ISO8859-15',
1165    'fi_fi.iso885915@euro':                 'fi_FI.ISO8859-15',
1166    'fi_fi.utf8@euro':                      'fi_FI.UTF-8',
1167    'fi_fi@euro':                           'fi_FI.ISO8859-15',
1168    'fil_ph':                               'fil_PH.UTF-8',
1169    'finnish':                              'fi_FI.ISO8859-1',
1170    'finnish.iso88591':                     'fi_FI.ISO8859-1',
1171    'fo':                                   'fo_FO.ISO8859-1',
1172    'fo_fo':                                'fo_FO.ISO8859-1',
1173    'fo_fo.iso88591':                       'fo_FO.ISO8859-1',
1174    'fo_fo.iso885915':                      'fo_FO.ISO8859-15',
1175    'fo_fo@euro':                           'fo_FO.ISO8859-15',
1176    'fr':                                   'fr_FR.ISO8859-1',
1177    'fr.iso885915':                         'fr_FR.ISO8859-15',
1178    'fr_be':                                'fr_BE.ISO8859-1',
1179    'fr_be.88591':                          'fr_BE.ISO8859-1',
1180    'fr_be.iso88591':                       'fr_BE.ISO8859-1',
1181    'fr_be.iso885915':                      'fr_BE.ISO8859-15',
1182    'fr_be.iso885915@euro':                 'fr_BE.ISO8859-15',
1183    'fr_be.utf8@euro':                      'fr_BE.UTF-8',
1184    'fr_be@euro':                           'fr_BE.ISO8859-15',
1185    'fr_ca':                                'fr_CA.ISO8859-1',
1186    'fr_ca.88591':                          'fr_CA.ISO8859-1',
1187    'fr_ca.iso88591':                       'fr_CA.ISO8859-1',
1188    'fr_ca.iso885915':                      'fr_CA.ISO8859-15',
1189    'fr_ca@euro':                           'fr_CA.ISO8859-15',
1190    'fr_ch':                                'fr_CH.ISO8859-1',
1191    'fr_ch.88591':                          'fr_CH.ISO8859-1',
1192    'fr_ch.iso88591':                       'fr_CH.ISO8859-1',
1193    'fr_ch.iso885915':                      'fr_CH.ISO8859-15',
1194    'fr_ch@euro':                           'fr_CH.ISO8859-15',
1195    'fr_fr':                                'fr_FR.ISO8859-1',
1196    'fr_fr.88591':                          'fr_FR.ISO8859-1',
1197    'fr_fr.iso88591':                       'fr_FR.ISO8859-1',
1198    'fr_fr.iso885915':                      'fr_FR.ISO8859-15',
1199    'fr_fr.iso885915@euro':                 'fr_FR.ISO8859-15',
1200    'fr_fr.utf8@euro':                      'fr_FR.UTF-8',
1201    'fr_fr@euro':                           'fr_FR.ISO8859-15',
1202    'fr_lu':                                'fr_LU.ISO8859-1',
1203    'fr_lu.88591':                          'fr_LU.ISO8859-1',
1204    'fr_lu.iso88591':                       'fr_LU.ISO8859-1',
1205    'fr_lu.iso885915':                      'fr_LU.ISO8859-15',
1206    'fr_lu.iso885915@euro':                 'fr_LU.ISO8859-15',
1207    'fr_lu.utf8@euro':                      'fr_LU.UTF-8',
1208    'fr_lu@euro':                           'fr_LU.ISO8859-15',
1209    'fran\xe7ais':                          'fr_FR.ISO8859-1',
1210    'fre_fr':                               'fr_FR.ISO8859-1',
1211    'fre_fr.8859':                          'fr_FR.ISO8859-1',
1212    'french':                               'fr_FR.ISO8859-1',
1213    'french.iso88591':                      'fr_CH.ISO8859-1',
1214    'french_france':                        'fr_FR.ISO8859-1',
1215    'french_france.8859':                   'fr_FR.ISO8859-1',
1216    'fur_it':                               'fur_IT.UTF-8',
1217    'fy_de':                                'fy_DE.UTF-8',
1218    'fy_nl':                                'fy_NL.UTF-8',
1219    'ga':                                   'ga_IE.ISO8859-1',
1220    'ga_ie':                                'ga_IE.ISO8859-1',
1221    'ga_ie.iso88591':                       'ga_IE.ISO8859-1',
1222    'ga_ie.iso885914':                      'ga_IE.ISO8859-14',
1223    'ga_ie.iso885915':                      'ga_IE.ISO8859-15',
1224    'ga_ie.iso885915@euro':                 'ga_IE.ISO8859-15',
1225    'ga_ie.utf8@euro':                      'ga_IE.UTF-8',
1226    'ga_ie@euro':                           'ga_IE.ISO8859-15',
1227    'galego':                               'gl_ES.ISO8859-1',
1228    'galician':                             'gl_ES.ISO8859-1',
1229    'gd':                                   'gd_GB.ISO8859-1',
1230    'gd_gb':                                'gd_GB.ISO8859-1',
1231    'gd_gb.iso88591':                       'gd_GB.ISO8859-1',
1232    'gd_gb.iso885914':                      'gd_GB.ISO8859-14',
1233    'gd_gb.iso885915':                      'gd_GB.ISO8859-15',
1234    'gd_gb@euro':                           'gd_GB.ISO8859-15',
1235    'ger_de':                               'de_DE.ISO8859-1',
1236    'ger_de.8859':                          'de_DE.ISO8859-1',
1237    'german':                               'de_DE.ISO8859-1',
1238    'german.iso88591':                      'de_CH.ISO8859-1',
1239    'german_germany':                       'de_DE.ISO8859-1',
1240    'german_germany.8859':                  'de_DE.ISO8859-1',
1241    'gez_er':                               'gez_ER.UTF-8',
1242    'gez_et':                               'gez_ET.UTF-8',
1243    'gl':                                   'gl_ES.ISO8859-1',
1244    'gl_es':                                'gl_ES.ISO8859-1',
1245    'gl_es.iso88591':                       'gl_ES.ISO8859-1',
1246    'gl_es.iso885915':                      'gl_ES.ISO8859-15',
1247    'gl_es.iso885915@euro':                 'gl_ES.ISO8859-15',
1248    'gl_es.utf8@euro':                      'gl_ES.UTF-8',
1249    'gl_es@euro':                           'gl_ES.ISO8859-15',
1250    'greek':                                'el_GR.ISO8859-7',
1251    'greek.iso88597':                       'el_GR.ISO8859-7',
1252    'gu_in':                                'gu_IN.UTF-8',
1253    'gv':                                   'gv_GB.ISO8859-1',
1254    'gv_gb':                                'gv_GB.ISO8859-1',
1255    'gv_gb.iso88591':                       'gv_GB.ISO8859-1',
1256    'gv_gb.iso885914':                      'gv_GB.ISO8859-14',
1257    'gv_gb.iso885915':                      'gv_GB.ISO8859-15',
1258    'gv_gb@euro':                           'gv_GB.ISO8859-15',
1259    'ha_ng':                                'ha_NG.UTF-8',
1260    'he':                                   'he_IL.ISO8859-8',
1261    'he_il':                                'he_IL.ISO8859-8',
1262    'he_il.cp1255':                         'he_IL.CP1255',
1263    'he_il.iso88598':                       'he_IL.ISO8859-8',
1264    'he_il.microsoftcp1255':                'he_IL.CP1255',
1265    'hebrew':                               'he_IL.ISO8859-8',
1266    'hebrew.iso88598':                      'he_IL.ISO8859-8',
1267    'hi':                                   'hi_IN.ISCII-DEV',
1268    'hi_in':                                'hi_IN.ISCII-DEV',
1269    'hi_in.isciidev':                       'hi_IN.ISCII-DEV',
1270    'hne':                                  'hne_IN.UTF-8',
1271    'hne_in':                               'hne_IN.UTF-8',
1272    'hr':                                   'hr_HR.ISO8859-2',
1273    'hr_hr':                                'hr_HR.ISO8859-2',
1274    'hr_hr.iso88592':                       'hr_HR.ISO8859-2',
1275    'hrvatski':                             'hr_HR.ISO8859-2',
1276    'hsb_de':                               'hsb_DE.ISO8859-2',
1277    'ht_ht':                                'ht_HT.UTF-8',
1278    'hu':                                   'hu_HU.ISO8859-2',
1279    'hu_hu':                                'hu_HU.ISO8859-2',
1280    'hu_hu.iso88592':                       'hu_HU.ISO8859-2',
1281    'hungarian':                            'hu_HU.ISO8859-2',
1282    'hy_am':                                'hy_AM.UTF-8',
1283    'hy_am.armscii8':                       'hy_AM.ARMSCII_8',
1284    'ia':                                   'ia.UTF-8',
1285    'ia_fr':                                'ia_FR.UTF-8',
1286    'icelandic':                            'is_IS.ISO8859-1',
1287    'icelandic.iso88591':                   'is_IS.ISO8859-1',
1288    'id':                                   'id_ID.ISO8859-1',
1289    'id_id':                                'id_ID.ISO8859-1',
1290    'ig_ng':                                'ig_NG.UTF-8',
1291    'ik_ca':                                'ik_CA.UTF-8',
1292    'in':                                   'id_ID.ISO8859-1',
1293    'in_id':                                'id_ID.ISO8859-1',
1294    'is':                                   'is_IS.ISO8859-1',
1295    'is_is':                                'is_IS.ISO8859-1',
1296    'is_is.iso88591':                       'is_IS.ISO8859-1',
1297    'is_is.iso885915':                      'is_IS.ISO8859-15',
1298    'is_is@euro':                           'is_IS.ISO8859-15',
1299    'iso-8859-1':                           'en_US.ISO8859-1',
1300    'iso-8859-15':                          'en_US.ISO8859-15',
1301    'iso8859-1':                            'en_US.ISO8859-1',
1302    'iso8859-15':                           'en_US.ISO8859-15',
1303    'iso_8859_1':                           'en_US.ISO8859-1',
1304    'iso_8859_15':                          'en_US.ISO8859-15',
1305    'it':                                   'it_IT.ISO8859-1',
1306    'it.iso885915':                         'it_IT.ISO8859-15',
1307    'it_ch':                                'it_CH.ISO8859-1',
1308    'it_ch.iso88591':                       'it_CH.ISO8859-1',
1309    'it_ch.iso885915':                      'it_CH.ISO8859-15',
1310    'it_ch@euro':                           'it_CH.ISO8859-15',
1311    'it_it':                                'it_IT.ISO8859-1',
1312    'it_it.88591':                          'it_IT.ISO8859-1',
1313    'it_it.iso88591':                       'it_IT.ISO8859-1',
1314    'it_it.iso885915':                      'it_IT.ISO8859-15',
1315    'it_it.iso885915@euro':                 'it_IT.ISO8859-15',
1316    'it_it.utf8@euro':                      'it_IT.UTF-8',
1317    'it_it@euro':                           'it_IT.ISO8859-15',
1318    'italian':                              'it_IT.ISO8859-1',
1319    'italian.iso88591':                     'it_IT.ISO8859-1',
1320    'iu':                                   'iu_CA.NUNACOM-8',
1321    'iu_ca':                                'iu_CA.NUNACOM-8',
1322    'iu_ca.nunacom8':                       'iu_CA.NUNACOM-8',
1323    'iw':                                   'he_IL.ISO8859-8',
1324    'iw_il':                                'he_IL.ISO8859-8',
1325    'iw_il.iso88598':                       'he_IL.ISO8859-8',
1326    'iw_il.utf8':                           'iw_IL.UTF-8',
1327    'ja':                                   'ja_JP.eucJP',
1328    'ja.jis':                               'ja_JP.JIS7',
1329    'ja.sjis':                              'ja_JP.SJIS',
1330    'ja_jp':                                'ja_JP.eucJP',
1331    'ja_jp.ajec':                           'ja_JP.eucJP',
1332    'ja_jp.euc':                            'ja_JP.eucJP',
1333    'ja_jp.eucjp':                          'ja_JP.eucJP',
1334    'ja_jp.iso-2022-jp':                    'ja_JP.JIS7',
1335    'ja_jp.iso2022jp':                      'ja_JP.JIS7',
1336    'ja_jp.jis':                            'ja_JP.JIS7',
1337    'ja_jp.jis7':                           'ja_JP.JIS7',
1338    'ja_jp.mscode':                         'ja_JP.SJIS',
1339    'ja_jp.pck':                            'ja_JP.SJIS',
1340    'ja_jp.sjis':                           'ja_JP.SJIS',
1341    'ja_jp.ujis':                           'ja_JP.eucJP',
1342    'japan':                                'ja_JP.eucJP',
1343    'japanese':                             'ja_JP.eucJP',
1344    'japanese-euc':                         'ja_JP.eucJP',
1345    'japanese.euc':                         'ja_JP.eucJP',
1346    'japanese.sjis':                        'ja_JP.SJIS',
1347    'jp_jp':                                'ja_JP.eucJP',
1348    'ka':                                   'ka_GE.GEORGIAN-ACADEMY',
1349    'ka_ge':                                'ka_GE.GEORGIAN-ACADEMY',
1350    'ka_ge.georgianacademy':                'ka_GE.GEORGIAN-ACADEMY',
1351    'ka_ge.georgianps':                     'ka_GE.GEORGIAN-PS',
1352    'ka_ge.georgianrs':                     'ka_GE.GEORGIAN-ACADEMY',
1353    'kk_kz':                                'kk_KZ.RK1048',
1354    'kl':                                   'kl_GL.ISO8859-1',
1355    'kl_gl':                                'kl_GL.ISO8859-1',
1356    'kl_gl.iso88591':                       'kl_GL.ISO8859-1',
1357    'kl_gl.iso885915':                      'kl_GL.ISO8859-15',
1358    'kl_gl@euro':                           'kl_GL.ISO8859-15',
1359    'km_kh':                                'km_KH.UTF-8',
1360    'kn':                                   'kn_IN.UTF-8',
1361    'kn_in':                                'kn_IN.UTF-8',
1362    'ko':                                   'ko_KR.eucKR',
1363    'ko_kr':                                'ko_KR.eucKR',
1364    'ko_kr.euc':                            'ko_KR.eucKR',
1365    'ko_kr.euckr':                          'ko_KR.eucKR',
1366    'kok_in':                               'kok_IN.UTF-8',
1367    'korean':                               'ko_KR.eucKR',
1368    'korean.euc':                           'ko_KR.eucKR',
1369    'ks':                                   'ks_IN.UTF-8',
1370    'ks_in':                                'ks_IN.UTF-8',
1371    'ks_in@devanagari':                     'ks_IN.UTF-8@devanagari',
1372    'ks_in@devanagari.utf8':                'ks_IN.UTF-8@devanagari',
1373    'ku_tr':                                'ku_TR.ISO8859-9',
1374    'kw':                                   'kw_GB.ISO8859-1',
1375    'kw_gb':                                'kw_GB.ISO8859-1',
1376    'kw_gb.iso88591':                       'kw_GB.ISO8859-1',
1377    'kw_gb.iso885914':                      'kw_GB.ISO8859-14',
1378    'kw_gb.iso885915':                      'kw_GB.ISO8859-15',
1379    'kw_gb@euro':                           'kw_GB.ISO8859-15',
1380    'ky':                                   'ky_KG.UTF-8',
1381    'ky_kg':                                'ky_KG.UTF-8',
1382    'lb_lu':                                'lb_LU.UTF-8',
1383    'lg_ug':                                'lg_UG.ISO8859-10',
1384    'li_be':                                'li_BE.UTF-8',
1385    'li_nl':                                'li_NL.UTF-8',
1386    'lij_it':                               'lij_IT.UTF-8',
1387    'lithuanian':                           'lt_LT.ISO8859-13',
1388    'lo':                                   'lo_LA.MULELAO-1',
1389    'lo_la':                                'lo_LA.MULELAO-1',
1390    'lo_la.cp1133':                         'lo_LA.IBM-CP1133',
1391    'lo_la.ibmcp1133':                      'lo_LA.IBM-CP1133',
1392    'lo_la.mulelao1':                       'lo_LA.MULELAO-1',
1393    'lt':                                   'lt_LT.ISO8859-13',
1394    'lt_lt':                                'lt_LT.ISO8859-13',
1395    'lt_lt.iso885913':                      'lt_LT.ISO8859-13',
1396    'lt_lt.iso88594':                       'lt_LT.ISO8859-4',
1397    'lv':                                   'lv_LV.ISO8859-13',
1398    'lv_lv':                                'lv_LV.ISO8859-13',
1399    'lv_lv.iso885913':                      'lv_LV.ISO8859-13',
1400    'lv_lv.iso88594':                       'lv_LV.ISO8859-4',
1401    'mag_in':                               'mag_IN.UTF-8',
1402    'mai':                                  'mai_IN.UTF-8',
1403    'mai_in':                               'mai_IN.UTF-8',
1404    'mg_mg':                                'mg_MG.ISO8859-15',
1405    'mhr_ru':                               'mhr_RU.UTF-8',
1406    'mi':                                   'mi_NZ.ISO8859-1',
1407    'mi_nz':                                'mi_NZ.ISO8859-1',
1408    'mi_nz.iso88591':                       'mi_NZ.ISO8859-1',
1409    'mk':                                   'mk_MK.ISO8859-5',
1410    'mk_mk':                                'mk_MK.ISO8859-5',
1411    'mk_mk.cp1251':                         'mk_MK.CP1251',
1412    'mk_mk.iso88595':                       'mk_MK.ISO8859-5',
1413    'mk_mk.microsoftcp1251':                'mk_MK.CP1251',
1414    'ml':                                   'ml_IN.UTF-8',
1415    'ml_in':                                'ml_IN.UTF-8',
1416    'mn_mn':                                'mn_MN.UTF-8',
1417    'mni_in':                               'mni_IN.UTF-8',
1418    'mr':                                   'mr_IN.UTF-8',
1419    'mr_in':                                'mr_IN.UTF-8',
1420    'ms':                                   'ms_MY.ISO8859-1',
1421    'ms_my':                                'ms_MY.ISO8859-1',
1422    'ms_my.iso88591':                       'ms_MY.ISO8859-1',
1423    'mt':                                   'mt_MT.ISO8859-3',
1424    'mt_mt':                                'mt_MT.ISO8859-3',
1425    'mt_mt.iso88593':                       'mt_MT.ISO8859-3',
1426    'my_mm':                                'my_MM.UTF-8',
1427    'nan_tw@latin':                         'nan_TW.UTF-8@latin',
1428    'nb':                                   'nb_NO.ISO8859-1',
1429    'nb_no':                                'nb_NO.ISO8859-1',
1430    'nb_no.88591':                          'nb_NO.ISO8859-1',
1431    'nb_no.iso88591':                       'nb_NO.ISO8859-1',
1432    'nb_no.iso885915':                      'nb_NO.ISO8859-15',
1433    'nb_no@euro':                           'nb_NO.ISO8859-15',
1434    'nds_de':                               'nds_DE.UTF-8',
1435    'nds_nl':                               'nds_NL.UTF-8',
1436    'ne_np':                                'ne_NP.UTF-8',
1437    'nhn_mx':                               'nhn_MX.UTF-8',
1438    'niu_nu':                               'niu_NU.UTF-8',
1439    'niu_nz':                               'niu_NZ.UTF-8',
1440    'nl':                                   'nl_NL.ISO8859-1',
1441    'nl.iso885915':                         'nl_NL.ISO8859-15',
1442    'nl_aw':                                'nl_AW.UTF-8',
1443    'nl_be':                                'nl_BE.ISO8859-1',
1444    'nl_be.88591':                          'nl_BE.ISO8859-1',
1445    'nl_be.iso88591':                       'nl_BE.ISO8859-1',
1446    'nl_be.iso885915':                      'nl_BE.ISO8859-15',
1447    'nl_be.iso885915@euro':                 'nl_BE.ISO8859-15',
1448    'nl_be.utf8@euro':                      'nl_BE.UTF-8',
1449    'nl_be@euro':                           'nl_BE.ISO8859-15',
1450    'nl_nl':                                'nl_NL.ISO8859-1',
1451    'nl_nl.88591':                          'nl_NL.ISO8859-1',
1452    'nl_nl.iso88591':                       'nl_NL.ISO8859-1',
1453    'nl_nl.iso885915':                      'nl_NL.ISO8859-15',
1454    'nl_nl.iso885915@euro':                 'nl_NL.ISO8859-15',
1455    'nl_nl.utf8@euro':                      'nl_NL.UTF-8',
1456    'nl_nl@euro':                           'nl_NL.ISO8859-15',
1457    'nn':                                   'nn_NO.ISO8859-1',
1458    'nn_no':                                'nn_NO.ISO8859-1',
1459    'nn_no.88591':                          'nn_NO.ISO8859-1',
1460    'nn_no.iso88591':                       'nn_NO.ISO8859-1',
1461    'nn_no.iso885915':                      'nn_NO.ISO8859-15',
1462    'nn_no@euro':                           'nn_NO.ISO8859-15',
1463    'no':                                   'no_NO.ISO8859-1',
1464    'no@nynorsk':                           'ny_NO.ISO8859-1',
1465    'no_no':                                'no_NO.ISO8859-1',
1466    'no_no.88591':                          'no_NO.ISO8859-1',
1467    'no_no.iso88591':                       'no_NO.ISO8859-1',
1468    'no_no.iso885915':                      'no_NO.ISO8859-15',
1469    'no_no.iso88591@bokmal':                'no_NO.ISO8859-1',
1470    'no_no.iso88591@nynorsk':               'no_NO.ISO8859-1',
1471    'no_no@euro':                           'no_NO.ISO8859-15',
1472    'norwegian':                            'no_NO.ISO8859-1',
1473    'norwegian.iso88591':                   'no_NO.ISO8859-1',
1474    'nr':                                   'nr_ZA.ISO8859-1',
1475    'nr_za':                                'nr_ZA.ISO8859-1',
1476    'nr_za.iso88591':                       'nr_ZA.ISO8859-1',
1477    'nso':                                  'nso_ZA.ISO8859-15',
1478    'nso_za':                               'nso_ZA.ISO8859-15',
1479    'nso_za.iso885915':                     'nso_ZA.ISO8859-15',
1480    'ny':                                   'ny_NO.ISO8859-1',
1481    'ny_no':                                'ny_NO.ISO8859-1',
1482    'ny_no.88591':                          'ny_NO.ISO8859-1',
1483    'ny_no.iso88591':                       'ny_NO.ISO8859-1',
1484    'ny_no.iso885915':                      'ny_NO.ISO8859-15',
1485    'ny_no@euro':                           'ny_NO.ISO8859-15',
1486    'nynorsk':                              'nn_NO.ISO8859-1',
1487    'oc':                                   'oc_FR.ISO8859-1',
1488    'oc_fr':                                'oc_FR.ISO8859-1',
1489    'oc_fr.iso88591':                       'oc_FR.ISO8859-1',
1490    'oc_fr.iso885915':                      'oc_FR.ISO8859-15',
1491    'oc_fr@euro':                           'oc_FR.ISO8859-15',
1492    'om_et':                                'om_ET.UTF-8',
1493    'om_ke':                                'om_KE.ISO8859-1',
1494    'or':                                   'or_IN.UTF-8',
1495    'or_in':                                'or_IN.UTF-8',
1496    'os_ru':                                'os_RU.UTF-8',
1497    'pa':                                   'pa_IN.UTF-8',
1498    'pa_in':                                'pa_IN.UTF-8',
1499    'pa_pk':                                'pa_PK.UTF-8',
1500    'pap_an':                               'pap_AN.UTF-8',
1501    'pd':                                   'pd_US.ISO8859-1',
1502    'pd_de':                                'pd_DE.ISO8859-1',
1503    'pd_de.iso88591':                       'pd_DE.ISO8859-1',
1504    'pd_de.iso885915':                      'pd_DE.ISO8859-15',
1505    'pd_de@euro':                           'pd_DE.ISO8859-15',
1506    'pd_us':                                'pd_US.ISO8859-1',
1507    'pd_us.iso88591':                       'pd_US.ISO8859-1',
1508    'pd_us.iso885915':                      'pd_US.ISO8859-15',
1509    'pd_us@euro':                           'pd_US.ISO8859-15',
1510    'ph':                                   'ph_PH.ISO8859-1',
1511    'ph_ph':                                'ph_PH.ISO8859-1',
1512    'ph_ph.iso88591':                       'ph_PH.ISO8859-1',
1513    'pl':                                   'pl_PL.ISO8859-2',
1514    'pl_pl':                                'pl_PL.ISO8859-2',
1515    'pl_pl.iso88592':                       'pl_PL.ISO8859-2',
1516    'polish':                               'pl_PL.ISO8859-2',
1517    'portuguese':                           'pt_PT.ISO8859-1',
1518    'portuguese.iso88591':                  'pt_PT.ISO8859-1',
1519    'portuguese_brazil':                    'pt_BR.ISO8859-1',
1520    'portuguese_brazil.8859':               'pt_BR.ISO8859-1',
1521    'posix':                                'C',
1522    'posix-utf2':                           'C',
1523    'pp':                                   'pp_AN.ISO8859-1',
1524    'pp_an':                                'pp_AN.ISO8859-1',
1525    'pp_an.iso88591':                       'pp_AN.ISO8859-1',
1526    'ps_af':                                'ps_AF.UTF-8',
1527    'pt':                                   'pt_PT.ISO8859-1',
1528    'pt.iso885915':                         'pt_PT.ISO8859-15',
1529    'pt_br':                                'pt_BR.ISO8859-1',
1530    'pt_br.88591':                          'pt_BR.ISO8859-1',
1531    'pt_br.iso88591':                       'pt_BR.ISO8859-1',
1532    'pt_br.iso885915':                      'pt_BR.ISO8859-15',
1533    'pt_br@euro':                           'pt_BR.ISO8859-15',
1534    'pt_pt':                                'pt_PT.ISO8859-1',
1535    'pt_pt.88591':                          'pt_PT.ISO8859-1',
1536    'pt_pt.iso88591':                       'pt_PT.ISO8859-1',
1537    'pt_pt.iso885915':                      'pt_PT.ISO8859-15',
1538    'pt_pt.iso885915@euro':                 'pt_PT.ISO8859-15',
1539    'pt_pt.utf8@euro':                      'pt_PT.UTF-8',
1540    'pt_pt@euro':                           'pt_PT.ISO8859-15',
1541    'ro':                                   'ro_RO.ISO8859-2',
1542    'ro_ro':                                'ro_RO.ISO8859-2',
1543    'ro_ro.iso88592':                       'ro_RO.ISO8859-2',
1544    'romanian':                             'ro_RO.ISO8859-2',
1545    'ru':                                   'ru_RU.UTF-8',
1546    'ru.koi8r':                             'ru_RU.KOI8-R',
1547    'ru_ru':                                'ru_RU.UTF-8',
1548    'ru_ru.cp1251':                         'ru_RU.CP1251',
1549    'ru_ru.iso88595':                       'ru_RU.ISO8859-5',
1550    'ru_ru.koi8r':                          'ru_RU.KOI8-R',
1551    'ru_ru.microsoftcp1251':                'ru_RU.CP1251',
1552    'ru_ua':                                'ru_UA.KOI8-U',
1553    'ru_ua.cp1251':                         'ru_UA.CP1251',
1554    'ru_ua.koi8u':                          'ru_UA.KOI8-U',
1555    'ru_ua.microsoftcp1251':                'ru_UA.CP1251',
1556    'rumanian':                             'ro_RO.ISO8859-2',
1557    'russian':                              'ru_RU.ISO8859-5',
1558    'rw':                                   'rw_RW.ISO8859-1',
1559    'rw_rw':                                'rw_RW.ISO8859-1',
1560    'rw_rw.iso88591':                       'rw_RW.ISO8859-1',
1561    'sa_in':                                'sa_IN.UTF-8',
1562    'sat_in':                               'sat_IN.UTF-8',
1563    'sc_it':                                'sc_IT.UTF-8',
1564    'sd':                                   'sd_IN.UTF-8',
1565    'sd@devanagari':                        'sd_IN.UTF-8@devanagari',
1566    'sd_in':                                'sd_IN.UTF-8',
1567    'sd_in@devanagari':                     'sd_IN.UTF-8@devanagari',
1568    'sd_in@devanagari.utf8':                'sd_IN.UTF-8@devanagari',
1569    'sd_pk':                                'sd_PK.UTF-8',
1570    'se_no':                                'se_NO.UTF-8',
1571    'serbocroatian':                        'sr_RS.UTF-8@latin',
1572    'sh':                                   'sr_RS.UTF-8@latin',
1573    'sh_ba.iso88592@bosnia':                'sr_CS.ISO8859-2',
1574    'sh_hr':                                'sh_HR.ISO8859-2',
1575    'sh_hr.iso88592':                       'hr_HR.ISO8859-2',
1576    'sh_sp':                                'sr_CS.ISO8859-2',
1577    'sh_yu':                                'sr_RS.UTF-8@latin',
1578    'shs_ca':                               'shs_CA.UTF-8',
1579    'si':                                   'si_LK.UTF-8',
1580    'si_lk':                                'si_LK.UTF-8',
1581    'sid_et':                               'sid_ET.UTF-8',
1582    'sinhala':                              'si_LK.UTF-8',
1583    'sk':                                   'sk_SK.ISO8859-2',
1584    'sk_sk':                                'sk_SK.ISO8859-2',
1585    'sk_sk.iso88592':                       'sk_SK.ISO8859-2',
1586    'sl':                                   'sl_SI.ISO8859-2',
1587    'sl_cs':                                'sl_CS.ISO8859-2',
1588    'sl_si':                                'sl_SI.ISO8859-2',
1589    'sl_si.iso88592':                       'sl_SI.ISO8859-2',
1590    'slovak':                               'sk_SK.ISO8859-2',
1591    'slovene':                              'sl_SI.ISO8859-2',
1592    'slovenian':                            'sl_SI.ISO8859-2',
1593    'so_dj':                                'so_DJ.ISO8859-1',
1594    'so_et':                                'so_ET.UTF-8',
1595    'so_ke':                                'so_KE.ISO8859-1',
1596    'so_so':                                'so_SO.ISO8859-1',
1597    'sp':                                   'sr_CS.ISO8859-5',
1598    'sp_yu':                                'sr_CS.ISO8859-5',
1599    'spanish':                              'es_ES.ISO8859-1',
1600    'spanish.iso88591':                     'es_ES.ISO8859-1',
1601    'spanish_spain':                        'es_ES.ISO8859-1',
1602    'spanish_spain.8859':                   'es_ES.ISO8859-1',
1603    'sq':                                   'sq_AL.ISO8859-2',
1604    'sq_al':                                'sq_AL.ISO8859-2',
1605    'sq_al.iso88592':                       'sq_AL.ISO8859-2',
1606    'sq_mk':                                'sq_MK.UTF-8',
1607    'sr':                                   'sr_RS.UTF-8',
1608    'sr@cyrillic':                          'sr_RS.UTF-8',
1609    'sr@latin':                             'sr_RS.UTF-8@latin',
1610    'sr@latn':                              'sr_CS.UTF-8@latin',
1611    'sr_cs':                                'sr_CS.UTF-8',
1612    'sr_cs.iso88592':                       'sr_CS.ISO8859-2',
1613    'sr_cs.iso88592@latn':                  'sr_CS.ISO8859-2',
1614    'sr_cs.iso88595':                       'sr_CS.ISO8859-5',
1615    'sr_cs.utf8@latn':                      'sr_CS.UTF-8@latin',
1616    'sr_cs@latn':                           'sr_CS.UTF-8@latin',
1617    'sr_me':                                'sr_ME.UTF-8',
1618    'sr_rs':                                'sr_RS.UTF-8',
1619    'sr_rs@latin':                          'sr_RS.UTF-8@latin',
1620    'sr_rs@latn':                           'sr_RS.UTF-8@latin',
1621    'sr_sp':                                'sr_CS.ISO8859-2',
1622    'sr_yu':                                'sr_RS.UTF-8@latin',
1623    'sr_yu.cp1251@cyrillic':                'sr_CS.CP1251',
1624    'sr_yu.iso88592':                       'sr_CS.ISO8859-2',
1625    'sr_yu.iso88595':                       'sr_CS.ISO8859-5',
1626    'sr_yu.iso88595@cyrillic':              'sr_CS.ISO8859-5',
1627    'sr_yu.microsoftcp1251@cyrillic':       'sr_CS.CP1251',
1628    'sr_yu.utf8':                           'sr_RS.UTF-8',
1629    'sr_yu.utf8@cyrillic':                  'sr_RS.UTF-8',
1630    'sr_yu@cyrillic':                       'sr_RS.UTF-8',
1631    'ss':                                   'ss_ZA.ISO8859-1',
1632    'ss_za':                                'ss_ZA.ISO8859-1',
1633    'ss_za.iso88591':                       'ss_ZA.ISO8859-1',
1634    'st':                                   'st_ZA.ISO8859-1',
1635    'st_za':                                'st_ZA.ISO8859-1',
1636    'st_za.iso88591':                       'st_ZA.ISO8859-1',
1637    'sv':                                   'sv_SE.ISO8859-1',
1638    'sv.iso885915':                         'sv_SE.ISO8859-15',
1639    'sv_fi':                                'sv_FI.ISO8859-1',
1640    'sv_fi.iso88591':                       'sv_FI.ISO8859-1',
1641    'sv_fi.iso885915':                      'sv_FI.ISO8859-15',
1642    'sv_fi.iso885915@euro':                 'sv_FI.ISO8859-15',
1643    'sv_fi.utf8@euro':                      'sv_FI.UTF-8',
1644    'sv_fi@euro':                           'sv_FI.ISO8859-15',
1645    'sv_se':                                'sv_SE.ISO8859-1',
1646    'sv_se.88591':                          'sv_SE.ISO8859-1',
1647    'sv_se.iso88591':                       'sv_SE.ISO8859-1',
1648    'sv_se.iso885915':                      'sv_SE.ISO8859-15',
1649    'sv_se@euro':                           'sv_SE.ISO8859-15',
1650    'sw_ke':                                'sw_KE.UTF-8',
1651    'sw_tz':                                'sw_TZ.UTF-8',
1652    'swedish':                              'sv_SE.ISO8859-1',
1653    'swedish.iso88591':                     'sv_SE.ISO8859-1',
1654    'szl_pl':                               'szl_PL.UTF-8',
1655    'ta':                                   'ta_IN.TSCII-0',
1656    'ta_in':                                'ta_IN.TSCII-0',
1657    'ta_in.tscii':                          'ta_IN.TSCII-0',
1658    'ta_in.tscii0':                         'ta_IN.TSCII-0',
1659    'ta_lk':                                'ta_LK.UTF-8',
1660    'te':                                   'te_IN.UTF-8',
1661    'te_in':                                'te_IN.UTF-8',
1662    'tg':                                   'tg_TJ.KOI8-C',
1663    'tg_tj':                                'tg_TJ.KOI8-C',
1664    'tg_tj.koi8c':                          'tg_TJ.KOI8-C',
1665    'th':                                   'th_TH.ISO8859-11',
1666    'th_th':                                'th_TH.ISO8859-11',
1667    'th_th.iso885911':                      'th_TH.ISO8859-11',
1668    'th_th.tactis':                         'th_TH.TIS620',
1669    'th_th.tis620':                         'th_TH.TIS620',
1670    'thai':                                 'th_TH.ISO8859-11',
1671    'ti_er':                                'ti_ER.UTF-8',
1672    'ti_et':                                'ti_ET.UTF-8',
1673    'tig_er':                               'tig_ER.UTF-8',
1674    'tk_tm':                                'tk_TM.UTF-8',
1675    'tl':                                   'tl_PH.ISO8859-1',
1676    'tl_ph':                                'tl_PH.ISO8859-1',
1677    'tl_ph.iso88591':                       'tl_PH.ISO8859-1',
1678    'tn':                                   'tn_ZA.ISO8859-15',
1679    'tn_za':                                'tn_ZA.ISO8859-15',
1680    'tn_za.iso885915':                      'tn_ZA.ISO8859-15',
1681    'tr':                                   'tr_TR.ISO8859-9',
1682    'tr_cy':                                'tr_CY.ISO8859-9',
1683    'tr_tr':                                'tr_TR.ISO8859-9',
1684    'tr_tr.iso88599':                       'tr_TR.ISO8859-9',
1685    'ts':                                   'ts_ZA.ISO8859-1',
1686    'ts_za':                                'ts_ZA.ISO8859-1',
1687    'ts_za.iso88591':                       'ts_ZA.ISO8859-1',
1688    'tt':                                   'tt_RU.TATAR-CYR',
1689    'tt_ru':                                'tt_RU.TATAR-CYR',
1690    'tt_ru.koi8c':                          'tt_RU.KOI8-C',
1691    'tt_ru.tatarcyr':                       'tt_RU.TATAR-CYR',
1692    'tt_ru@iqtelif':                        'tt_RU.UTF-8@iqtelif',
1693    'turkish':                              'tr_TR.ISO8859-9',
1694    'turkish.iso88599':                     'tr_TR.ISO8859-9',
1695    'ug_cn':                                'ug_CN.UTF-8',
1696    'uk':                                   'uk_UA.KOI8-U',
1697    'uk_ua':                                'uk_UA.KOI8-U',
1698    'uk_ua.cp1251':                         'uk_UA.CP1251',
1699    'uk_ua.iso88595':                       'uk_UA.ISO8859-5',
1700    'uk_ua.koi8u':                          'uk_UA.KOI8-U',
1701    'uk_ua.microsoftcp1251':                'uk_UA.CP1251',
1702    'univ':                                 'en_US.utf',
1703    'universal':                            'en_US.utf',
1704    'universal.utf8@ucs4':                  'en_US.UTF-8',
1705    'unm_us':                               'unm_US.UTF-8',
1706    'ur':                                   'ur_PK.CP1256',
1707    'ur_in':                                'ur_IN.UTF-8',
1708    'ur_pk':                                'ur_PK.CP1256',
1709    'ur_pk.cp1256':                         'ur_PK.CP1256',
1710    'ur_pk.microsoftcp1256':                'ur_PK.CP1256',
1711    'uz':                                   'uz_UZ.UTF-8',
1712    'uz_uz':                                'uz_UZ.UTF-8',
1713    'uz_uz.iso88591':                       'uz_UZ.ISO8859-1',
1714    'uz_uz.utf8@cyrillic':                  'uz_UZ.UTF-8',
1715    'uz_uz@cyrillic':                       'uz_UZ.UTF-8',
1716    've':                                   've_ZA.UTF-8',
1717    've_za':                                've_ZA.UTF-8',
1718    'vi':                                   'vi_VN.TCVN',
1719    'vi_vn':                                'vi_VN.TCVN',
1720    'vi_vn.tcvn':                           'vi_VN.TCVN',
1721    'vi_vn.tcvn5712':                       'vi_VN.TCVN',
1722    'vi_vn.viscii':                         'vi_VN.VISCII',
1723    'vi_vn.viscii111':                      'vi_VN.VISCII',
1724    'wa':                                   'wa_BE.ISO8859-1',
1725    'wa_be':                                'wa_BE.ISO8859-1',
1726    'wa_be.iso88591':                       'wa_BE.ISO8859-1',
1727    'wa_be.iso885915':                      'wa_BE.ISO8859-15',
1728    'wa_be.iso885915@euro':                 'wa_BE.ISO8859-15',
1729    'wa_be@euro':                           'wa_BE.ISO8859-15',
1730    'wae_ch':                               'wae_CH.UTF-8',
1731    'wal_et':                               'wal_ET.UTF-8',
1732    'wo_sn':                                'wo_SN.UTF-8',
1733    'xh':                                   'xh_ZA.ISO8859-1',
1734    'xh_za':                                'xh_ZA.ISO8859-1',
1735    'xh_za.iso88591':                       'xh_ZA.ISO8859-1',
1736    'yi':                                   'yi_US.CP1255',
1737    'yi_us':                                'yi_US.CP1255',
1738    'yi_us.cp1255':                         'yi_US.CP1255',
1739    'yi_us.microsoftcp1255':                'yi_US.CP1255',
1740    'yo_ng':                                'yo_NG.UTF-8',
1741    'yue_hk':                               'yue_HK.UTF-8',
1742    'zh':                                   'zh_CN.eucCN',
1743    'zh_cn':                                'zh_CN.gb2312',
1744    'zh_cn.big5':                           'zh_TW.big5',
1745    'zh_cn.euc':                            'zh_CN.eucCN',
1746    'zh_cn.gb18030':                        'zh_CN.gb18030',
1747    'zh_cn.gb2312':                         'zh_CN.gb2312',
1748    'zh_cn.gbk':                            'zh_CN.gbk',
1749    'zh_hk':                                'zh_HK.big5hkscs',
1750    'zh_hk.big5':                           'zh_HK.big5',
1751    'zh_hk.big5hk':                         'zh_HK.big5hkscs',
1752    'zh_hk.big5hkscs':                      'zh_HK.big5hkscs',
1753    'zh_sg':                                'zh_SG.GB2312',
1754    'zh_sg.gbk':                            'zh_SG.GBK',
1755    'zh_tw':                                'zh_TW.big5',
1756    'zh_tw.big5':                           'zh_TW.big5',
1757    'zh_tw.euc':                            'zh_TW.eucTW',
1758    'zh_tw.euctw':                          'zh_TW.eucTW',
1759    'zu':                                   'zu_ZA.ISO8859-1',
1760    'zu_za':                                'zu_ZA.ISO8859-1',
1761    'zu_za.iso88591':                       'zu_ZA.ISO8859-1',
1762}
1763
1764#
1765# This maps Windows language identifiers to locale strings.
1766#
1767# This list has been updated from
1768# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp
1769# to include every locale up to Windows Vista.
1770#
1771# NOTE: this mapping is incomplete.  If your language is missing, please
1772# submit a bug report to the Python bug tracker at http://bugs.python.org/
1773# Make sure you include the missing language identifier and the suggested
1774# locale code.
1775#
1776
1777windows_locale = {
1778    0x0436: "af_ZA", # Afrikaans
1779    0x041c: "sq_AL", # Albanian
1780    0x0484: "gsw_FR",# Alsatian - France
1781    0x045e: "am_ET", # Amharic - Ethiopia
1782    0x0401: "ar_SA", # Arabic - Saudi Arabia
1783    0x0801: "ar_IQ", # Arabic - Iraq
1784    0x0c01: "ar_EG", # Arabic - Egypt
1785    0x1001: "ar_LY", # Arabic - Libya
1786    0x1401: "ar_DZ", # Arabic - Algeria
1787    0x1801: "ar_MA", # Arabic - Morocco
1788    0x1c01: "ar_TN", # Arabic - Tunisia
1789    0x2001: "ar_OM", # Arabic - Oman
1790    0x2401: "ar_YE", # Arabic - Yemen
1791    0x2801: "ar_SY", # Arabic - Syria
1792    0x2c01: "ar_JO", # Arabic - Jordan
1793    0x3001: "ar_LB", # Arabic - Lebanon
1794    0x3401: "ar_KW", # Arabic - Kuwait
1795    0x3801: "ar_AE", # Arabic - United Arab Emirates
1796    0x3c01: "ar_BH", # Arabic - Bahrain
1797    0x4001: "ar_QA", # Arabic - Qatar
1798    0x042b: "hy_AM", # Armenian
1799    0x044d: "as_IN", # Assamese - India
1800    0x042c: "az_AZ", # Azeri - Latin
1801    0x082c: "az_AZ", # Azeri - Cyrillic
1802    0x046d: "ba_RU", # Bashkir
1803    0x042d: "eu_ES", # Basque - Russia
1804    0x0423: "be_BY", # Belarusian
1805    0x0445: "bn_IN", # Begali
1806    0x201a: "bs_BA", # Bosnian - Cyrillic
1807    0x141a: "bs_BA", # Bosnian - Latin
1808    0x047e: "br_FR", # Breton - France
1809    0x0402: "bg_BG", # Bulgarian
1810#    0x0455: "my_MM", # Burmese - Not supported
1811    0x0403: "ca_ES", # Catalan
1812    0x0004: "zh_CHS",# Chinese - Simplified
1813    0x0404: "zh_TW", # Chinese - Taiwan
1814    0x0804: "zh_CN", # Chinese - PRC
1815    0x0c04: "zh_HK", # Chinese - Hong Kong S.A.R.
1816    0x1004: "zh_SG", # Chinese - Singapore
1817    0x1404: "zh_MO", # Chinese - Macao S.A.R.
1818    0x7c04: "zh_CHT",# Chinese - Traditional
1819    0x0483: "co_FR", # Corsican - France
1820    0x041a: "hr_HR", # Croatian
1821    0x101a: "hr_BA", # Croatian - Bosnia
1822    0x0405: "cs_CZ", # Czech
1823    0x0406: "da_DK", # Danish
1824    0x048c: "gbz_AF",# Dari - Afghanistan
1825    0x0465: "div_MV",# Divehi - Maldives
1826    0x0413: "nl_NL", # Dutch - The Netherlands
1827    0x0813: "nl_BE", # Dutch - Belgium
1828    0x0409: "en_US", # English - United States
1829    0x0809: "en_GB", # English - United Kingdom
1830    0x0c09: "en_AU", # English - Australia
1831    0x1009: "en_CA", # English - Canada
1832    0x1409: "en_NZ", # English - New Zealand
1833    0x1809: "en_IE", # English - Ireland
1834    0x1c09: "en_ZA", # English - South Africa
1835    0x2009: "en_JA", # English - Jamaica
1836    0x2409: "en_CB", # English - Carribbean
1837    0x2809: "en_BZ", # English - Belize
1838    0x2c09: "en_TT", # English - Trinidad
1839    0x3009: "en_ZW", # English - Zimbabwe
1840    0x3409: "en_PH", # English - Philippines
1841    0x4009: "en_IN", # English - India
1842    0x4409: "en_MY", # English - Malaysia
1843    0x4809: "en_IN", # English - Singapore
1844    0x0425: "et_EE", # Estonian
1845    0x0438: "fo_FO", # Faroese
1846    0x0464: "fil_PH",# Filipino
1847    0x040b: "fi_FI", # Finnish
1848    0x040c: "fr_FR", # French - France
1849    0x080c: "fr_BE", # French - Belgium
1850    0x0c0c: "fr_CA", # French - Canada
1851    0x100c: "fr_CH", # French - Switzerland
1852    0x140c: "fr_LU", # French - Luxembourg
1853    0x180c: "fr_MC", # French - Monaco
1854    0x0462: "fy_NL", # Frisian - Netherlands
1855    0x0456: "gl_ES", # Galician
1856    0x0437: "ka_GE", # Georgian
1857    0x0407: "de_DE", # German - Germany
1858    0x0807: "de_CH", # German - Switzerland
1859    0x0c07: "de_AT", # German - Austria
1860    0x1007: "de_LU", # German - Luxembourg
1861    0x1407: "de_LI", # German - Liechtenstein
1862    0x0408: "el_GR", # Greek
1863    0x046f: "kl_GL", # Greenlandic - Greenland
1864    0x0447: "gu_IN", # Gujarati
1865    0x0468: "ha_NG", # Hausa - Latin
1866    0x040d: "he_IL", # Hebrew
1867    0x0439: "hi_IN", # Hindi
1868    0x040e: "hu_HU", # Hungarian
1869    0x040f: "is_IS", # Icelandic
1870    0x0421: "id_ID", # Indonesian
1871    0x045d: "iu_CA", # Inuktitut - Syllabics
1872    0x085d: "iu_CA", # Inuktitut - Latin
1873    0x083c: "ga_IE", # Irish - Ireland
1874    0x0410: "it_IT", # Italian - Italy
1875    0x0810: "it_CH", # Italian - Switzerland
1876    0x0411: "ja_JP", # Japanese
1877    0x044b: "kn_IN", # Kannada - India
1878    0x043f: "kk_KZ", # Kazakh
1879    0x0453: "kh_KH", # Khmer - Cambodia
1880    0x0486: "qut_GT",# K'iche - Guatemala
1881    0x0487: "rw_RW", # Kinyarwanda - Rwanda
1882    0x0457: "kok_IN",# Konkani
1883    0x0412: "ko_KR", # Korean
1884    0x0440: "ky_KG", # Kyrgyz
1885    0x0454: "lo_LA", # Lao - Lao PDR
1886    0x0426: "lv_LV", # Latvian
1887    0x0427: "lt_LT", # Lithuanian
1888    0x082e: "dsb_DE",# Lower Sorbian - Germany
1889    0x046e: "lb_LU", # Luxembourgish
1890    0x042f: "mk_MK", # FYROM Macedonian
1891    0x043e: "ms_MY", # Malay - Malaysia
1892    0x083e: "ms_BN", # Malay - Brunei Darussalam
1893    0x044c: "ml_IN", # Malayalam - India
1894    0x043a: "mt_MT", # Maltese
1895    0x0481: "mi_NZ", # Maori
1896    0x047a: "arn_CL",# Mapudungun
1897    0x044e: "mr_IN", # Marathi
1898    0x047c: "moh_CA",# Mohawk - Canada
1899    0x0450: "mn_MN", # Mongolian - Cyrillic
1900    0x0850: "mn_CN", # Mongolian - PRC
1901    0x0461: "ne_NP", # Nepali
1902    0x0414: "nb_NO", # Norwegian - Bokmal
1903    0x0814: "nn_NO", # Norwegian - Nynorsk
1904    0x0482: "oc_FR", # Occitan - France
1905    0x0448: "or_IN", # Oriya - India
1906    0x0463: "ps_AF", # Pashto - Afghanistan
1907    0x0429: "fa_IR", # Persian
1908    0x0415: "pl_PL", # Polish
1909    0x0416: "pt_BR", # Portuguese - Brazil
1910    0x0816: "pt_PT", # Portuguese - Portugal
1911    0x0446: "pa_IN", # Punjabi
1912    0x046b: "quz_BO",# Quechua (Bolivia)
1913    0x086b: "quz_EC",# Quechua (Ecuador)
1914    0x0c6b: "quz_PE",# Quechua (Peru)
1915    0x0418: "ro_RO", # Romanian - Romania
1916    0x0417: "rm_CH", # Romansh
1917    0x0419: "ru_RU", # Russian
1918    0x243b: "smn_FI",# Sami Finland
1919    0x103b: "smj_NO",# Sami Norway
1920    0x143b: "smj_SE",# Sami Sweden
1921    0x043b: "se_NO", # Sami Northern Norway
1922    0x083b: "se_SE", # Sami Northern Sweden
1923    0x0c3b: "se_FI", # Sami Northern Finland
1924    0x203b: "sms_FI",# Sami Skolt
1925    0x183b: "sma_NO",# Sami Southern Norway
1926    0x1c3b: "sma_SE",# Sami Southern Sweden
1927    0x044f: "sa_IN", # Sanskrit
1928    0x0c1a: "sr_SP", # Serbian - Cyrillic
1929    0x1c1a: "sr_BA", # Serbian - Bosnia Cyrillic
1930    0x081a: "sr_SP", # Serbian - Latin
1931    0x181a: "sr_BA", # Serbian - Bosnia Latin
1932    0x045b: "si_LK", # Sinhala - Sri Lanka
1933    0x046c: "ns_ZA", # Northern Sotho
1934    0x0432: "tn_ZA", # Setswana - Southern Africa
1935    0x041b: "sk_SK", # Slovak
1936    0x0424: "sl_SI", # Slovenian
1937    0x040a: "es_ES", # Spanish - Spain
1938    0x080a: "es_MX", # Spanish - Mexico
1939    0x0c0a: "es_ES", # Spanish - Spain (Modern)
1940    0x100a: "es_GT", # Spanish - Guatemala
1941    0x140a: "es_CR", # Spanish - Costa Rica
1942    0x180a: "es_PA", # Spanish - Panama
1943    0x1c0a: "es_DO", # Spanish - Dominican Republic
1944    0x200a: "es_VE", # Spanish - Venezuela
1945    0x240a: "es_CO", # Spanish - Colombia
1946    0x280a: "es_PE", # Spanish - Peru
1947    0x2c0a: "es_AR", # Spanish - Argentina
1948    0x300a: "es_EC", # Spanish - Ecuador
1949    0x340a: "es_CL", # Spanish - Chile
1950    0x380a: "es_UR", # Spanish - Uruguay
1951    0x3c0a: "es_PY", # Spanish - Paraguay
1952    0x400a: "es_BO", # Spanish - Bolivia
1953    0x440a: "es_SV", # Spanish - El Salvador
1954    0x480a: "es_HN", # Spanish - Honduras
1955    0x4c0a: "es_NI", # Spanish - Nicaragua
1956    0x500a: "es_PR", # Spanish - Puerto Rico
1957    0x540a: "es_US", # Spanish - United States
1958#    0x0430: "", # Sutu - Not supported
1959    0x0441: "sw_KE", # Swahili
1960    0x041d: "sv_SE", # Swedish - Sweden
1961    0x081d: "sv_FI", # Swedish - Finland
1962    0x045a: "syr_SY",# Syriac
1963    0x0428: "tg_TJ", # Tajik - Cyrillic
1964    0x085f: "tmz_DZ",# Tamazight - Latin
1965    0x0449: "ta_IN", # Tamil
1966    0x0444: "tt_RU", # Tatar
1967    0x044a: "te_IN", # Telugu
1968    0x041e: "th_TH", # Thai
1969    0x0851: "bo_BT", # Tibetan - Bhutan
1970    0x0451: "bo_CN", # Tibetan - PRC
1971    0x041f: "tr_TR", # Turkish
1972    0x0442: "tk_TM", # Turkmen - Cyrillic
1973    0x0480: "ug_CN", # Uighur - Arabic
1974    0x0422: "uk_UA", # Ukrainian
1975    0x042e: "wen_DE",# Upper Sorbian - Germany
1976    0x0420: "ur_PK", # Urdu
1977    0x0820: "ur_IN", # Urdu - India
1978    0x0443: "uz_UZ", # Uzbek - Latin
1979    0x0843: "uz_UZ", # Uzbek - Cyrillic
1980    0x042a: "vi_VN", # Vietnamese
1981    0x0452: "cy_GB", # Welsh
1982    0x0488: "wo_SN", # Wolof - Senegal
1983    0x0434: "xh_ZA", # Xhosa - South Africa
1984    0x0485: "sah_RU",# Yakut - Cyrillic
1985    0x0478: "ii_CN", # Yi - PRC
1986    0x046a: "yo_NG", # Yoruba - Nigeria
1987    0x0435: "zu_ZA", # Zulu
1988}
1989
1990def _print_locale():
1991
1992    """ Test function.
1993    """
1994    categories = {}
1995    def _init_categories(categories=categories):
1996        for k,v in globals().items():
1997            if k[:3] == 'LC_':
1998                categories[k] = v
1999    _init_categories()
2000    del categories['LC_ALL']
2001
2002    print 'Locale defaults as determined by getdefaultlocale():'
2003    print '-'*72
2004    lang, enc = getdefaultlocale()
2005    print 'Language: ', lang or '(undefined)'
2006    print 'Encoding: ', enc or '(undefined)'
2007    print
2008
2009    print 'Locale settings on startup:'
2010    print '-'*72
2011    for name,category in categories.items():
2012        print name, '...'
2013        lang, enc = getlocale(category)
2014        print '   Language: ', lang or '(undefined)'
2015        print '   Encoding: ', enc or '(undefined)'
2016        print
2017
2018    print
2019    print 'Locale settings after calling resetlocale():'
2020    print '-'*72
2021    resetlocale()
2022    for name,category in categories.items():
2023        print name, '...'
2024        lang, enc = getlocale(category)
2025        print '   Language: ', lang or '(undefined)'
2026        print '   Encoding: ', enc or '(undefined)'
2027        print
2028
2029    try:
2030        setlocale(LC_ALL, "")
2031    except:
2032        print 'NOTE:'
2033        print 'setlocale(LC_ALL, "") does not support the default locale'
2034        print 'given in the OS environment variables.'
2035    else:
2036        print
2037        print 'Locale settings after calling setlocale(LC_ALL, ""):'
2038        print '-'*72
2039        for name,category in categories.items():
2040            print name, '...'
2041            lang, enc = getlocale(category)
2042            print '   Language: ', lang or '(undefined)'
2043            print '   Encoding: ', enc or '(undefined)'
2044            print
2045
2046###
2047
2048try:
2049    LC_MESSAGES
2050except NameError:
2051    pass
2052else:
2053    __all__.append("LC_MESSAGES")
2054
2055if __name__=='__main__':
2056    print 'Locale aliasing:'
2057    print
2058    _print_locale()
2059    print
2060    print 'Number formatting:'
2061    print
2062    _test()
Note: See TracBrowser for help on using the repository browser.