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