source: python/trunk/Lib/locale.py@ 60

Last change on this file since 60 was 60, checked in by Yuri Dario, 15 years ago

python: use current codepage as charset in locale settings.

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