blob: 25dccaf22f5a4ef3ca57d4d29df6c14a5e5ae4f4 [file] [log] [blame]
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001""" Locale support.
Guido van Rossum4b8c6ea2000-02-04 15:39:30 +00002
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00003 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
R. David Murraya83da352009-04-01 03:21:43 +000014import sys
15import encodings
16import encodings.aliases
17import re
18import operator
Antoine Pitrouba54eda2008-07-25 20:40:19 +000019import functools
Marc-André Lemburg5431bc32000-06-07 09:11:40 +000020
Martin v. Löwised11a5d2012-05-20 10:42:17 +020021try:
22 _unicode = unicode
23except NameError:
24 # If Python is built without Unicode support, the unicode type
25 # will not exist. Fake one.
26 class _unicode(object):
27 pass
28
Fredrik Lundh6c86b992000-07-09 17:12:58 +000029# Try importing the _locale module.
30#
31# If this fails, fall back on a basic 'C' locale emulation.
Guido van Rossumeef1d4e1997-11-19 19:01:43 +000032
Tim Peters1baf8292001-01-24 10:13:46 +000033# Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before
34# trying the import. So __all__ is also fiddled at the end of the file.
Georg Brandl09728b72007-05-01 06:08:15 +000035__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
36 "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",
37 "str", "atof", "atoi", "format", "format_string", "currency",
38 "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
39 "LC_NUMERIC", "LC_ALL", "CHAR_MAX"]
Skip Montanaro17ab1232001-01-24 06:27:27 +000040
Marc-André Lemburg23481142000-06-08 17:49:41 +000041try:
Fredrik Lundh6c86b992000-07-09 17:12:58 +000042
Marc-André Lemburg23481142000-06-08 17:49:41 +000043 from _locale import *
44
45except ImportError:
46
Fredrik Lundh6c86b992000-07-09 17:12:58 +000047 # Locale emulation
48
Marc-André Lemburg23481142000-06-08 17:49:41 +000049 CHAR_MAX = 127
50 LC_ALL = 6
51 LC_COLLATE = 3
52 LC_CTYPE = 0
53 LC_MESSAGES = 5
54 LC_MONETARY = 4
55 LC_NUMERIC = 1
56 LC_TIME = 2
57 Error = ValueError
58
59 def localeconv():
Fredrik Lundh6c86b992000-07-09 17:12:58 +000060 """ localeconv() -> dict.
Marc-André Lemburg23481142000-06-08 17:49:41 +000061 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,
Fredrik Lundh6c86b992000-07-09 17:12:58 +000067 'p_cs_precedes': 127,
68 'n_cs_precedes': 127,
69 'mon_grouping': [],
Marc-André Lemburg23481142000-06-08 17:49:41 +000070 'n_sep_by_space': 127,
71 'decimal_point': '.',
72 'negative_sign': '',
73 'positive_sign': '',
Fredrik Lundh6c86b992000-07-09 17:12:58 +000074 'p_sep_by_space': 127,
Marc-André Lemburg23481142000-06-08 17:49:41 +000075 'int_curr_symbol': '',
Fredrik Lundh6c86b992000-07-09 17:12:58 +000076 'p_sign_posn': 127,
Marc-André Lemburg23481142000-06-08 17:49:41 +000077 'thousands_sep': '',
Fredrik Lundh6c86b992000-07-09 17:12:58 +000078 'mon_thousands_sep': '',
79 'frac_digits': 127,
Marc-André Lemburg23481142000-06-08 17:49:41 +000080 'mon_decimal_point': '',
81 'int_frac_digits': 127}
Fredrik Lundh6c86b992000-07-09 17:12:58 +000082
Marc-André Lemburg23481142000-06-08 17:49:41 +000083 def setlocale(category, value=None):
Fredrik Lundh6c86b992000-07-09 17:12:58 +000084 """ setlocale(integer,string=None) -> string.
Marc-André Lemburg23481142000-06-08 17:49:41 +000085 Activates/queries locale processing.
86 """
Martin v. Löwis103d6e72003-03-30 15:42:13 +000087 if value not in (None, '', 'C'):
Fredrik Lundh6c86b992000-07-09 17:12:58 +000088 raise Error, '_locale emulation only supports "C" locale'
Marc-André Lemburg23481142000-06-08 17:49:41 +000089 return 'C'
90
91 def strcoll(a,b):
Fredrik Lundh6c86b992000-07-09 17:12:58 +000092 """ strcoll(string,string) -> int.
Marc-André Lemburg23481142000-06-08 17:49:41 +000093 Compares two strings according to the locale.
94 """
95 return cmp(a,b)
96
97 def strxfrm(s):
Fredrik Lundh6c86b992000-07-09 17:12:58 +000098 """ strxfrm(string) -> string.
Marc-André Lemburg23481142000-06-08 17:49:41 +000099 Returns a string that behaves for cmp locale-aware.
100 """
101 return s
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000102
Antoine Pitrouba54eda2008-07-25 20:40:19 +0000103
104_localeconv = localeconv
105
106# With this dict, you can override some items of localeconv's return value.
107# This is useful for testing purposes.
108_override_localeconv = {}
109
110@functools.wraps(_localeconv)
111def localeconv():
112 d = _localeconv()
113 if _override_localeconv:
114 d.update(_override_localeconv)
115 return d
116
117
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000118### Number formatting APIs
119
120# Author: Martin von Loewis
Georg Brandlb89316f2006-05-17 15:51:16 +0000121# improved by Georg Brandl
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000122
Antoine Pitroufeeafff2009-03-14 00:07:21 +0000123# Iterate over grouping intervals
124def _grouping_intervals(grouping):
Mark Dickinson4b456732009-08-04 21:56:04 +0000125 last_interval = None
Antoine Pitroufeeafff2009-03-14 00:07:21 +0000126 for interval in grouping:
127 # if grouping is -1, we are done
128 if interval == CHAR_MAX:
129 return
130 # 0: re-use last group ad infinitum
131 if interval == 0:
Mark Dickinson4b456732009-08-04 21:56:04 +0000132 if last_interval is None:
133 raise ValueError("invalid grouping")
Antoine Pitroufeeafff2009-03-14 00:07:21 +0000134 while True:
135 yield last_interval
136 yield interval
137 last_interval = interval
138
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000139#perform the grouping from right to left
Georg Brandlb89316f2006-05-17 15:51:16 +0000140def _group(s, monetary=False):
141 conv = localeconv()
142 thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
143 grouping = conv[monetary and 'mon_grouping' or 'grouping']
144 if not grouping:
145 return (s, 0)
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000146 if s[-1] == ' ':
Antoine Pitroufeeafff2009-03-14 00:07:21 +0000147 stripped = s.rstrip()
148 right_spaces = s[len(stripped):]
149 s = stripped
150 else:
151 right_spaces = ''
152 left_spaces = ''
153 groups = []
154 for interval in _grouping_intervals(grouping):
155 if not s or s[-1] not in "0123456789":
156 # only non-digit characters remain (sign, spaces)
157 left_spaces = s
158 s = ''
Guido van Rossum45e2fbc1998-03-26 21:13:24 +0000159 break
Antoine Pitroufeeafff2009-03-14 00:07:21 +0000160 groups.append(s[-interval:])
161 s = s[:-interval]
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000162 if s:
Antoine Pitroufeeafff2009-03-14 00:07:21 +0000163 groups.append(s)
164 groups.reverse()
165 return (
166 left_spaces + thousands_sep.join(groups) + right_spaces,
Antoine Pitrou7c33bd52009-03-18 17:10:04 +0000167 len(thousands_sep) * (len(groups) - 1)
Antoine Pitroufeeafff2009-03-14 00:07:21 +0000168 )
169
170# Strip a given amount of excess padding from the given string
171def _strip_padding(s, amount):
172 lpos = 0
173 while amount and s[lpos] == ' ':
174 lpos += 1
175 amount -= 1
176 rpos = len(s) - 1
177 while amount and s[rpos] == ' ':
178 rpos -= 1
179 amount -= 1
180 return s[lpos:rpos+1]
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000181
R. David Murraya83da352009-04-01 03:21:43 +0000182_percent_re = re.compile(r'%(?:\((?P<key>.*?)\))?'
183 r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')
184
Georg Brandlb89316f2006-05-17 15:51:16 +0000185def format(percent, value, grouping=False, monetary=False, *additional):
186 """Returns the locale-aware substitution of a %? specifier
187 (percent).
Tim Petersfd4c4192006-05-18 02:06:40 +0000188
Georg Brandlb89316f2006-05-17 15:51:16 +0000189 additional is for format strings which contain one or more
190 '*' modifiers."""
191 # this is only for one-percent-specifier strings and this should be checked
R. David Murraya83da352009-04-01 03:21:43 +0000192 match = _percent_re.match(percent)
193 if not match or len(match.group())!= len(percent):
194 raise ValueError(("format() must be given exactly one %%char "
195 "format specifier, %s not valid") % repr(percent))
196 return _format(percent, value, grouping, monetary, *additional)
197
198def _format(percent, value, grouping=False, monetary=False, *additional):
Georg Brandlb89316f2006-05-17 15:51:16 +0000199 if additional:
200 formatted = percent % ((value,) + additional)
201 else:
202 formatted = percent % value
203 # floats and decimal ints need special action!
204 if percent[-1] in 'eEfFgG':
205 seps = 0
206 parts = formatted.split('.')
207 if grouping:
208 parts[0], seps = _group(parts[0], monetary=monetary)
209 decimal_point = localeconv()[monetary and 'mon_decimal_point'
210 or 'decimal_point']
211 formatted = decimal_point.join(parts)
Antoine Pitroufeeafff2009-03-14 00:07:21 +0000212 if seps:
213 formatted = _strip_padding(formatted, seps)
Georg Brandlb89316f2006-05-17 15:51:16 +0000214 elif percent[-1] in 'diu':
Antoine Pitroufeeafff2009-03-14 00:07:21 +0000215 seps = 0
Georg Brandlb89316f2006-05-17 15:51:16 +0000216 if grouping:
Antoine Pitroufeeafff2009-03-14 00:07:21 +0000217 formatted, seps = _group(formatted, monetary=monetary)
218 if seps:
219 formatted = _strip_padding(formatted, seps)
Georg Brandlb89316f2006-05-17 15:51:16 +0000220 return formatted
221
Georg Brandlb89316f2006-05-17 15:51:16 +0000222def format_string(f, val, grouping=False):
223 """Formats a string in the same way that the % formatting would use,
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000224 but takes the current locale into account.
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000225 Grouping is applied if the third parameter is true."""
Georg Brandlb89316f2006-05-17 15:51:16 +0000226 percents = list(_percent_re.finditer(f))
227 new_f = _percent_re.sub('%s', f)
228
R. David Murray3939dcd2010-04-26 21:17:14 +0000229 if operator.isMappingType(val):
230 new_val = []
231 for perc in percents:
232 if perc.group()[-1]=='%':
233 new_val.append('%')
234 else:
235 new_val.append(format(perc.group(), val, grouping))
236 else:
237 if not isinstance(val, tuple):
238 val = (val,)
239 new_val = []
Georg Brandlb89316f2006-05-17 15:51:16 +0000240 i = 0
241 for perc in percents:
R. David Murray3939dcd2010-04-26 21:17:14 +0000242 if perc.group()[-1]=='%':
243 new_val.append('%')
244 else:
245 starcount = perc.group('modifiers').count('*')
246 new_val.append(_format(perc.group(),
247 val[i],
248 grouping,
249 False,
250 *val[i+1:i+1+starcount]))
251 i += (1 + starcount)
252 val = tuple(new_val)
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000253
Georg Brandlb89316f2006-05-17 15:51:16 +0000254 return new_f % val
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000255
Georg Brandlb89316f2006-05-17 15:51:16 +0000256def currency(val, symbol=True, grouping=False, international=False):
257 """Formats val according to the currency settings
258 in the current locale."""
259 conv = localeconv()
260
261 # check for illegal values
262 digits = conv[international and 'int_frac_digits' or 'frac_digits']
263 if digits == 127:
264 raise ValueError("Currency formatting is not possible using "
265 "the 'C' locale.")
266
267 s = format('%%.%if' % digits, abs(val), grouping, monetary=True)
268 # '<' and '>' are markers if the sign must be inserted between symbol and value
269 s = '<' + s + '>'
270
271 if symbol:
272 smb = conv[international and 'int_curr_symbol' or 'currency_symbol']
273 precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']
274 separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']
275
276 if precedes:
277 s = smb + (separated and ' ' or '') + s
278 else:
279 s = s + (separated and ' ' or '') + smb
280
281 sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']
282 sign = conv[val<0 and 'negative_sign' or 'positive_sign']
283
284 if sign_pos == 0:
285 s = '(' + s + ')'
286 elif sign_pos == 1:
287 s = sign + s
288 elif sign_pos == 2:
289 s = s + sign
290 elif sign_pos == 3:
291 s = s.replace('<', sign)
292 elif sign_pos == 4:
293 s = s.replace('>', sign)
294 else:
295 # the default if nothing specified;
296 # this should be the most fitting sign position
297 s = sign + s
298
299 return s.replace('<', '').replace('>', '')
Martin v. Löwisdb786872001-01-21 18:52:33 +0000300
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000301def str(val):
302 """Convert float to integer, taking the locale into account."""
Georg Brandlb89316f2006-05-17 15:51:16 +0000303 return format("%.12g", val)
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000304
Georg Brandlb89316f2006-05-17 15:51:16 +0000305def atof(string, func=float):
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000306 "Parses a string as a float according to the locale settings."
307 #First, get rid of the grouping
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000308 ts = localeconv()['thousands_sep']
309 if ts:
Skip Montanaro249369c2004-04-10 16:39:32 +0000310 string = string.replace(ts, '')
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000311 #next, replace the decimal point with a dot
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000312 dd = localeconv()['decimal_point']
313 if dd:
Skip Montanaro249369c2004-04-10 16:39:32 +0000314 string = string.replace(dd, '.')
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000315 #finally, parse the string
Skip Montanaro249369c2004-04-10 16:39:32 +0000316 return func(string)
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000317
318def atoi(str):
319 "Converts a string to an integer according to the locale settings."
Eric S. Raymondbe9b5072001-02-09 10:48:30 +0000320 return atof(str, int)
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000321
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000322def _test():
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000323 setlocale(LC_ALL, "")
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000324 #do grouping
Georg Brandlb89316f2006-05-17 15:51:16 +0000325 s1 = format("%d", 123456789,1)
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000326 print s1, "is", atoi(s1)
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000327 #standard formatting
Georg Brandlb89316f2006-05-17 15:51:16 +0000328 s1 = str(3.14)
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000329 print s1, "is", atof(s1)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000330
331### Locale name aliasing engine
332
333# Author: Marc-Andre Lemburg, mal@lemburg.com
Fredrik Lundh37a09822002-10-19 20:19:10 +0000334# Various tweaks by Fredrik Lundh <fredrik@pythonware.com>
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000335
336# store away the low-level version of setlocale (it's
337# overridden below)
338_setlocale = setlocale
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000339
Antoine Pitrou4cfae022011-07-24 02:51:01 +0200340# Avoid relying on the locale-dependent .lower() method
341# (see issue #1813).
342_ascii_lower_map = ''.join(
343 chr(x + 32 if x >= ord('A') and x <= ord('Z') else x)
344 for x in range(256)
345)
346
Serhiy Storchakabd789862013-12-19 21:21:06 +0200347def _replace_encoding(code, encoding):
348 if '.' in code:
349 langname = code[:code.index('.')]
350 else:
351 langname = code
352 # Convert the encoding to a C lib compatible encoding string
353 norm_encoding = encodings.normalize_encoding(encoding)
354 #print('norm encoding: %r' % norm_encoding)
355 norm_encoding = encodings.aliases.aliases.get(norm_encoding,
356 norm_encoding)
357 #print('aliased encoding: %r' % norm_encoding)
358 encoding = locale_encoding_alias.get(norm_encoding,
359 norm_encoding)
360 #print('found encoding %r' % encoding)
361 return langname + '.' + encoding
362
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000363def normalize(localename):
364
365 """ Returns a normalized locale code for the given locale
366 name.
367
368 The returned locale code is formatted for use with
369 setlocale().
370
371 If normalization fails, the original name is returned
372 unchanged.
373
374 If the given encoding is not known, the function defaults to
375 the default encoding for the locale code just like setlocale()
376 does.
377
378 """
Serhiy Storchakabd789862013-12-19 21:21:06 +0200379 # Normalize the locale name and extract the encoding and modifier
Martin v. Löwised11a5d2012-05-20 10:42:17 +0200380 if isinstance(localename, _unicode):
Barry Warsawedfba822011-08-15 19:17:12 -0400381 localename = localename.encode('ascii')
Serhiy Storchakaaf080872014-01-17 09:27:56 +0200382 code = localename.translate(_ascii_lower_map)
Serhiy Storchakabd789862013-12-19 21:21:06 +0200383 if ':' in code:
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000384 # ':' is sometimes used as encoding delimiter.
Serhiy Storchakabd789862013-12-19 21:21:06 +0200385 code = code.replace(':', '.')
386 if '@' in code:
387 code, modifier = code.split('@', 1)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000388 else:
Serhiy Storchakabd789862013-12-19 21:21:06 +0200389 modifier = ''
390 if '.' in code:
391 langname, encoding = code.split('.')[:2]
392 else:
393 langname = code
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000394 encoding = ''
395
Serhiy Storchakabd789862013-12-19 21:21:06 +0200396 # First lookup: fullname (possibly with encoding and modifier)
397 lang_enc = langname
398 if encoding:
399 norm_encoding = encoding.replace('-', '')
400 norm_encoding = norm_encoding.replace('_', '')
401 lang_enc += '.' + norm_encoding
402 lookup_name = lang_enc
403 if modifier:
404 lookup_name += '@' + modifier
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000405 code = locale_alias.get(lookup_name, None)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000406 if code is not None:
407 return code
Serhiy Storchakabd789862013-12-19 21:21:06 +0200408 #print('first lookup failed')
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000409
Serhiy Storchakabd789862013-12-19 21:21:06 +0200410 if modifier:
411 # Second try: fullname without modifier (possibly with encoding)
412 code = locale_alias.get(lang_enc, None)
413 if code is not None:
414 #print('lookup without modifier succeeded')
415 if '@' not in code:
416 return code + '@' + modifier
Serhiy Storchakaaf080872014-01-17 09:27:56 +0200417 if code.split('@', 1)[1].translate(_ascii_lower_map) == modifier:
Serhiy Storchakabd789862013-12-19 21:21:06 +0200418 return code
419 #print('second lookup failed')
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000420
Serhiy Storchakabd789862013-12-19 21:21:06 +0200421 if encoding:
422 # Third try: langname (without encoding, possibly with modifier)
423 lookup_name = langname
424 if modifier:
425 lookup_name += '@' + modifier
426 code = locale_alias.get(lookup_name, None)
427 if code is not None:
428 #print('lookup without encoding succeeded')
429 if '@' not in code:
430 return _replace_encoding(code, encoding)
431 code, modifier = code.split('@', 1)
432 return _replace_encoding(code, encoding) + '@' + modifier
433
434 if modifier:
435 # Fourth try: langname (without encoding and modifier)
436 code = locale_alias.get(langname, None)
437 if code is not None:
438 #print('lookup without modifier and encoding succeeded')
439 if '@' not in code:
440 return _replace_encoding(code, encoding) + '@' + modifier
441 code, defmod = code.split('@', 1)
Serhiy Storchakaaf080872014-01-17 09:27:56 +0200442 if defmod.translate(_ascii_lower_map) == modifier:
Serhiy Storchakabd789862013-12-19 21:21:06 +0200443 return _replace_encoding(code, encoding) + '@' + defmod
444
445 return localename
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000446
447def _parse_localename(localename):
448
449 """ Parses the locale code for localename and returns the
450 result as tuple (language code, encoding).
451
452 The localename is normalized and passed through the locale
453 alias engine. A ValueError is raised in case the locale name
454 cannot be parsed.
455
456 The language code corresponds to RFC 1766. code and encoding
457 can be None in case the values cannot be determined or are
Jeremy Hyltona05e2932000-06-28 14:48:01 +0000458 unknown to this implementation.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000459
460 """
461 code = normalize(localename)
Georg Brandlb709c2c2006-01-20 09:07:35 +0000462 if '@' in code:
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000463 # Deal with locale modifiers
Serhiy Storchakabd789862013-12-19 21:21:06 +0200464 code, modifier = code.split('@', 1)
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000465 if modifier == 'euro' and '.' not in code:
466 # Assume Latin-9 for @euro locales. This is bogus,
467 # since some systems may use other encodings for these
468 # locales. Also, we ignore other modifiers.
469 return code, 'iso-8859-15'
Tim Peters230a60c2002-11-09 05:08:07 +0000470
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000471 if '.' in code:
Raymond Hettinger346e67f2005-01-01 06:10:26 +0000472 return tuple(code.split('.')[:2])
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000473 elif code == 'C':
474 return None, None
Andrew M. Kuchling1f877ef2001-08-13 14:50:44 +0000475 raise ValueError, 'unknown locale: %s' % localename
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000476
477def _build_localename(localetuple):
478
479 """ Builds a locale code from the given tuple (language code,
480 encoding).
481
482 No aliasing or normalizing takes place.
483
484 """
485 language, encoding = localetuple
486 if language is None:
487 language = 'C'
488 if encoding is None:
489 return language
490 else:
491 return language + '.' + encoding
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000492
Matthias Klosef3f231f2005-09-20 07:02:49 +0000493def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000494
495 """ Tries to determine the default locale settings and returns
496 them as tuple (language code, encoding).
497
498 According to POSIX, a program which has not called
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000499 setlocale(LC_ALL, "") runs using the portable 'C' locale.
500 Calling setlocale(LC_ALL, "") lets it use the default locale as
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000501 defined by the LANG variable. Since we don't want to interfere
Thomas Wouters7e474022000-07-16 12:04:32 +0000502 with the current locale setting we thus emulate the behavior
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000503 in the way described above.
504
505 To maintain compatibility with other platforms, not only the
506 LANG variable is tested, but a list of variables given as
507 envvars parameter. The first found to be defined will be
508 used. envvars defaults to the search path used in GNU gettext;
509 it must always contain the variable name 'LANG'.
510
511 Except for the code 'C', the language code corresponds to RFC
512 1766. code and encoding can be None in case the values cannot
513 be determined.
514
515 """
Fredrik Lundh04661322000-07-09 23:16:10 +0000516
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000517 try:
518 # check if it's supported by the _locale module
519 import _locale
520 code, encoding = _locale._getdefaultlocale()
Fredrik Lundh04661322000-07-09 23:16:10 +0000521 except (ImportError, AttributeError):
522 pass
523 else:
Fredrik Lundh663809e2000-07-10 19:32:19 +0000524 # make sure the code/encoding values are valid
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000525 if sys.platform == "win32" and code and code[:2] == "0x":
526 # map windows language identifier to language name
527 code = windows_locale.get(int(code, 0))
Fredrik Lundh663809e2000-07-10 19:32:19 +0000528 # ...add other platform-specific processing here, if
529 # necessary...
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000530 return code, encoding
Fredrik Lundh04661322000-07-09 23:16:10 +0000531
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000532 # fall back on POSIX behaviour
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000533 import os
534 lookup = os.environ.get
535 for variable in envvars:
536 localename = lookup(variable,None)
Martin v. Löwisc8ae31d2004-07-26 12:45:18 +0000537 if localename:
Matthias Klosef3f231f2005-09-20 07:02:49 +0000538 if variable == 'LANGUAGE':
539 localename = localename.split(':')[0]
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000540 break
541 else:
542 localename = 'C'
543 return _parse_localename(localename)
544
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000545
546def getlocale(category=LC_CTYPE):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000547
548 """ Returns the current setting for the given locale category as
549 tuple (language code, encoding).
550
551 category may be one of the LC_* value except LC_ALL. It
552 defaults to LC_CTYPE.
553
554 Except for the code 'C', the language code corresponds to RFC
555 1766. code and encoding can be None in case the values cannot
556 be determined.
557
558 """
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000559 localename = _setlocale(category)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000560 if category == LC_ALL and ';' in localename:
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000561 raise TypeError, 'category LC_ALL is not supported'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000562 return _parse_localename(localename)
563
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000564def setlocale(category, locale=None):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000565
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000566 """ Set the locale for the given category. The locale can be
Petri Lehtinen416ecff2011-11-05 10:18:50 +0200567 a string, an iterable of two strings (language code and encoding),
568 or None.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000569
Petri Lehtinen416ecff2011-11-05 10:18:50 +0200570 Iterables are converted to strings using the locale aliasing
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000571 engine. Locale strings are passed directly to the C lib.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000572
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000573 category may be given as one of the LC_* values.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000574
575 """
Victor Stinnerecb863b2011-06-20 22:07:06 +0200576 if locale and type(locale) is not type(""):
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000577 # convert to string
578 locale = normalize(_build_localename(locale))
579 return _setlocale(category, locale)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000580
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000581def resetlocale(category=LC_ALL):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000582
583 """ Sets the locale for category to the default setting.
584
585 The default setting is determined by calling
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000586 getdefaultlocale(). category defaults to LC_ALL.
587
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000588 """
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000589 _setlocale(category, _build_localename(getdefaultlocale()))
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000590
Benjamin Petersone021c9c2009-06-07 16:24:48 +0000591if sys.platform.startswith("win"):
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000592 # On Win32, this will return the ANSI code page
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000593 def getpreferredencoding(do_setlocale = True):
594 """Return the charset that the user is likely using."""
595 import _locale
Tim Petersa326f472002-11-05 03:49:09 +0000596 return _locale._getdefaultlocale()[1]
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000597else:
598 # On Unix, if CODESET is available, use that.
599 try:
600 CODESET
601 except NameError:
602 # Fall back to parsing environment variables :-(
603 def getpreferredencoding(do_setlocale = True):
604 """Return the charset that the user is likely using,
605 by looking at environment variables."""
606 return getdefaultlocale()[1]
607 else:
608 def getpreferredencoding(do_setlocale = True):
609 """Return the charset that the user is likely using,
610 according to the system configuration."""
611 if do_setlocale:
612 oldloc = setlocale(LC_CTYPE)
Jeroen Ruigrok van der Werven041f4652009-05-06 05:25:42 +0000613 try:
614 setlocale(LC_CTYPE, "")
Jeroen Ruigrok van der Wervenc924b3d2009-05-06 13:16:36 +0000615 except Error:
Jeroen Ruigrok van der Werven041f4652009-05-06 05:25:42 +0000616 pass
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000617 result = nl_langinfo(CODESET)
618 setlocale(LC_CTYPE, oldloc)
619 return result
620 else:
621 return nl_langinfo(CODESET)
Tim Peters230a60c2002-11-09 05:08:07 +0000622
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000623
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000624### Database
625#
626# The following data was extracted from the locale.alias file which
627# comes with X11 and then hand edited removing the explicit encoding
628# definitions and adding some more aliases. The file is usually
629# available as /usr/lib/X11/locale/locale.alias.
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000630#
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000631
632#
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000633# The local_encoding_alias table maps lowercase encoding alias names
634# to C locale encoding names (case-sensitive). Note that normalize()
635# first looks up the encoding in the encodings.aliases dictionary and
636# then applies this mapping to find the correct C lib name for the
637# encoding.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000638#
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000639locale_encoding_alias = {
640
641 # Mappings for non-standard encoding names used in locale names
642 '437': 'C',
643 'c': 'C',
644 'en': 'ISO8859-1',
645 'jis': 'JIS7',
646 'jis7': 'JIS7',
647 'ajec': 'eucJP',
648
649 # Mappings from Python codec names to C lib encoding names
650 'ascii': 'ISO8859-1',
651 'latin_1': 'ISO8859-1',
652 'iso8859_1': 'ISO8859-1',
653 'iso8859_10': 'ISO8859-10',
654 'iso8859_11': 'ISO8859-11',
655 'iso8859_13': 'ISO8859-13',
656 'iso8859_14': 'ISO8859-14',
657 'iso8859_15': 'ISO8859-15',
Jeroen Ruigrok van der Werven51133d42009-05-08 13:07:39 +0000658 'iso8859_16': 'ISO8859-16',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000659 'iso8859_2': 'ISO8859-2',
660 'iso8859_3': 'ISO8859-3',
661 'iso8859_4': 'ISO8859-4',
662 'iso8859_5': 'ISO8859-5',
663 'iso8859_6': 'ISO8859-6',
664 'iso8859_7': 'ISO8859-7',
665 'iso8859_8': 'ISO8859-8',
666 'iso8859_9': 'ISO8859-9',
667 'iso2022_jp': 'JIS7',
668 'shift_jis': 'SJIS',
669 'tactis': 'TACTIS',
670 'euc_jp': 'eucJP',
671 'euc_kr': 'eucKR',
Ronald Oussoren372954e2011-05-17 13:22:30 +0200672 'utf_8': 'UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000673 'koi8_r': 'KOI8-R',
674 'koi8_u': 'KOI8-U',
675 # XXX This list is still incomplete. If you know more
676 # mappings, please file a bug report. Thanks.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000677}
678
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000679#
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000680# The locale_alias table maps lowercase alias names to C locale names
681# (case-sensitive). Encodings are always separated from the locale
682# name using a dot ('.'); they should only be given in case the
683# language name is needed to interpret the given encoding alias
684# correctly (CJK codes often have this need).
685#
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000686# Note that the normalize() function which uses this tables
687# removes '_' and '-' characters from the encoding part of the
688# locale name before doing the lookup. This saves a lot of
689# space in the table.
690#
691# MAL 2004-12-10:
692# Updated alias mapping to most recent locale.alias file
693# from X.org distribution using makelocalealias.py.
694#
695# These are the differences compared to the old mapping (Python 2.4
696# and older):
697#
698# updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
699# updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
700# updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
701# updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
702# updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
703# updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
704# updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1'
705# updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
706# updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
707# updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
708# updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
709# updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
710# updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
711# updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP'
712# updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13'
713# updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13'
714# updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
715# updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
716# updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11'
717# updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312'
718# updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5'
719# updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5'
720#
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000721# MAL 2008-05-30:
722# Updated alias mapping to most recent locale.alias file
723# from X.org distribution using makelocalealias.py.
724#
725# These are the differences compared to the old mapping (Python 2.5
726# and older):
727#
728# updated 'cs_cs.iso88592' -> 'cs_CZ.ISO8859-2' to 'cs_CS.ISO8859-2'
729# updated 'serbocroatian' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
730# updated 'sh' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
731# updated 'sh_hr.iso88592' -> 'sh_HR.ISO8859-2' to 'hr_HR.ISO8859-2'
732# updated 'sh_sp' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
733# updated 'sh_yu' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
734# updated 'sp' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
735# updated 'sp_yu' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
736# updated 'sr' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
737# updated 'sr@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
738# updated 'sr_sp' -> 'sr_SP.ISO8859-2' to 'sr_CS.ISO8859-2'
739# updated 'sr_yu' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
740# updated 'sr_yu.cp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'
741# updated 'sr_yu.iso88592' -> 'sr_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
742# updated 'sr_yu.iso88595' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
743# updated 'sr_yu.iso88595@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
744# updated 'sr_yu.microsoftcp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'
745# updated 'sr_yu.utf8@cyrillic' -> 'sr_YU.UTF-8' to 'sr_CS.UTF-8'
746# updated 'sr_yu@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
Antoine Pitroufc531532010-04-11 22:32:39 +0000747#
748# AP 2010-04-12:
749# Updated alias mapping to most recent locale.alias file
750# from X.org distribution using makelocalealias.py.
751#
752# These are the differences compared to the old mapping (Python 2.6.5
753# and older):
754#
755# updated 'ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
756# updated 'ru_ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
757# updated 'serbocroatian' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
758# updated 'sh' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
759# updated 'sh_yu' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
760# updated 'sr' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
761# updated 'sr@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
762# updated 'sr@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
763# updated 'sr_cs.utf8@latn' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8@latin'
764# updated 'sr_cs@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
765# updated 'sr_yu' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8@latin'
766# updated 'sr_yu.utf8@cyrillic' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8'
767# updated 'sr_yu@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
768#
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +0200769# SS 2013-12-20:
770# Updated alias mapping to most recent locale.alias file
771# from X.org distribution using makelocalealias.py.
772#
773# These are the differences compared to the old mapping (Python 2.7.6
774# and older):
775#
776# updated 'a3' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
777# updated 'a3_az' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
778# updated 'a3_az.koi8c' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
779# updated 'cs_cs.iso88592' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
780# updated 'hebrew' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
781# updated 'hebrew.iso88598' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
782# updated 'sd' -> 'sd_IN@devanagari.UTF-8' to 'sd_IN.UTF-8'
783# updated 'sr@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
784# updated 'sr_cs' -> 'sr_RS.UTF-8' to 'sr_CS.UTF-8'
785# updated 'sr_cs.utf8@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
786# updated 'sr_cs@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000787
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000788locale_alias = {
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +0200789 'a3': 'az_AZ.KOI8-C',
790 'a3_az': 'az_AZ.KOI8-C',
791 'a3_az.koi8c': 'az_AZ.KOI8-C',
792 'a3_az.koic': 'az_AZ.KOI8-C',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000793 'af': 'af_ZA.ISO8859-1',
794 'af_za': 'af_ZA.ISO8859-1',
795 'af_za.iso88591': 'af_ZA.ISO8859-1',
796 'am': 'am_ET.UTF-8',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000797 'am_et': 'am_ET.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000798 'american': 'en_US.ISO8859-1',
799 'american.iso88591': 'en_US.ISO8859-1',
800 'ar': 'ar_AA.ISO8859-6',
801 'ar_aa': 'ar_AA.ISO8859-6',
802 'ar_aa.iso88596': 'ar_AA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000803 'ar_ae': 'ar_AE.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000804 'ar_ae.iso88596': 'ar_AE.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000805 'ar_bh': 'ar_BH.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000806 'ar_bh.iso88596': 'ar_BH.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000807 'ar_dz': 'ar_DZ.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000808 'ar_dz.iso88596': 'ar_DZ.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000809 'ar_eg': 'ar_EG.ISO8859-6',
810 'ar_eg.iso88596': 'ar_EG.ISO8859-6',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +0200811 'ar_in': 'ar_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000812 'ar_iq': 'ar_IQ.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000813 'ar_iq.iso88596': 'ar_IQ.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000814 'ar_jo': 'ar_JO.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000815 'ar_jo.iso88596': 'ar_JO.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000816 'ar_kw': 'ar_KW.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000817 'ar_kw.iso88596': 'ar_KW.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000818 'ar_lb': 'ar_LB.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000819 'ar_lb.iso88596': 'ar_LB.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000820 'ar_ly': 'ar_LY.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000821 'ar_ly.iso88596': 'ar_LY.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000822 'ar_ma': 'ar_MA.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000823 'ar_ma.iso88596': 'ar_MA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000824 'ar_om': 'ar_OM.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000825 'ar_om.iso88596': 'ar_OM.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000826 'ar_qa': 'ar_QA.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000827 'ar_qa.iso88596': 'ar_QA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000828 'ar_sa': 'ar_SA.ISO8859-6',
829 'ar_sa.iso88596': 'ar_SA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000830 'ar_sd': 'ar_SD.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000831 'ar_sd.iso88596': 'ar_SD.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000832 'ar_sy': 'ar_SY.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000833 'ar_sy.iso88596': 'ar_SY.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000834 'ar_tn': 'ar_TN.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000835 'ar_tn.iso88596': 'ar_TN.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000836 'ar_ye': 'ar_YE.ISO8859-6',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000837 'ar_ye.iso88596': 'ar_YE.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000838 'arabic': 'ar_AA.ISO8859-6',
839 'arabic.iso88596': 'ar_AA.ISO8859-6',
Antoine Pitroufc531532010-04-11 22:32:39 +0000840 'as': 'as_IN.UTF-8',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +0200841 'as_in': 'as_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000842 'az': 'az_AZ.ISO8859-9E',
843 'az_az': 'az_AZ.ISO8859-9E',
844 'az_az.iso88599e': 'az_AZ.ISO8859-9E',
845 'be': 'be_BY.CP1251',
Antoine Pitroufc531532010-04-11 22:32:39 +0000846 'be@latin': 'be_BY.UTF-8@latin',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000847 'be_by': 'be_BY.CP1251',
848 'be_by.cp1251': 'be_BY.CP1251',
849 'be_by.microsoftcp1251': 'be_BY.CP1251',
Antoine Pitroufc531532010-04-11 22:32:39 +0000850 'be_by.utf8@latin': 'be_BY.UTF-8@latin',
851 'be_by@latin': 'be_BY.UTF-8@latin',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000852 'bg': 'bg_BG.CP1251',
853 'bg_bg': 'bg_BG.CP1251',
854 'bg_bg.cp1251': 'bg_BG.CP1251',
855 'bg_bg.iso88595': 'bg_BG.ISO8859-5',
856 'bg_bg.koi8r': 'bg_BG.KOI8-R',
857 'bg_bg.microsoftcp1251': 'bg_BG.CP1251',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000858 'bn_in': 'bn_IN.UTF-8',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +0200859 'bo_in': 'bo_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000860 'bokmal': 'nb_NO.ISO8859-1',
861 'bokm\xe5l': 'nb_NO.ISO8859-1',
862 'br': 'br_FR.ISO8859-1',
863 'br_fr': 'br_FR.ISO8859-1',
864 'br_fr.iso88591': 'br_FR.ISO8859-1',
865 'br_fr.iso885914': 'br_FR.ISO8859-14',
866 'br_fr.iso885915': 'br_FR.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000867 'br_fr.iso885915@euro': 'br_FR.ISO8859-15',
868 'br_fr.utf8@euro': 'br_FR.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000869 'br_fr@euro': 'br_FR.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000870 'bs': 'bs_BA.ISO8859-2',
871 'bs_ba': 'bs_BA.ISO8859-2',
872 'bs_ba.iso88592': 'bs_BA.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000873 'bulgarian': 'bg_BG.CP1251',
874 'c': 'C',
875 'c-french': 'fr_CA.ISO8859-1',
876 'c-french.iso88591': 'fr_CA.ISO8859-1',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +0200877 'c.ascii': 'C',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000878 'c.en': 'C',
879 'c.iso88591': 'en_US.ISO8859-1',
880 'c_c': 'C',
881 'c_c.c': 'C',
882 'ca': 'ca_ES.ISO8859-1',
Antoine Pitroufc531532010-04-11 22:32:39 +0000883 'ca_ad': 'ca_AD.ISO8859-1',
884 'ca_ad.iso88591': 'ca_AD.ISO8859-1',
885 'ca_ad.iso885915': 'ca_AD.ISO8859-15',
886 'ca_ad.iso885915@euro': 'ca_AD.ISO8859-15',
887 'ca_ad.utf8@euro': 'ca_AD.UTF-8',
888 'ca_ad@euro': 'ca_AD.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000889 'ca_es': 'ca_ES.ISO8859-1',
890 'ca_es.iso88591': 'ca_ES.ISO8859-1',
891 'ca_es.iso885915': 'ca_ES.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000892 'ca_es.iso885915@euro': 'ca_ES.ISO8859-15',
893 'ca_es.utf8@euro': 'ca_ES.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000894 'ca_es@euro': 'ca_ES.ISO8859-15',
Antoine Pitroufc531532010-04-11 22:32:39 +0000895 'ca_fr': 'ca_FR.ISO8859-1',
896 'ca_fr.iso88591': 'ca_FR.ISO8859-1',
897 'ca_fr.iso885915': 'ca_FR.ISO8859-15',
898 'ca_fr.iso885915@euro': 'ca_FR.ISO8859-15',
899 'ca_fr.utf8@euro': 'ca_FR.UTF-8',
900 'ca_fr@euro': 'ca_FR.ISO8859-15',
901 'ca_it': 'ca_IT.ISO8859-1',
902 'ca_it.iso88591': 'ca_IT.ISO8859-1',
903 'ca_it.iso885915': 'ca_IT.ISO8859-15',
904 'ca_it.iso885915@euro': 'ca_IT.ISO8859-15',
905 'ca_it.utf8@euro': 'ca_IT.UTF-8',
906 'ca_it@euro': 'ca_IT.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000907 'catalan': 'ca_ES.ISO8859-1',
908 'cextend': 'en_US.ISO8859-1',
909 'cextend.en': 'en_US.ISO8859-1',
910 'chinese-s': 'zh_CN.eucCN',
911 'chinese-t': 'zh_TW.eucTW',
912 'croatian': 'hr_HR.ISO8859-2',
913 'cs': 'cs_CZ.ISO8859-2',
914 'cs_cs': 'cs_CZ.ISO8859-2',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +0200915 'cs_cs.iso88592': 'cs_CZ.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000916 'cs_cz': 'cs_CZ.ISO8859-2',
917 'cs_cz.iso88592': 'cs_CZ.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000918 'cy': 'cy_GB.ISO8859-1',
919 'cy_gb': 'cy_GB.ISO8859-1',
920 'cy_gb.iso88591': 'cy_GB.ISO8859-1',
921 'cy_gb.iso885914': 'cy_GB.ISO8859-14',
922 'cy_gb.iso885915': 'cy_GB.ISO8859-15',
923 'cy_gb@euro': 'cy_GB.ISO8859-15',
924 'cz': 'cs_CZ.ISO8859-2',
925 'cz_cz': 'cs_CZ.ISO8859-2',
926 'czech': 'cs_CZ.ISO8859-2',
927 'da': 'da_DK.ISO8859-1',
Antoine Pitroufc531532010-04-11 22:32:39 +0000928 'da.iso885915': 'da_DK.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000929 'da_dk': 'da_DK.ISO8859-1',
930 'da_dk.88591': 'da_DK.ISO8859-1',
931 'da_dk.885915': 'da_DK.ISO8859-15',
932 'da_dk.iso88591': 'da_DK.ISO8859-1',
933 'da_dk.iso885915': 'da_DK.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000934 'da_dk@euro': 'da_DK.ISO8859-15',
935 'danish': 'da_DK.ISO8859-1',
936 'danish.iso88591': 'da_DK.ISO8859-1',
937 'dansk': 'da_DK.ISO8859-1',
938 'de': 'de_DE.ISO8859-1',
Antoine Pitroufc531532010-04-11 22:32:39 +0000939 'de.iso885915': 'de_DE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000940 'de_at': 'de_AT.ISO8859-1',
941 'de_at.iso88591': 'de_AT.ISO8859-1',
942 'de_at.iso885915': 'de_AT.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000943 'de_at.iso885915@euro': 'de_AT.ISO8859-15',
944 'de_at.utf8@euro': 'de_AT.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000945 'de_at@euro': 'de_AT.ISO8859-15',
946 'de_be': 'de_BE.ISO8859-1',
947 'de_be.iso88591': 'de_BE.ISO8859-1',
948 'de_be.iso885915': 'de_BE.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000949 'de_be.iso885915@euro': 'de_BE.ISO8859-15',
950 'de_be.utf8@euro': 'de_BE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000951 'de_be@euro': 'de_BE.ISO8859-15',
952 'de_ch': 'de_CH.ISO8859-1',
953 'de_ch.iso88591': 'de_CH.ISO8859-1',
954 'de_ch.iso885915': 'de_CH.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000955 'de_ch@euro': 'de_CH.ISO8859-15',
956 'de_de': 'de_DE.ISO8859-1',
957 'de_de.88591': 'de_DE.ISO8859-1',
958 'de_de.885915': 'de_DE.ISO8859-15',
959 'de_de.885915@euro': 'de_DE.ISO8859-15',
960 'de_de.iso88591': 'de_DE.ISO8859-1',
961 'de_de.iso885915': 'de_DE.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000962 'de_de.iso885915@euro': 'de_DE.ISO8859-15',
963 'de_de.utf8@euro': 'de_DE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000964 'de_de@euro': 'de_DE.ISO8859-15',
965 'de_lu': 'de_LU.ISO8859-1',
966 'de_lu.iso88591': 'de_LU.ISO8859-1',
967 'de_lu.iso885915': 'de_LU.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000968 'de_lu.iso885915@euro': 'de_LU.ISO8859-15',
969 'de_lu.utf8@euro': 'de_LU.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000970 'de_lu@euro': 'de_LU.ISO8859-15',
971 'deutsch': 'de_DE.ISO8859-1',
972 'dutch': 'nl_NL.ISO8859-1',
973 'dutch.iso88591': 'nl_BE.ISO8859-1',
974 'ee': 'ee_EE.ISO8859-4',
975 'ee_ee': 'ee_EE.ISO8859-4',
976 'ee_ee.iso88594': 'ee_EE.ISO8859-4',
977 'eesti': 'et_EE.ISO8859-1',
978 'el': 'el_GR.ISO8859-7',
979 'el_gr': 'el_GR.ISO8859-7',
980 'el_gr.iso88597': 'el_GR.ISO8859-7',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000981 'el_gr@euro': 'el_GR.ISO8859-15',
982 'en': 'en_US.ISO8859-1',
983 'en.iso88591': 'en_US.ISO8859-1',
984 'en_au': 'en_AU.ISO8859-1',
985 'en_au.iso88591': 'en_AU.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000986 'en_be': 'en_BE.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000987 'en_be@euro': 'en_BE.ISO8859-15',
988 'en_bw': 'en_BW.ISO8859-1',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000989 'en_bw.iso88591': 'en_BW.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000990 'en_ca': 'en_CA.ISO8859-1',
991 'en_ca.iso88591': 'en_CA.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000992 'en_gb': 'en_GB.ISO8859-1',
993 'en_gb.88591': 'en_GB.ISO8859-1',
994 'en_gb.iso88591': 'en_GB.ISO8859-1',
995 'en_gb.iso885915': 'en_GB.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000996 'en_gb@euro': 'en_GB.ISO8859-15',
997 'en_hk': 'en_HK.ISO8859-1',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +0000998 'en_hk.iso88591': 'en_HK.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000999 'en_ie': 'en_IE.ISO8859-1',
1000 'en_ie.iso88591': 'en_IE.ISO8859-1',
1001 'en_ie.iso885915': 'en_IE.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001002 'en_ie.iso885915@euro': 'en_IE.ISO8859-15',
1003 'en_ie.utf8@euro': 'en_IE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001004 'en_ie@euro': 'en_IE.ISO8859-15',
1005 'en_in': 'en_IN.ISO8859-1',
1006 'en_nz': 'en_NZ.ISO8859-1',
1007 'en_nz.iso88591': 'en_NZ.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001008 'en_ph': 'en_PH.ISO8859-1',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001009 'en_ph.iso88591': 'en_PH.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001010 'en_sg': 'en_SG.ISO8859-1',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001011 'en_sg.iso88591': 'en_SG.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001012 'en_uk': 'en_GB.ISO8859-1',
1013 'en_us': 'en_US.ISO8859-1',
1014 'en_us.88591': 'en_US.ISO8859-1',
1015 'en_us.885915': 'en_US.ISO8859-15',
1016 'en_us.iso88591': 'en_US.ISO8859-1',
1017 'en_us.iso885915': 'en_US.ISO8859-15',
1018 'en_us.iso885915@euro': 'en_US.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001019 'en_us@euro': 'en_US.ISO8859-15',
1020 'en_us@euro@euro': 'en_US.ISO8859-15',
1021 'en_za': 'en_ZA.ISO8859-1',
1022 'en_za.88591': 'en_ZA.ISO8859-1',
1023 'en_za.iso88591': 'en_ZA.ISO8859-1',
1024 'en_za.iso885915': 'en_ZA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001025 'en_za@euro': 'en_ZA.ISO8859-15',
1026 'en_zw': 'en_ZW.ISO8859-1',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001027 'en_zw.iso88591': 'en_ZW.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001028 'eng_gb': 'en_GB.ISO8859-1',
1029 'eng_gb.8859': 'en_GB.ISO8859-1',
1030 'english': 'en_EN.ISO8859-1',
1031 'english.iso88591': 'en_EN.ISO8859-1',
1032 'english_uk': 'en_GB.ISO8859-1',
1033 'english_uk.8859': 'en_GB.ISO8859-1',
1034 'english_united-states': 'en_US.ISO8859-1',
1035 'english_united-states.437': 'C',
1036 'english_us': 'en_US.ISO8859-1',
1037 'english_us.8859': 'en_US.ISO8859-1',
1038 'english_us.ascii': 'en_US.ISO8859-1',
1039 'eo': 'eo_XX.ISO8859-3',
1040 'eo_eo': 'eo_EO.ISO8859-3',
1041 'eo_eo.iso88593': 'eo_EO.ISO8859-3',
1042 'eo_xx': 'eo_XX.ISO8859-3',
1043 'eo_xx.iso88593': 'eo_XX.ISO8859-3',
1044 'es': 'es_ES.ISO8859-1',
1045 'es_ar': 'es_AR.ISO8859-1',
1046 'es_ar.iso88591': 'es_AR.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001047 'es_bo': 'es_BO.ISO8859-1',
1048 'es_bo.iso88591': 'es_BO.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001049 'es_cl': 'es_CL.ISO8859-1',
1050 'es_cl.iso88591': 'es_CL.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001051 'es_co': 'es_CO.ISO8859-1',
1052 'es_co.iso88591': 'es_CO.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001053 'es_cr': 'es_CR.ISO8859-1',
1054 'es_cr.iso88591': 'es_CR.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001055 'es_do': 'es_DO.ISO8859-1',
1056 'es_do.iso88591': 'es_DO.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001057 'es_ec': 'es_EC.ISO8859-1',
1058 'es_ec.iso88591': 'es_EC.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001059 'es_es': 'es_ES.ISO8859-1',
1060 'es_es.88591': 'es_ES.ISO8859-1',
1061 'es_es.iso88591': 'es_ES.ISO8859-1',
1062 'es_es.iso885915': 'es_ES.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001063 'es_es.iso885915@euro': 'es_ES.ISO8859-15',
1064 'es_es.utf8@euro': 'es_ES.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001065 'es_es@euro': 'es_ES.ISO8859-15',
1066 'es_gt': 'es_GT.ISO8859-1',
1067 'es_gt.iso88591': 'es_GT.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001068 'es_hn': 'es_HN.ISO8859-1',
1069 'es_hn.iso88591': 'es_HN.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001070 'es_mx': 'es_MX.ISO8859-1',
1071 'es_mx.iso88591': 'es_MX.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001072 'es_ni': 'es_NI.ISO8859-1',
1073 'es_ni.iso88591': 'es_NI.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001074 'es_pa': 'es_PA.ISO8859-1',
1075 'es_pa.iso88591': 'es_PA.ISO8859-1',
1076 'es_pa.iso885915': 'es_PA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001077 'es_pa@euro': 'es_PA.ISO8859-15',
1078 'es_pe': 'es_PE.ISO8859-1',
1079 'es_pe.iso88591': 'es_PE.ISO8859-1',
1080 'es_pe.iso885915': 'es_PE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001081 'es_pe@euro': 'es_PE.ISO8859-15',
1082 'es_pr': 'es_PR.ISO8859-1',
1083 'es_pr.iso88591': 'es_PR.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001084 'es_py': 'es_PY.ISO8859-1',
1085 'es_py.iso88591': 'es_PY.ISO8859-1',
1086 'es_py.iso885915': 'es_PY.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001087 'es_py@euro': 'es_PY.ISO8859-15',
1088 'es_sv': 'es_SV.ISO8859-1',
1089 'es_sv.iso88591': 'es_SV.ISO8859-1',
1090 'es_sv.iso885915': 'es_SV.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001091 'es_sv@euro': 'es_SV.ISO8859-15',
1092 'es_us': 'es_US.ISO8859-1',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001093 'es_us.iso88591': 'es_US.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001094 'es_uy': 'es_UY.ISO8859-1',
1095 'es_uy.iso88591': 'es_UY.ISO8859-1',
1096 'es_uy.iso885915': 'es_UY.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001097 'es_uy@euro': 'es_UY.ISO8859-15',
1098 'es_ve': 'es_VE.ISO8859-1',
1099 'es_ve.iso88591': 'es_VE.ISO8859-1',
1100 'es_ve.iso885915': 'es_VE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001101 'es_ve@euro': 'es_VE.ISO8859-15',
1102 'estonian': 'et_EE.ISO8859-1',
1103 'et': 'et_EE.ISO8859-15',
1104 'et_ee': 'et_EE.ISO8859-15',
1105 'et_ee.iso88591': 'et_EE.ISO8859-1',
1106 'et_ee.iso885913': 'et_EE.ISO8859-13',
1107 'et_ee.iso885915': 'et_EE.ISO8859-15',
1108 'et_ee.iso88594': 'et_EE.ISO8859-4',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001109 'et_ee@euro': 'et_EE.ISO8859-15',
1110 'eu': 'eu_ES.ISO8859-1',
1111 'eu_es': 'eu_ES.ISO8859-1',
1112 'eu_es.iso88591': 'eu_ES.ISO8859-1',
1113 'eu_es.iso885915': 'eu_ES.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001114 'eu_es.iso885915@euro': 'eu_ES.ISO8859-15',
1115 'eu_es.utf8@euro': 'eu_ES.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001116 'eu_es@euro': 'eu_ES.ISO8859-15',
1117 'fa': 'fa_IR.UTF-8',
1118 'fa_ir': 'fa_IR.UTF-8',
1119 'fa_ir.isiri3342': 'fa_IR.ISIRI-3342',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001120 'fi': 'fi_FI.ISO8859-15',
Antoine Pitroufc531532010-04-11 22:32:39 +00001121 'fi.iso885915': 'fi_FI.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001122 'fi_fi': 'fi_FI.ISO8859-15',
1123 'fi_fi.88591': 'fi_FI.ISO8859-1',
1124 'fi_fi.iso88591': 'fi_FI.ISO8859-1',
1125 'fi_fi.iso885915': 'fi_FI.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001126 'fi_fi.iso885915@euro': 'fi_FI.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001127 'fi_fi.utf8@euro': 'fi_FI.UTF-8',
1128 'fi_fi@euro': 'fi_FI.ISO8859-15',
1129 'finnish': 'fi_FI.ISO8859-1',
1130 'finnish.iso88591': 'fi_FI.ISO8859-1',
1131 'fo': 'fo_FO.ISO8859-1',
1132 'fo_fo': 'fo_FO.ISO8859-1',
1133 'fo_fo.iso88591': 'fo_FO.ISO8859-1',
1134 'fo_fo.iso885915': 'fo_FO.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001135 'fo_fo@euro': 'fo_FO.ISO8859-15',
1136 'fr': 'fr_FR.ISO8859-1',
Antoine Pitroufc531532010-04-11 22:32:39 +00001137 'fr.iso885915': 'fr_FR.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001138 'fr_be': 'fr_BE.ISO8859-1',
1139 'fr_be.88591': 'fr_BE.ISO8859-1',
1140 'fr_be.iso88591': 'fr_BE.ISO8859-1',
1141 'fr_be.iso885915': 'fr_BE.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001142 'fr_be.iso885915@euro': 'fr_BE.ISO8859-15',
1143 'fr_be.utf8@euro': 'fr_BE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001144 'fr_be@euro': 'fr_BE.ISO8859-15',
1145 'fr_ca': 'fr_CA.ISO8859-1',
1146 'fr_ca.88591': 'fr_CA.ISO8859-1',
1147 'fr_ca.iso88591': 'fr_CA.ISO8859-1',
1148 'fr_ca.iso885915': 'fr_CA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001149 'fr_ca@euro': 'fr_CA.ISO8859-15',
1150 'fr_ch': 'fr_CH.ISO8859-1',
1151 'fr_ch.88591': 'fr_CH.ISO8859-1',
1152 'fr_ch.iso88591': 'fr_CH.ISO8859-1',
1153 'fr_ch.iso885915': 'fr_CH.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001154 'fr_ch@euro': 'fr_CH.ISO8859-15',
1155 'fr_fr': 'fr_FR.ISO8859-1',
1156 'fr_fr.88591': 'fr_FR.ISO8859-1',
1157 'fr_fr.iso88591': 'fr_FR.ISO8859-1',
1158 'fr_fr.iso885915': 'fr_FR.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001159 'fr_fr.iso885915@euro': 'fr_FR.ISO8859-15',
1160 'fr_fr.utf8@euro': 'fr_FR.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001161 'fr_fr@euro': 'fr_FR.ISO8859-15',
1162 'fr_lu': 'fr_LU.ISO8859-1',
1163 'fr_lu.88591': 'fr_LU.ISO8859-1',
1164 'fr_lu.iso88591': 'fr_LU.ISO8859-1',
1165 'fr_lu.iso885915': 'fr_LU.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001166 'fr_lu.iso885915@euro': 'fr_LU.ISO8859-15',
1167 'fr_lu.utf8@euro': 'fr_LU.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001168 'fr_lu@euro': 'fr_LU.ISO8859-15',
1169 'fran\xe7ais': 'fr_FR.ISO8859-1',
1170 'fre_fr': 'fr_FR.ISO8859-1',
1171 'fre_fr.8859': 'fr_FR.ISO8859-1',
1172 'french': 'fr_FR.ISO8859-1',
1173 'french.iso88591': 'fr_CH.ISO8859-1',
1174 'french_france': 'fr_FR.ISO8859-1',
1175 'french_france.8859': 'fr_FR.ISO8859-1',
1176 'ga': 'ga_IE.ISO8859-1',
1177 'ga_ie': 'ga_IE.ISO8859-1',
1178 'ga_ie.iso88591': 'ga_IE.ISO8859-1',
1179 'ga_ie.iso885914': 'ga_IE.ISO8859-14',
1180 'ga_ie.iso885915': 'ga_IE.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001181 'ga_ie.iso885915@euro': 'ga_IE.ISO8859-15',
1182 'ga_ie.utf8@euro': 'ga_IE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001183 'ga_ie@euro': 'ga_IE.ISO8859-15',
1184 'galego': 'gl_ES.ISO8859-1',
1185 'galician': 'gl_ES.ISO8859-1',
1186 'gd': 'gd_GB.ISO8859-1',
1187 'gd_gb': 'gd_GB.ISO8859-1',
1188 'gd_gb.iso88591': 'gd_GB.ISO8859-1',
1189 'gd_gb.iso885914': 'gd_GB.ISO8859-14',
1190 'gd_gb.iso885915': 'gd_GB.ISO8859-15',
1191 'gd_gb@euro': 'gd_GB.ISO8859-15',
1192 'ger_de': 'de_DE.ISO8859-1',
1193 'ger_de.8859': 'de_DE.ISO8859-1',
1194 'german': 'de_DE.ISO8859-1',
1195 'german.iso88591': 'de_CH.ISO8859-1',
1196 'german_germany': 'de_DE.ISO8859-1',
1197 'german_germany.8859': 'de_DE.ISO8859-1',
1198 'gl': 'gl_ES.ISO8859-1',
1199 'gl_es': 'gl_ES.ISO8859-1',
1200 'gl_es.iso88591': 'gl_ES.ISO8859-1',
1201 'gl_es.iso885915': 'gl_ES.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001202 'gl_es.iso885915@euro': 'gl_ES.ISO8859-15',
1203 'gl_es.utf8@euro': 'gl_ES.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001204 'gl_es@euro': 'gl_ES.ISO8859-15',
1205 'greek': 'el_GR.ISO8859-7',
1206 'greek.iso88597': 'el_GR.ISO8859-7',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001207 'gu_in': 'gu_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001208 'gv': 'gv_GB.ISO8859-1',
1209 'gv_gb': 'gv_GB.ISO8859-1',
1210 'gv_gb.iso88591': 'gv_GB.ISO8859-1',
1211 'gv_gb.iso885914': 'gv_GB.ISO8859-14',
1212 'gv_gb.iso885915': 'gv_GB.ISO8859-15',
1213 'gv_gb@euro': 'gv_GB.ISO8859-15',
1214 'he': 'he_IL.ISO8859-8',
1215 'he_il': 'he_IL.ISO8859-8',
1216 'he_il.cp1255': 'he_IL.CP1255',
1217 'he_il.iso88598': 'he_IL.ISO8859-8',
1218 'he_il.microsoftcp1255': 'he_IL.CP1255',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +02001219 'hebrew': 'he_IL.ISO8859-8',
1220 'hebrew.iso88598': 'he_IL.ISO8859-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001221 'hi': 'hi_IN.ISCII-DEV',
1222 'hi_in': 'hi_IN.ISCII-DEV',
1223 'hi_in.isciidev': 'hi_IN.ISCII-DEV',
Antoine Pitroufc531532010-04-11 22:32:39 +00001224 'hne': 'hne_IN.UTF-8',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +02001225 'hne_in': 'hne_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001226 'hr': 'hr_HR.ISO8859-2',
1227 'hr_hr': 'hr_HR.ISO8859-2',
1228 'hr_hr.iso88592': 'hr_HR.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001229 'hrvatski': 'hr_HR.ISO8859-2',
1230 'hu': 'hu_HU.ISO8859-2',
1231 'hu_hu': 'hu_HU.ISO8859-2',
1232 'hu_hu.iso88592': 'hu_HU.ISO8859-2',
1233 'hungarian': 'hu_HU.ISO8859-2',
1234 'icelandic': 'is_IS.ISO8859-1',
1235 'icelandic.iso88591': 'is_IS.ISO8859-1',
1236 'id': 'id_ID.ISO8859-1',
1237 'id_id': 'id_ID.ISO8859-1',
1238 'in': 'id_ID.ISO8859-1',
1239 'in_id': 'id_ID.ISO8859-1',
1240 'is': 'is_IS.ISO8859-1',
1241 'is_is': 'is_IS.ISO8859-1',
1242 'is_is.iso88591': 'is_IS.ISO8859-1',
1243 'is_is.iso885915': 'is_IS.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001244 'is_is@euro': 'is_IS.ISO8859-15',
1245 'iso-8859-1': 'en_US.ISO8859-1',
1246 'iso-8859-15': 'en_US.ISO8859-15',
1247 'iso8859-1': 'en_US.ISO8859-1',
1248 'iso8859-15': 'en_US.ISO8859-15',
1249 'iso_8859_1': 'en_US.ISO8859-1',
1250 'iso_8859_15': 'en_US.ISO8859-15',
1251 'it': 'it_IT.ISO8859-1',
Antoine Pitroufc531532010-04-11 22:32:39 +00001252 'it.iso885915': 'it_IT.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001253 'it_ch': 'it_CH.ISO8859-1',
1254 'it_ch.iso88591': 'it_CH.ISO8859-1',
1255 'it_ch.iso885915': 'it_CH.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001256 'it_ch@euro': 'it_CH.ISO8859-15',
1257 'it_it': 'it_IT.ISO8859-1',
1258 'it_it.88591': 'it_IT.ISO8859-1',
1259 'it_it.iso88591': 'it_IT.ISO8859-1',
1260 'it_it.iso885915': 'it_IT.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001261 'it_it.iso885915@euro': 'it_IT.ISO8859-15',
1262 'it_it.utf8@euro': 'it_IT.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001263 'it_it@euro': 'it_IT.ISO8859-15',
1264 'italian': 'it_IT.ISO8859-1',
1265 'italian.iso88591': 'it_IT.ISO8859-1',
1266 'iu': 'iu_CA.NUNACOM-8',
1267 'iu_ca': 'iu_CA.NUNACOM-8',
1268 'iu_ca.nunacom8': 'iu_CA.NUNACOM-8',
1269 'iw': 'he_IL.ISO8859-8',
1270 'iw_il': 'he_IL.ISO8859-8',
1271 'iw_il.iso88598': 'he_IL.ISO8859-8',
1272 'ja': 'ja_JP.eucJP',
1273 'ja.jis': 'ja_JP.JIS7',
1274 'ja.sjis': 'ja_JP.SJIS',
1275 'ja_jp': 'ja_JP.eucJP',
1276 'ja_jp.ajec': 'ja_JP.eucJP',
1277 'ja_jp.euc': 'ja_JP.eucJP',
1278 'ja_jp.eucjp': 'ja_JP.eucJP',
1279 'ja_jp.iso-2022-jp': 'ja_JP.JIS7',
1280 'ja_jp.iso2022jp': 'ja_JP.JIS7',
1281 'ja_jp.jis': 'ja_JP.JIS7',
1282 'ja_jp.jis7': 'ja_JP.JIS7',
1283 'ja_jp.mscode': 'ja_JP.SJIS',
Antoine Pitroufc531532010-04-11 22:32:39 +00001284 'ja_jp.pck': 'ja_JP.SJIS',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001285 'ja_jp.sjis': 'ja_JP.SJIS',
1286 'ja_jp.ujis': 'ja_JP.eucJP',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001287 'japan': 'ja_JP.eucJP',
1288 'japanese': 'ja_JP.eucJP',
1289 'japanese-euc': 'ja_JP.eucJP',
1290 'japanese.euc': 'ja_JP.eucJP',
1291 'japanese.sjis': 'ja_JP.SJIS',
1292 'jp_jp': 'ja_JP.eucJP',
1293 'ka': 'ka_GE.GEORGIAN-ACADEMY',
1294 'ka_ge': 'ka_GE.GEORGIAN-ACADEMY',
1295 'ka_ge.georgianacademy': 'ka_GE.GEORGIAN-ACADEMY',
1296 'ka_ge.georgianps': 'ka_GE.GEORGIAN-PS',
1297 'ka_ge.georgianrs': 'ka_GE.GEORGIAN-ACADEMY',
1298 'kl': 'kl_GL.ISO8859-1',
1299 'kl_gl': 'kl_GL.ISO8859-1',
1300 'kl_gl.iso88591': 'kl_GL.ISO8859-1',
1301 'kl_gl.iso885915': 'kl_GL.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001302 'kl_gl@euro': 'kl_GL.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001303 'km_kh': 'km_KH.UTF-8',
Antoine Pitroufc531532010-04-11 22:32:39 +00001304 'kn': 'kn_IN.UTF-8',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001305 'kn_in': 'kn_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001306 'ko': 'ko_KR.eucKR',
1307 'ko_kr': 'ko_KR.eucKR',
1308 'ko_kr.euc': 'ko_KR.eucKR',
1309 'ko_kr.euckr': 'ko_KR.eucKR',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001310 'korean': 'ko_KR.eucKR',
1311 'korean.euc': 'ko_KR.eucKR',
Antoine Pitroufc531532010-04-11 22:32:39 +00001312 'ks': 'ks_IN.UTF-8',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +02001313 'ks_in': 'ks_IN.UTF-8',
Serhiy Storchakad551b282013-12-26 21:20:46 +02001314 'ks_in@devanagari': 'ks_IN.UTF-8@devanagari',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001315 'kw': 'kw_GB.ISO8859-1',
1316 'kw_gb': 'kw_GB.ISO8859-1',
1317 'kw_gb.iso88591': 'kw_GB.ISO8859-1',
1318 'kw_gb.iso885914': 'kw_GB.ISO8859-14',
1319 'kw_gb.iso885915': 'kw_GB.ISO8859-15',
1320 'kw_gb@euro': 'kw_GB.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001321 'ky': 'ky_KG.UTF-8',
1322 'ky_kg': 'ky_KG.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001323 'lithuanian': 'lt_LT.ISO8859-13',
1324 'lo': 'lo_LA.MULELAO-1',
1325 'lo_la': 'lo_LA.MULELAO-1',
1326 'lo_la.cp1133': 'lo_LA.IBM-CP1133',
1327 'lo_la.ibmcp1133': 'lo_LA.IBM-CP1133',
1328 'lo_la.mulelao1': 'lo_LA.MULELAO-1',
1329 'lt': 'lt_LT.ISO8859-13',
1330 'lt_lt': 'lt_LT.ISO8859-13',
1331 'lt_lt.iso885913': 'lt_LT.ISO8859-13',
1332 'lt_lt.iso88594': 'lt_LT.ISO8859-4',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001333 'lv': 'lv_LV.ISO8859-13',
1334 'lv_lv': 'lv_LV.ISO8859-13',
1335 'lv_lv.iso885913': 'lv_LV.ISO8859-13',
1336 'lv_lv.iso88594': 'lv_LV.ISO8859-4',
Antoine Pitroufc531532010-04-11 22:32:39 +00001337 'mai': 'mai_IN.UTF-8',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +02001338 'mai_in': 'mai_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001339 'mi': 'mi_NZ.ISO8859-1',
1340 'mi_nz': 'mi_NZ.ISO8859-1',
1341 'mi_nz.iso88591': 'mi_NZ.ISO8859-1',
1342 'mk': 'mk_MK.ISO8859-5',
1343 'mk_mk': 'mk_MK.ISO8859-5',
1344 'mk_mk.cp1251': 'mk_MK.CP1251',
1345 'mk_mk.iso88595': 'mk_MK.ISO8859-5',
1346 'mk_mk.microsoftcp1251': 'mk_MK.CP1251',
Antoine Pitroufc531532010-04-11 22:32:39 +00001347 'ml': 'ml_IN.UTF-8',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +02001348 'ml_in': 'ml_IN.UTF-8',
Antoine Pitroufc531532010-04-11 22:32:39 +00001349 'mr': 'mr_IN.UTF-8',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001350 'mr_in': 'mr_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001351 'ms': 'ms_MY.ISO8859-1',
1352 'ms_my': 'ms_MY.ISO8859-1',
1353 'ms_my.iso88591': 'ms_MY.ISO8859-1',
1354 'mt': 'mt_MT.ISO8859-3',
1355 'mt_mt': 'mt_MT.ISO8859-3',
1356 'mt_mt.iso88593': 'mt_MT.ISO8859-3',
1357 'nb': 'nb_NO.ISO8859-1',
1358 'nb_no': 'nb_NO.ISO8859-1',
1359 'nb_no.88591': 'nb_NO.ISO8859-1',
1360 'nb_no.iso88591': 'nb_NO.ISO8859-1',
1361 'nb_no.iso885915': 'nb_NO.ISO8859-15',
1362 'nb_no@euro': 'nb_NO.ISO8859-15',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +02001363 'ne_np': 'ne_NP.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001364 'nl': 'nl_NL.ISO8859-1',
Antoine Pitroufc531532010-04-11 22:32:39 +00001365 'nl.iso885915': 'nl_NL.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001366 'nl_be': 'nl_BE.ISO8859-1',
1367 'nl_be.88591': 'nl_BE.ISO8859-1',
1368 'nl_be.iso88591': 'nl_BE.ISO8859-1',
1369 'nl_be.iso885915': 'nl_BE.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001370 'nl_be.iso885915@euro': 'nl_BE.ISO8859-15',
1371 'nl_be.utf8@euro': 'nl_BE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001372 'nl_be@euro': 'nl_BE.ISO8859-15',
1373 'nl_nl': 'nl_NL.ISO8859-1',
1374 'nl_nl.88591': 'nl_NL.ISO8859-1',
1375 'nl_nl.iso88591': 'nl_NL.ISO8859-1',
1376 'nl_nl.iso885915': 'nl_NL.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001377 'nl_nl.iso885915@euro': 'nl_NL.ISO8859-15',
1378 'nl_nl.utf8@euro': 'nl_NL.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001379 'nl_nl@euro': 'nl_NL.ISO8859-15',
1380 'nn': 'nn_NO.ISO8859-1',
1381 'nn_no': 'nn_NO.ISO8859-1',
1382 'nn_no.88591': 'nn_NO.ISO8859-1',
1383 'nn_no.iso88591': 'nn_NO.ISO8859-1',
1384 'nn_no.iso885915': 'nn_NO.ISO8859-15',
1385 'nn_no@euro': 'nn_NO.ISO8859-15',
1386 'no': 'no_NO.ISO8859-1',
1387 'no@nynorsk': 'ny_NO.ISO8859-1',
1388 'no_no': 'no_NO.ISO8859-1',
1389 'no_no.88591': 'no_NO.ISO8859-1',
1390 'no_no.iso88591': 'no_NO.ISO8859-1',
1391 'no_no.iso885915': 'no_NO.ISO8859-15',
Antoine Pitroufc531532010-04-11 22:32:39 +00001392 'no_no.iso88591@bokmal': 'no_NO.ISO8859-1',
1393 'no_no.iso88591@nynorsk': 'no_NO.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001394 'no_no@euro': 'no_NO.ISO8859-15',
1395 'norwegian': 'no_NO.ISO8859-1',
1396 'norwegian.iso88591': 'no_NO.ISO8859-1',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001397 'nr': 'nr_ZA.ISO8859-1',
1398 'nr_za': 'nr_ZA.ISO8859-1',
1399 'nr_za.iso88591': 'nr_ZA.ISO8859-1',
1400 'nso': 'nso_ZA.ISO8859-15',
1401 'nso_za': 'nso_ZA.ISO8859-15',
1402 'nso_za.iso885915': 'nso_ZA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001403 'ny': 'ny_NO.ISO8859-1',
1404 'ny_no': 'ny_NO.ISO8859-1',
1405 'ny_no.88591': 'ny_NO.ISO8859-1',
1406 'ny_no.iso88591': 'ny_NO.ISO8859-1',
1407 'ny_no.iso885915': 'ny_NO.ISO8859-15',
1408 'ny_no@euro': 'ny_NO.ISO8859-15',
1409 'nynorsk': 'nn_NO.ISO8859-1',
1410 'oc': 'oc_FR.ISO8859-1',
1411 'oc_fr': 'oc_FR.ISO8859-1',
1412 'oc_fr.iso88591': 'oc_FR.ISO8859-1',
1413 'oc_fr.iso885915': 'oc_FR.ISO8859-15',
1414 'oc_fr@euro': 'oc_FR.ISO8859-15',
Antoine Pitroufc531532010-04-11 22:32:39 +00001415 'or': 'or_IN.UTF-8',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +02001416 'or_in': 'or_IN.UTF-8',
Antoine Pitroufc531532010-04-11 22:32:39 +00001417 'pa': 'pa_IN.UTF-8',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001418 'pa_in': 'pa_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001419 'pd': 'pd_US.ISO8859-1',
1420 'pd_de': 'pd_DE.ISO8859-1',
1421 'pd_de.iso88591': 'pd_DE.ISO8859-1',
1422 'pd_de.iso885915': 'pd_DE.ISO8859-15',
1423 'pd_de@euro': 'pd_DE.ISO8859-15',
1424 'pd_us': 'pd_US.ISO8859-1',
1425 'pd_us.iso88591': 'pd_US.ISO8859-1',
1426 'pd_us.iso885915': 'pd_US.ISO8859-15',
1427 'pd_us@euro': 'pd_US.ISO8859-15',
1428 'ph': 'ph_PH.ISO8859-1',
1429 'ph_ph': 'ph_PH.ISO8859-1',
1430 'ph_ph.iso88591': 'ph_PH.ISO8859-1',
1431 'pl': 'pl_PL.ISO8859-2',
1432 'pl_pl': 'pl_PL.ISO8859-2',
1433 'pl_pl.iso88592': 'pl_PL.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001434 'polish': 'pl_PL.ISO8859-2',
1435 'portuguese': 'pt_PT.ISO8859-1',
1436 'portuguese.iso88591': 'pt_PT.ISO8859-1',
1437 'portuguese_brazil': 'pt_BR.ISO8859-1',
1438 'portuguese_brazil.8859': 'pt_BR.ISO8859-1',
1439 'posix': 'C',
1440 'posix-utf2': 'C',
1441 'pp': 'pp_AN.ISO8859-1',
1442 'pp_an': 'pp_AN.ISO8859-1',
1443 'pp_an.iso88591': 'pp_AN.ISO8859-1',
1444 'pt': 'pt_PT.ISO8859-1',
Antoine Pitroufc531532010-04-11 22:32:39 +00001445 'pt.iso885915': 'pt_PT.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001446 'pt_br': 'pt_BR.ISO8859-1',
1447 'pt_br.88591': 'pt_BR.ISO8859-1',
1448 'pt_br.iso88591': 'pt_BR.ISO8859-1',
1449 'pt_br.iso885915': 'pt_BR.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001450 'pt_br@euro': 'pt_BR.ISO8859-15',
1451 'pt_pt': 'pt_PT.ISO8859-1',
1452 'pt_pt.88591': 'pt_PT.ISO8859-1',
1453 'pt_pt.iso88591': 'pt_PT.ISO8859-1',
1454 'pt_pt.iso885915': 'pt_PT.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001455 'pt_pt.iso885915@euro': 'pt_PT.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001456 'pt_pt.utf8@euro': 'pt_PT.UTF-8',
1457 'pt_pt@euro': 'pt_PT.ISO8859-15',
1458 'ro': 'ro_RO.ISO8859-2',
1459 'ro_ro': 'ro_RO.ISO8859-2',
1460 'ro_ro.iso88592': 'ro_RO.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001461 'romanian': 'ro_RO.ISO8859-2',
Antoine Pitroufc531532010-04-11 22:32:39 +00001462 'ru': 'ru_RU.UTF-8',
1463 'ru.koi8r': 'ru_RU.KOI8-R',
1464 'ru_ru': 'ru_RU.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001465 'ru_ru.cp1251': 'ru_RU.CP1251',
1466 'ru_ru.iso88595': 'ru_RU.ISO8859-5',
1467 'ru_ru.koi8r': 'ru_RU.KOI8-R',
1468 'ru_ru.microsoftcp1251': 'ru_RU.CP1251',
1469 'ru_ua': 'ru_UA.KOI8-U',
1470 'ru_ua.cp1251': 'ru_UA.CP1251',
1471 'ru_ua.koi8u': 'ru_UA.KOI8-U',
1472 'ru_ua.microsoftcp1251': 'ru_UA.CP1251',
1473 'rumanian': 'ro_RO.ISO8859-2',
1474 'russian': 'ru_RU.ISO8859-5',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001475 'rw': 'rw_RW.ISO8859-1',
1476 'rw_rw': 'rw_RW.ISO8859-1',
1477 'rw_rw.iso88591': 'rw_RW.ISO8859-1',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +02001478 'sd': 'sd_IN.UTF-8',
Serhiy Storchakad551b282013-12-26 21:20:46 +02001479 'sd@devanagari': 'sd_IN.UTF-8@devanagari',
1480 'sd_in': 'sd_IN.UTF-8',
1481 'sd_in@devanagari': 'sd_IN.UTF-8@devanagari',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001482 'se_no': 'se_NO.UTF-8',
Antoine Pitroufc531532010-04-11 22:32:39 +00001483 'serbocroatian': 'sr_RS.UTF-8@latin',
1484 'sh': 'sr_RS.UTF-8@latin',
1485 'sh_ba.iso88592@bosnia': 'sr_CS.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001486 'sh_hr': 'sh_HR.ISO8859-2',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001487 'sh_hr.iso88592': 'hr_HR.ISO8859-2',
1488 'sh_sp': 'sr_CS.ISO8859-2',
Antoine Pitroufc531532010-04-11 22:32:39 +00001489 'sh_yu': 'sr_RS.UTF-8@latin',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001490 'si': 'si_LK.UTF-8',
1491 'si_lk': 'si_LK.UTF-8',
1492 'sinhala': 'si_LK.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001493 'sk': 'sk_SK.ISO8859-2',
1494 'sk_sk': 'sk_SK.ISO8859-2',
1495 'sk_sk.iso88592': 'sk_SK.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001496 'sl': 'sl_SI.ISO8859-2',
1497 'sl_cs': 'sl_CS.ISO8859-2',
1498 'sl_si': 'sl_SI.ISO8859-2',
1499 'sl_si.iso88592': 'sl_SI.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001500 'slovak': 'sk_SK.ISO8859-2',
1501 'slovene': 'sl_SI.ISO8859-2',
1502 'slovenian': 'sl_SI.ISO8859-2',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001503 'sp': 'sr_CS.ISO8859-5',
1504 'sp_yu': 'sr_CS.ISO8859-5',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001505 'spanish': 'es_ES.ISO8859-1',
1506 'spanish.iso88591': 'es_ES.ISO8859-1',
1507 'spanish_spain': 'es_ES.ISO8859-1',
1508 'spanish_spain.8859': 'es_ES.ISO8859-1',
1509 'sq': 'sq_AL.ISO8859-2',
1510 'sq_al': 'sq_AL.ISO8859-2',
1511 'sq_al.iso88592': 'sq_AL.ISO8859-2',
Antoine Pitroufc531532010-04-11 22:32:39 +00001512 'sr': 'sr_RS.UTF-8',
1513 'sr@cyrillic': 'sr_RS.UTF-8',
1514 'sr@latin': 'sr_RS.UTF-8@latin',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +02001515 'sr@latn': 'sr_CS.UTF-8@latin',
1516 'sr_cs': 'sr_CS.UTF-8',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001517 'sr_cs.iso88592': 'sr_CS.ISO8859-2',
1518 'sr_cs.iso88592@latn': 'sr_CS.ISO8859-2',
1519 'sr_cs.iso88595': 'sr_CS.ISO8859-5',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +02001520 'sr_cs.utf8@latn': 'sr_CS.UTF-8@latin',
1521 'sr_cs@latn': 'sr_CS.UTF-8@latin',
Antoine Pitroufc531532010-04-11 22:32:39 +00001522 'sr_me': 'sr_ME.UTF-8',
1523 'sr_rs': 'sr_RS.UTF-8',
1524 'sr_rs.utf8@latn': 'sr_RS.UTF-8@latin',
1525 'sr_rs@latin': 'sr_RS.UTF-8@latin',
1526 'sr_rs@latn': 'sr_RS.UTF-8@latin',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001527 'sr_sp': 'sr_CS.ISO8859-2',
Antoine Pitroufc531532010-04-11 22:32:39 +00001528 'sr_yu': 'sr_RS.UTF-8@latin',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001529 'sr_yu.cp1251@cyrillic': 'sr_CS.CP1251',
1530 'sr_yu.iso88592': 'sr_CS.ISO8859-2',
1531 'sr_yu.iso88595': 'sr_CS.ISO8859-5',
1532 'sr_yu.iso88595@cyrillic': 'sr_CS.ISO8859-5',
1533 'sr_yu.microsoftcp1251@cyrillic': 'sr_CS.CP1251',
Antoine Pitroufc531532010-04-11 22:32:39 +00001534 'sr_yu.utf8@cyrillic': 'sr_RS.UTF-8',
1535 'sr_yu@cyrillic': 'sr_RS.UTF-8',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001536 'ss': 'ss_ZA.ISO8859-1',
1537 'ss_za': 'ss_ZA.ISO8859-1',
1538 'ss_za.iso88591': 'ss_ZA.ISO8859-1',
1539 'st': 'st_ZA.ISO8859-1',
1540 'st_za': 'st_ZA.ISO8859-1',
1541 'st_za.iso88591': 'st_ZA.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001542 'sv': 'sv_SE.ISO8859-1',
Antoine Pitroufc531532010-04-11 22:32:39 +00001543 'sv.iso885915': 'sv_SE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001544 'sv_fi': 'sv_FI.ISO8859-1',
1545 'sv_fi.iso88591': 'sv_FI.ISO8859-1',
1546 'sv_fi.iso885915': 'sv_FI.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001547 'sv_fi.iso885915@euro': 'sv_FI.ISO8859-15',
1548 'sv_fi.utf8@euro': 'sv_FI.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001549 'sv_fi@euro': 'sv_FI.ISO8859-15',
1550 'sv_se': 'sv_SE.ISO8859-1',
1551 'sv_se.88591': 'sv_SE.ISO8859-1',
1552 'sv_se.iso88591': 'sv_SE.ISO8859-1',
1553 'sv_se.iso885915': 'sv_SE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001554 'sv_se@euro': 'sv_SE.ISO8859-15',
1555 'swedish': 'sv_SE.ISO8859-1',
1556 'swedish.iso88591': 'sv_SE.ISO8859-1',
1557 'ta': 'ta_IN.TSCII-0',
1558 'ta_in': 'ta_IN.TSCII-0',
1559 'ta_in.tscii': 'ta_IN.TSCII-0',
1560 'ta_in.tscii0': 'ta_IN.TSCII-0',
Antoine Pitroufc531532010-04-11 22:32:39 +00001561 'te': 'te_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001562 'tg': 'tg_TJ.KOI8-C',
1563 'tg_tj': 'tg_TJ.KOI8-C',
1564 'tg_tj.koi8c': 'tg_TJ.KOI8-C',
1565 'th': 'th_TH.ISO8859-11',
1566 'th_th': 'th_TH.ISO8859-11',
1567 'th_th.iso885911': 'th_TH.ISO8859-11',
1568 'th_th.tactis': 'th_TH.TIS620',
1569 'th_th.tis620': 'th_TH.TIS620',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001570 'thai': 'th_TH.ISO8859-11',
1571 'tl': 'tl_PH.ISO8859-1',
1572 'tl_ph': 'tl_PH.ISO8859-1',
1573 'tl_ph.iso88591': 'tl_PH.ISO8859-1',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001574 'tn': 'tn_ZA.ISO8859-15',
1575 'tn_za': 'tn_ZA.ISO8859-15',
1576 'tn_za.iso885915': 'tn_ZA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001577 'tr': 'tr_TR.ISO8859-9',
1578 'tr_tr': 'tr_TR.ISO8859-9',
1579 'tr_tr.iso88599': 'tr_TR.ISO8859-9',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001580 'ts': 'ts_ZA.ISO8859-1',
1581 'ts_za': 'ts_ZA.ISO8859-1',
1582 'ts_za.iso88591': 'ts_ZA.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001583 'tt': 'tt_RU.TATAR-CYR',
1584 'tt_ru': 'tt_RU.TATAR-CYR',
1585 'tt_ru.koi8c': 'tt_RU.KOI8-C',
1586 'tt_ru.tatarcyr': 'tt_RU.TATAR-CYR',
1587 'turkish': 'tr_TR.ISO8859-9',
1588 'turkish.iso88599': 'tr_TR.ISO8859-9',
1589 'uk': 'uk_UA.KOI8-U',
1590 'uk_ua': 'uk_UA.KOI8-U',
1591 'uk_ua.cp1251': 'uk_UA.CP1251',
1592 'uk_ua.iso88595': 'uk_UA.ISO8859-5',
1593 'uk_ua.koi8u': 'uk_UA.KOI8-U',
1594 'uk_ua.microsoftcp1251': 'uk_UA.CP1251',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001595 'univ': 'en_US.utf',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001596 'universal': 'en_US.utf',
1597 'universal.utf8@ucs4': 'en_US.UTF-8',
1598 'ur': 'ur_PK.CP1256',
Serhiy Storchaka0e4d8522013-12-20 18:22:38 +02001599 'ur_in': 'ur_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001600 'ur_pk': 'ur_PK.CP1256',
1601 'ur_pk.cp1256': 'ur_PK.CP1256',
1602 'ur_pk.microsoftcp1256': 'ur_PK.CP1256',
1603 'uz': 'uz_UZ.UTF-8',
1604 'uz_uz': 'uz_UZ.UTF-8',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001605 'uz_uz.iso88591': 'uz_UZ.ISO8859-1',
1606 'uz_uz.utf8@cyrillic': 'uz_UZ.UTF-8',
1607 'uz_uz@cyrillic': 'uz_UZ.UTF-8',
1608 've': 've_ZA.UTF-8',
1609 've_za': 've_ZA.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001610 'vi': 'vi_VN.TCVN',
1611 'vi_vn': 'vi_VN.TCVN',
1612 'vi_vn.tcvn': 'vi_VN.TCVN',
1613 'vi_vn.tcvn5712': 'vi_VN.TCVN',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001614 'vi_vn.viscii': 'vi_VN.VISCII',
1615 'vi_vn.viscii111': 'vi_VN.VISCII',
1616 'wa': 'wa_BE.ISO8859-1',
1617 'wa_be': 'wa_BE.ISO8859-1',
1618 'wa_be.iso88591': 'wa_BE.ISO8859-1',
1619 'wa_be.iso885915': 'wa_BE.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001620 'wa_be.iso885915@euro': 'wa_BE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001621 'wa_be@euro': 'wa_BE.ISO8859-15',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001622 'xh': 'xh_ZA.ISO8859-1',
1623 'xh_za': 'xh_ZA.ISO8859-1',
1624 'xh_za.iso88591': 'xh_ZA.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001625 'yi': 'yi_US.CP1255',
1626 'yi_us': 'yi_US.CP1255',
1627 'yi_us.cp1255': 'yi_US.CP1255',
1628 'yi_us.microsoftcp1255': 'yi_US.CP1255',
1629 'zh': 'zh_CN.eucCN',
1630 'zh_cn': 'zh_CN.gb2312',
1631 'zh_cn.big5': 'zh_TW.big5',
1632 'zh_cn.euc': 'zh_CN.eucCN',
1633 'zh_cn.gb18030': 'zh_CN.gb18030',
1634 'zh_cn.gb2312': 'zh_CN.gb2312',
1635 'zh_cn.gbk': 'zh_CN.gbk',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001636 'zh_hk': 'zh_HK.big5hkscs',
1637 'zh_hk.big5': 'zh_HK.big5',
Antoine Pitroufc531532010-04-11 22:32:39 +00001638 'zh_hk.big5hk': 'zh_HK.big5hkscs',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001639 'zh_hk.big5hkscs': 'zh_HK.big5hkscs',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001640 'zh_tw': 'zh_TW.big5',
1641 'zh_tw.big5': 'zh_TW.big5',
1642 'zh_tw.euc': 'zh_TW.eucTW',
Marc-André Lemburgadff65b2008-05-30 20:52:18 +00001643 'zh_tw.euctw': 'zh_TW.eucTW',
1644 'zu': 'zu_ZA.ISO8859-1',
1645 'zu_za': 'zu_ZA.ISO8859-1',
1646 'zu_za.iso88591': 'zu_ZA.ISO8859-1',
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001647}
1648
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001649#
Georg Brandlb709c2c2006-01-20 09:07:35 +00001650# This maps Windows language identifiers to locale strings.
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001651#
Tim Peters777f1082006-01-20 20:03:24 +00001652# This list has been updated from
Georg Brandlb709c2c2006-01-20 09:07:35 +00001653# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001654# to include every locale up to Windows Vista.
Fredrik Lundh37a09822002-10-19 20:19:10 +00001655#
Georg Brandl5035c1c2006-01-20 13:38:26 +00001656# NOTE: this mapping is incomplete. If your language is missing, please
Éric Araujo8d4d74e2012-02-26 01:28:34 +01001657# submit a bug report to the Python bug tracker at http://bugs.python.org/
Georg Brandl5035c1c2006-01-20 13:38:26 +00001658# Make sure you include the missing language identifier and the suggested
1659# locale code.
1660#
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001661
1662windows_locale = {
Georg Brandlb709c2c2006-01-20 09:07:35 +00001663 0x0436: "af_ZA", # Afrikaans
1664 0x041c: "sq_AL", # Albanian
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001665 0x0484: "gsw_FR",# Alsatian - France
1666 0x045e: "am_ET", # Amharic - Ethiopia
Georg Brandlb709c2c2006-01-20 09:07:35 +00001667 0x0401: "ar_SA", # Arabic - Saudi Arabia
1668 0x0801: "ar_IQ", # Arabic - Iraq
1669 0x0c01: "ar_EG", # Arabic - Egypt
1670 0x1001: "ar_LY", # Arabic - Libya
1671 0x1401: "ar_DZ", # Arabic - Algeria
1672 0x1801: "ar_MA", # Arabic - Morocco
1673 0x1c01: "ar_TN", # Arabic - Tunisia
1674 0x2001: "ar_OM", # Arabic - Oman
1675 0x2401: "ar_YE", # Arabic - Yemen
1676 0x2801: "ar_SY", # Arabic - Syria
1677 0x2c01: "ar_JO", # Arabic - Jordan
1678 0x3001: "ar_LB", # Arabic - Lebanon
1679 0x3401: "ar_KW", # Arabic - Kuwait
1680 0x3801: "ar_AE", # Arabic - United Arab Emirates
1681 0x3c01: "ar_BH", # Arabic - Bahrain
1682 0x4001: "ar_QA", # Arabic - Qatar
1683 0x042b: "hy_AM", # Armenian
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001684 0x044d: "as_IN", # Assamese - India
1685 0x042c: "az_AZ", # Azeri - Latin
Georg Brandlb709c2c2006-01-20 09:07:35 +00001686 0x082c: "az_AZ", # Azeri - Cyrillic
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001687 0x046d: "ba_RU", # Bashkir
1688 0x042d: "eu_ES", # Basque - Russia
Georg Brandlb709c2c2006-01-20 09:07:35 +00001689 0x0423: "be_BY", # Belarusian
1690 0x0445: "bn_IN", # Begali
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001691 0x201a: "bs_BA", # Bosnian - Cyrillic
1692 0x141a: "bs_BA", # Bosnian - Latin
Georg Brandlb709c2c2006-01-20 09:07:35 +00001693 0x047e: "br_FR", # Breton - France
1694 0x0402: "bg_BG", # Bulgarian
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001695# 0x0455: "my_MM", # Burmese - Not supported
Georg Brandlb709c2c2006-01-20 09:07:35 +00001696 0x0403: "ca_ES", # Catalan
1697 0x0004: "zh_CHS",# Chinese - Simplified
1698 0x0404: "zh_TW", # Chinese - Taiwan
1699 0x0804: "zh_CN", # Chinese - PRC
1700 0x0c04: "zh_HK", # Chinese - Hong Kong S.A.R.
1701 0x1004: "zh_SG", # Chinese - Singapore
1702 0x1404: "zh_MO", # Chinese - Macao S.A.R.
1703 0x7c04: "zh_CHT",# Chinese - Traditional
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001704 0x0483: "co_FR", # Corsican - France
Georg Brandlb709c2c2006-01-20 09:07:35 +00001705 0x041a: "hr_HR", # Croatian
1706 0x101a: "hr_BA", # Croatian - Bosnia
1707 0x0405: "cs_CZ", # Czech
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001708 0x0406: "da_DK", # Danish
Georg Brandlb709c2c2006-01-20 09:07:35 +00001709 0x048c: "gbz_AF",# Dari - Afghanistan
1710 0x0465: "div_MV",# Divehi - Maldives
1711 0x0413: "nl_NL", # Dutch - The Netherlands
1712 0x0813: "nl_BE", # Dutch - Belgium
1713 0x0409: "en_US", # English - United States
1714 0x0809: "en_GB", # English - United Kingdom
1715 0x0c09: "en_AU", # English - Australia
1716 0x1009: "en_CA", # English - Canada
1717 0x1409: "en_NZ", # English - New Zealand
1718 0x1809: "en_IE", # English - Ireland
1719 0x1c09: "en_ZA", # English - South Africa
1720 0x2009: "en_JA", # English - Jamaica
1721 0x2409: "en_CB", # English - Carribbean
1722 0x2809: "en_BZ", # English - Belize
1723 0x2c09: "en_TT", # English - Trinidad
1724 0x3009: "en_ZW", # English - Zimbabwe
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001725 0x3409: "en_PH", # English - Philippines
1726 0x4009: "en_IN", # English - India
1727 0x4409: "en_MY", # English - Malaysia
1728 0x4809: "en_IN", # English - Singapore
Georg Brandlb709c2c2006-01-20 09:07:35 +00001729 0x0425: "et_EE", # Estonian
1730 0x0438: "fo_FO", # Faroese
1731 0x0464: "fil_PH",# Filipino
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001732 0x040b: "fi_FI", # Finnish
Georg Brandlb709c2c2006-01-20 09:07:35 +00001733 0x040c: "fr_FR", # French - France
1734 0x080c: "fr_BE", # French - Belgium
1735 0x0c0c: "fr_CA", # French - Canada
1736 0x100c: "fr_CH", # French - Switzerland
1737 0x140c: "fr_LU", # French - Luxembourg
1738 0x180c: "fr_MC", # French - Monaco
1739 0x0462: "fy_NL", # Frisian - Netherlands
1740 0x0456: "gl_ES", # Galician
1741 0x0437: "ka_GE", # Georgian
1742 0x0407: "de_DE", # German - Germany
1743 0x0807: "de_CH", # German - Switzerland
1744 0x0c07: "de_AT", # German - Austria
1745 0x1007: "de_LU", # German - Luxembourg
1746 0x1407: "de_LI", # German - Liechtenstein
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001747 0x0408: "el_GR", # Greek
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001748 0x046f: "kl_GL", # Greenlandic - Greenland
Georg Brandlb709c2c2006-01-20 09:07:35 +00001749 0x0447: "gu_IN", # Gujarati
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001750 0x0468: "ha_NG", # Hausa - Latin
Georg Brandlb709c2c2006-01-20 09:07:35 +00001751 0x040d: "he_IL", # Hebrew
1752 0x0439: "hi_IN", # Hindi
1753 0x040e: "hu_HU", # Hungarian
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001754 0x040f: "is_IS", # Icelandic
Georg Brandlb709c2c2006-01-20 09:07:35 +00001755 0x0421: "id_ID", # Indonesian
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001756 0x045d: "iu_CA", # Inuktitut - Syllabics
Georg Brandlb709c2c2006-01-20 09:07:35 +00001757 0x085d: "iu_CA", # Inuktitut - Latin
1758 0x083c: "ga_IE", # Irish - Ireland
Georg Brandlb709c2c2006-01-20 09:07:35 +00001759 0x0410: "it_IT", # Italian - Italy
1760 0x0810: "it_CH", # Italian - Switzerland
1761 0x0411: "ja_JP", # Japanese
1762 0x044b: "kn_IN", # Kannada - India
1763 0x043f: "kk_KZ", # Kazakh
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001764 0x0453: "kh_KH", # Khmer - Cambodia
1765 0x0486: "qut_GT",# K'iche - Guatemala
1766 0x0487: "rw_RW", # Kinyarwanda - Rwanda
Georg Brandlb709c2c2006-01-20 09:07:35 +00001767 0x0457: "kok_IN",# Konkani
1768 0x0412: "ko_KR", # Korean
1769 0x0440: "ky_KG", # Kyrgyz
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001770 0x0454: "lo_LA", # Lao - Lao PDR
Georg Brandlb709c2c2006-01-20 09:07:35 +00001771 0x0426: "lv_LV", # Latvian
1772 0x0427: "lt_LT", # Lithuanian
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001773 0x082e: "dsb_DE",# Lower Sorbian - Germany
Georg Brandlb709c2c2006-01-20 09:07:35 +00001774 0x046e: "lb_LU", # Luxembourgish
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001775 0x042f: "mk_MK", # FYROM Macedonian
Georg Brandlb709c2c2006-01-20 09:07:35 +00001776 0x043e: "ms_MY", # Malay - Malaysia
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001777 0x083e: "ms_BN", # Malay - Brunei Darussalam
Georg Brandlb709c2c2006-01-20 09:07:35 +00001778 0x044c: "ml_IN", # Malayalam - India
1779 0x043a: "mt_MT", # Maltese
1780 0x0481: "mi_NZ", # Maori
1781 0x047a: "arn_CL",# Mapudungun
1782 0x044e: "mr_IN", # Marathi
1783 0x047c: "moh_CA",# Mohawk - Canada
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001784 0x0450: "mn_MN", # Mongolian - Cyrillic
1785 0x0850: "mn_CN", # Mongolian - PRC
Georg Brandlb709c2c2006-01-20 09:07:35 +00001786 0x0461: "ne_NP", # Nepali
1787 0x0414: "nb_NO", # Norwegian - Bokmal
1788 0x0814: "nn_NO", # Norwegian - Nynorsk
1789 0x0482: "oc_FR", # Occitan - France
1790 0x0448: "or_IN", # Oriya - India
1791 0x0463: "ps_AF", # Pashto - Afghanistan
1792 0x0429: "fa_IR", # Persian
1793 0x0415: "pl_PL", # Polish
1794 0x0416: "pt_BR", # Portuguese - Brazil
1795 0x0816: "pt_PT", # Portuguese - Portugal
1796 0x0446: "pa_IN", # Punjabi
1797 0x046b: "quz_BO",# Quechua (Bolivia)
1798 0x086b: "quz_EC",# Quechua (Ecuador)
1799 0x0c6b: "quz_PE",# Quechua (Peru)
1800 0x0418: "ro_RO", # Romanian - Romania
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001801 0x0417: "rm_CH", # Romansh
Georg Brandlb709c2c2006-01-20 09:07:35 +00001802 0x0419: "ru_RU", # Russian
1803 0x243b: "smn_FI",# Sami Finland
1804 0x103b: "smj_NO",# Sami Norway
1805 0x143b: "smj_SE",# Sami Sweden
1806 0x043b: "se_NO", # Sami Northern Norway
1807 0x083b: "se_SE", # Sami Northern Sweden
1808 0x0c3b: "se_FI", # Sami Northern Finland
1809 0x203b: "sms_FI",# Sami Skolt
1810 0x183b: "sma_NO",# Sami Southern Norway
1811 0x1c3b: "sma_SE",# Sami Southern Sweden
1812 0x044f: "sa_IN", # Sanskrit
1813 0x0c1a: "sr_SP", # Serbian - Cyrillic
1814 0x1c1a: "sr_BA", # Serbian - Bosnia Cyrillic
1815 0x081a: "sr_SP", # Serbian - Latin
1816 0x181a: "sr_BA", # Serbian - Bosnia Latin
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001817 0x045b: "si_LK", # Sinhala - Sri Lanka
Georg Brandlb709c2c2006-01-20 09:07:35 +00001818 0x046c: "ns_ZA", # Northern Sotho
1819 0x0432: "tn_ZA", # Setswana - Southern Africa
1820 0x041b: "sk_SK", # Slovak
1821 0x0424: "sl_SI", # Slovenian
1822 0x040a: "es_ES", # Spanish - Spain
1823 0x080a: "es_MX", # Spanish - Mexico
1824 0x0c0a: "es_ES", # Spanish - Spain (Modern)
1825 0x100a: "es_GT", # Spanish - Guatemala
1826 0x140a: "es_CR", # Spanish - Costa Rica
1827 0x180a: "es_PA", # Spanish - Panama
1828 0x1c0a: "es_DO", # Spanish - Dominican Republic
1829 0x200a: "es_VE", # Spanish - Venezuela
1830 0x240a: "es_CO", # Spanish - Colombia
1831 0x280a: "es_PE", # Spanish - Peru
1832 0x2c0a: "es_AR", # Spanish - Argentina
1833 0x300a: "es_EC", # Spanish - Ecuador
1834 0x340a: "es_CL", # Spanish - Chile
1835 0x380a: "es_UR", # Spanish - Uruguay
1836 0x3c0a: "es_PY", # Spanish - Paraguay
1837 0x400a: "es_BO", # Spanish - Bolivia
1838 0x440a: "es_SV", # Spanish - El Salvador
1839 0x480a: "es_HN", # Spanish - Honduras
1840 0x4c0a: "es_NI", # Spanish - Nicaragua
1841 0x500a: "es_PR", # Spanish - Puerto Rico
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001842 0x540a: "es_US", # Spanish - United States
1843# 0x0430: "", # Sutu - Not supported
Georg Brandlb709c2c2006-01-20 09:07:35 +00001844 0x0441: "sw_KE", # Swahili
1845 0x041d: "sv_SE", # Swedish - Sweden
1846 0x081d: "sv_FI", # Swedish - Finland
1847 0x045a: "syr_SY",# Syriac
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001848 0x0428: "tg_TJ", # Tajik - Cyrillic
1849 0x085f: "tmz_DZ",# Tamazight - Latin
Georg Brandlb709c2c2006-01-20 09:07:35 +00001850 0x0449: "ta_IN", # Tamil
1851 0x0444: "tt_RU", # Tatar
1852 0x044a: "te_IN", # Telugu
1853 0x041e: "th_TH", # Thai
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001854 0x0851: "bo_BT", # Tibetan - Bhutan
1855 0x0451: "bo_CN", # Tibetan - PRC
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001856 0x041f: "tr_TR", # Turkish
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001857 0x0442: "tk_TM", # Turkmen - Cyrillic
1858 0x0480: "ug_CN", # Uighur - Arabic
Georg Brandlb709c2c2006-01-20 09:07:35 +00001859 0x0422: "uk_UA", # Ukrainian
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001860 0x042e: "wen_DE",# Upper Sorbian - Germany
Georg Brandlb709c2c2006-01-20 09:07:35 +00001861 0x0420: "ur_PK", # Urdu
1862 0x0820: "ur_IN", # Urdu - India
1863 0x0443: "uz_UZ", # Uzbek - Latin
1864 0x0843: "uz_UZ", # Uzbek - Cyrillic
1865 0x042a: "vi_VN", # Vietnamese
1866 0x0452: "cy_GB", # Welsh
Jeroen Ruigrok van der Wervenb87b3342009-05-08 14:11:23 +00001867 0x0488: "wo_SN", # Wolof - Senegal
1868 0x0434: "xh_ZA", # Xhosa - South Africa
1869 0x0485: "sah_RU",# Yakut - Cyrillic
1870 0x0478: "ii_CN", # Yi - PRC
1871 0x046a: "yo_NG", # Yoruba - Nigeria
1872 0x0435: "zu_ZA", # Zulu
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001873}
1874
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001875def _print_locale():
1876
1877 """ Test function.
1878 """
1879 categories = {}
1880 def _init_categories(categories=categories):
1881 for k,v in globals().items():
1882 if k[:3] == 'LC_':
1883 categories[k] = v
1884 _init_categories()
1885 del categories['LC_ALL']
1886
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001887 print 'Locale defaults as determined by getdefaultlocale():'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001888 print '-'*72
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001889 lang, enc = getdefaultlocale()
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001890 print 'Language: ', lang or '(undefined)'
1891 print 'Encoding: ', enc or '(undefined)'
1892 print
1893
1894 print 'Locale settings on startup:'
1895 print '-'*72
1896 for name,category in categories.items():
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001897 print name, '...'
1898 lang, enc = getlocale(category)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001899 print ' Language: ', lang or '(undefined)'
1900 print ' Encoding: ', enc or '(undefined)'
1901 print
1902
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001903 print
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001904 print 'Locale settings after calling resetlocale():'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001905 print '-'*72
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001906 resetlocale()
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001907 for name,category in categories.items():
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001908 print name, '...'
1909 lang, enc = getlocale(category)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001910 print ' Language: ', lang or '(undefined)'
1911 print ' Encoding: ', enc or '(undefined)'
1912 print
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001913
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001914 try:
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001915 setlocale(LC_ALL, "")
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001916 except:
1917 print 'NOTE:'
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001918 print 'setlocale(LC_ALL, "") does not support the default locale'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001919 print 'given in the OS environment variables.'
1920 else:
1921 print
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001922 print 'Locale settings after calling setlocale(LC_ALL, ""):'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001923 print '-'*72
1924 for name,category in categories.items():
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001925 print name, '...'
1926 lang, enc = getlocale(category)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001927 print ' Language: ', lang or '(undefined)'
1928 print ' Encoding: ', enc or '(undefined)'
1929 print
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001930
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001931###
Guido van Rossumeef1d4e1997-11-19 19:01:43 +00001932
Tim Peters1baf8292001-01-24 10:13:46 +00001933try:
1934 LC_MESSAGES
Skip Montanaro0897f0c2002-03-25 21:40:36 +00001935except NameError:
Tim Peters1baf8292001-01-24 10:13:46 +00001936 pass
1937else:
1938 __all__.append("LC_MESSAGES")
1939
Guido van Rossumeef1d4e1997-11-19 19:01:43 +00001940if __name__=='__main__':
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001941 print 'Locale aliasing:'
1942 print
1943 _print_locale()
1944 print
1945 print 'Number formatting:'
1946 print
1947 _test()