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