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