blob: 7cfea618d77aa93193c0cae798e66a32cd481e33 [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 Murraye59482e2009-04-01 03:42:00 +000014import sys
15import encodings
16import encodings.aliases
17import re
18import collections
Georg Brandl1a3284e2007-12-02 09:40:06 +000019from builtins import str as _builtin_str
Antoine Pitrou83d6a872008-07-25 21:45:08 +000020import functools
Marc-André Lemburg5431bc32000-06-07 09:11:40 +000021
Fredrik Lundh6c86b992000-07-09 17:12:58 +000022# Try importing the _locale module.
23#
24# If this fails, fall back on a basic 'C' locale emulation.
Guido van Rossumeef1d4e1997-11-19 19:01:43 +000025
Tim Peters1baf8292001-01-24 10:13:46 +000026# Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before
27# trying the import. So __all__ is also fiddled at the end of the file.
Guido van Rossum360e4b82007-05-14 22:51:27 +000028__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
29 "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",
30 "str", "atof", "atoi", "format", "format_string", "currency",
31 "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
32 "LC_NUMERIC", "LC_ALL", "CHAR_MAX"]
Skip Montanaro17ab1232001-01-24 06:27:27 +000033
Neal Norwitz48b98de2008-03-10 04:49:25 +000034def _strcoll(a,b):
35 """ strcoll(string,string) -> int.
36 Compares two strings according to the locale.
37 """
Mark Dickinsona56c4672009-01-27 18:17:45 +000038 return (a > b) - (a < b)
Neal Norwitz48b98de2008-03-10 04:49:25 +000039
40def _strxfrm(s):
41 """ strxfrm(string) -> string.
42 Returns a string that behaves for cmp locale-aware.
43 """
44 return s
45
Marc-André Lemburg23481142000-06-08 17:49:41 +000046try:
Fredrik Lundh6c86b992000-07-09 17:12:58 +000047
Marc-André Lemburg23481142000-06-08 17:49:41 +000048 from _locale import *
49
50except ImportError:
51
Fredrik Lundh6c86b992000-07-09 17:12:58 +000052 # Locale emulation
53
Marc-André Lemburg23481142000-06-08 17:49:41 +000054 CHAR_MAX = 127
55 LC_ALL = 6
56 LC_COLLATE = 3
57 LC_CTYPE = 0
58 LC_MESSAGES = 5
59 LC_MONETARY = 4
60 LC_NUMERIC = 1
61 LC_TIME = 2
62 Error = ValueError
63
64 def localeconv():
Fredrik Lundh6c86b992000-07-09 17:12:58 +000065 """ localeconv() -> dict.
Marc-André Lemburg23481142000-06-08 17:49:41 +000066 Returns numeric and monetary locale-specific parameters.
67 """
68 # 'C' locale default values
69 return {'grouping': [127],
70 'currency_symbol': '',
71 'n_sign_posn': 127,
Fredrik Lundh6c86b992000-07-09 17:12:58 +000072 'p_cs_precedes': 127,
73 'n_cs_precedes': 127,
74 'mon_grouping': [],
Marc-André Lemburg23481142000-06-08 17:49:41 +000075 'n_sep_by_space': 127,
76 'decimal_point': '.',
77 'negative_sign': '',
78 'positive_sign': '',
Fredrik Lundh6c86b992000-07-09 17:12:58 +000079 'p_sep_by_space': 127,
Marc-André Lemburg23481142000-06-08 17:49:41 +000080 'int_curr_symbol': '',
Fredrik Lundh6c86b992000-07-09 17:12:58 +000081 'p_sign_posn': 127,
Marc-André Lemburg23481142000-06-08 17:49:41 +000082 'thousands_sep': '',
Fredrik Lundh6c86b992000-07-09 17:12:58 +000083 'mon_thousands_sep': '',
84 'frac_digits': 127,
Marc-André Lemburg23481142000-06-08 17:49:41 +000085 'mon_decimal_point': '',
86 'int_frac_digits': 127}
Fredrik Lundh6c86b992000-07-09 17:12:58 +000087
Marc-André Lemburg23481142000-06-08 17:49:41 +000088 def setlocale(category, value=None):
Fredrik Lundh6c86b992000-07-09 17:12:58 +000089 """ setlocale(integer,string=None) -> string.
Marc-André Lemburg23481142000-06-08 17:49:41 +000090 Activates/queries locale processing.
91 """
Martin v. Löwis103d6e72003-03-30 15:42:13 +000092 if value not in (None, '', 'C'):
Collin Winterce36ad82007-08-30 01:19:48 +000093 raise Error('_locale emulation only supports "C" locale')
Marc-André Lemburg23481142000-06-08 17:49:41 +000094 return 'C'
95
Neal Norwitz48b98de2008-03-10 04:49:25 +000096# These may or may not exist in _locale, so be sure to set them.
97if 'strxfrm' not in globals():
98 strxfrm = _strxfrm
99if 'strcoll' not in globals():
100 strcoll = _strcoll
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000101
Antoine Pitrou83d6a872008-07-25 21:45:08 +0000102
103_localeconv = localeconv
104
105# With this dict, you can override some items of localeconv's return value.
106# This is useful for testing purposes.
107_override_localeconv = {}
108
109@functools.wraps(_localeconv)
110def localeconv():
111 d = _localeconv()
112 if _override_localeconv:
113 d.update(_override_localeconv)
114 return d
115
116
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000117### Number formatting APIs
118
119# Author: Martin von Loewis
Thomas Wouters477c8d52006-05-27 19:21:47 +0000120# improved by Georg Brandl
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000121
Antoine Pitrou350370c2009-03-14 00:13:13 +0000122# Iterate over grouping intervals
123def _grouping_intervals(grouping):
Mark Dickinsonbbffb252009-08-04 21:57:18 +0000124 last_interval = None
Antoine Pitrou350370c2009-03-14 00:13:13 +0000125 for interval in grouping:
126 # if grouping is -1, we are done
127 if interval == CHAR_MAX:
128 return
129 # 0: re-use last group ad infinitum
130 if interval == 0:
Mark Dickinsonbbffb252009-08-04 21:57:18 +0000131 if last_interval is None:
132 raise ValueError("invalid grouping")
Antoine Pitrou350370c2009-03-14 00:13:13 +0000133 while True:
134 yield last_interval
135 yield interval
136 last_interval = interval
137
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000138#perform the grouping from right to left
Thomas Wouters477c8d52006-05-27 19:21:47 +0000139def _group(s, monetary=False):
140 conv = localeconv()
141 thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
142 grouping = conv[monetary and 'mon_grouping' or 'grouping']
143 if not grouping:
144 return (s, 0)
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000145 if s[-1] == ' ':
Antoine Pitrou350370c2009-03-14 00:13:13 +0000146 stripped = s.rstrip()
147 right_spaces = s[len(stripped):]
148 s = stripped
149 else:
150 right_spaces = ''
151 left_spaces = ''
152 groups = []
153 for interval in _grouping_intervals(grouping):
154 if not s or s[-1] not in "0123456789":
155 # only non-digit characters remain (sign, spaces)
156 left_spaces = s
157 s = ''
Guido van Rossum45e2fbc1998-03-26 21:13:24 +0000158 break
Antoine Pitrou350370c2009-03-14 00:13:13 +0000159 groups.append(s[-interval:])
160 s = s[:-interval]
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000161 if s:
Antoine Pitrou350370c2009-03-14 00:13:13 +0000162 groups.append(s)
163 groups.reverse()
164 return (
165 left_spaces + thousands_sep.join(groups) + right_spaces,
Antoine Pitrou6cf17aa2009-03-18 20:26:42 +0000166 len(thousands_sep) * (len(groups) - 1)
Antoine Pitrou350370c2009-03-14 00:13:13 +0000167 )
168
169# Strip a given amount of excess padding from the given string
170def _strip_padding(s, amount):
171 lpos = 0
172 while amount and s[lpos] == ' ':
173 lpos += 1
174 amount -= 1
175 rpos = len(s) - 1
176 while amount and s[rpos] == ' ':
177 rpos -= 1
178 amount -= 1
179 return s[lpos:rpos+1]
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000180
R. David Murraye59482e2009-04-01 03:42:00 +0000181_percent_re = re.compile(r'%(?:\((?P<key>.*?)\))?'
182 r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')
183
Thomas Wouters477c8d52006-05-27 19:21:47 +0000184def format(percent, value, grouping=False, monetary=False, *additional):
185 """Returns the locale-aware substitution of a %? specifier
186 (percent).
187
188 additional is for format strings which contain one or more
189 '*' modifiers."""
190 # this is only for one-percent-specifier strings and this should be checked
R. David Murraye59482e2009-04-01 03:42:00 +0000191 match = _percent_re.match(percent)
192 if not match or len(match.group())!= len(percent):
193 raise ValueError(("format() must be given exactly one %%char "
194 "format specifier, %s not valid") % repr(percent))
195 return _format(percent, value, grouping, monetary, *additional)
196
197def _format(percent, value, grouping=False, monetary=False, *additional):
Thomas Wouters477c8d52006-05-27 19:21:47 +0000198 if additional:
199 formatted = percent % ((value,) + additional)
200 else:
201 formatted = percent % value
202 # floats and decimal ints need special action!
203 if percent[-1] in 'eEfFgG':
204 seps = 0
205 parts = formatted.split('.')
206 if grouping:
207 parts[0], seps = _group(parts[0], monetary=monetary)
208 decimal_point = localeconv()[monetary and 'mon_decimal_point'
209 or 'decimal_point']
210 formatted = decimal_point.join(parts)
Antoine Pitrou350370c2009-03-14 00:13:13 +0000211 if seps:
212 formatted = _strip_padding(formatted, seps)
Thomas Wouters477c8d52006-05-27 19:21:47 +0000213 elif percent[-1] in 'diu':
Antoine Pitrou350370c2009-03-14 00:13:13 +0000214 seps = 0
Thomas Wouters477c8d52006-05-27 19:21:47 +0000215 if grouping:
Antoine Pitrou350370c2009-03-14 00:13:13 +0000216 formatted, seps = _group(formatted, monetary=monetary)
217 if seps:
218 formatted = _strip_padding(formatted, seps)
Thomas Wouters477c8d52006-05-27 19:21:47 +0000219 return formatted
220
Thomas Wouters477c8d52006-05-27 19:21:47 +0000221def format_string(f, val, grouping=False):
222 """Formats a string in the same way that the % formatting would use,
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000223 but takes the current locale into account.
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000224 Grouping is applied if the third parameter is true."""
Thomas Wouters477c8d52006-05-27 19:21:47 +0000225 percents = list(_percent_re.finditer(f))
226 new_f = _percent_re.sub('%s', f)
227
R. David Murrayad78d152010-04-27 02:45:53 +0000228 if isinstance(val, collections.Mapping):
229 new_val = []
230 for perc in percents:
231 if perc.group()[-1]=='%':
232 new_val.append('%')
233 else:
234 new_val.append(format(perc.group(), val, grouping))
235 else:
236 if not isinstance(val, tuple):
237 val = (val,)
238 new_val = []
Thomas Wouters477c8d52006-05-27 19:21:47 +0000239 i = 0
240 for perc in percents:
R. David Murrayad78d152010-04-27 02:45:53 +0000241 if perc.group()[-1]=='%':
242 new_val.append('%')
243 else:
244 starcount = perc.group('modifiers').count('*')
245 new_val.append(_format(perc.group(),
246 val[i],
247 grouping,
248 False,
249 *val[i+1:i+1+starcount]))
250 i += (1 + starcount)
251 val = tuple(new_val)
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000252
Thomas Wouters477c8d52006-05-27 19:21:47 +0000253 return new_f % val
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000254
Thomas Wouters477c8d52006-05-27 19:21:47 +0000255def currency(val, symbol=True, grouping=False, international=False):
256 """Formats val according to the currency settings
257 in the current locale."""
258 conv = localeconv()
259
260 # check for illegal values
261 digits = conv[international and 'int_frac_digits' or 'frac_digits']
262 if digits == 127:
263 raise ValueError("Currency formatting is not possible using "
264 "the 'C' locale.")
265
266 s = format('%%.%if' % digits, abs(val), grouping, monetary=True)
267 # '<' and '>' are markers if the sign must be inserted between symbol and value
268 s = '<' + s + '>'
269
270 if symbol:
271 smb = conv[international and 'int_curr_symbol' or 'currency_symbol']
272 precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']
273 separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']
274
275 if precedes:
276 s = smb + (separated and ' ' or '') + s
277 else:
278 s = s + (separated and ' ' or '') + smb
279
280 sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']
281 sign = conv[val<0 and 'negative_sign' or 'positive_sign']
282
283 if sign_pos == 0:
284 s = '(' + s + ')'
285 elif sign_pos == 1:
286 s = sign + s
287 elif sign_pos == 2:
288 s = s + sign
289 elif sign_pos == 3:
290 s = s.replace('<', sign)
291 elif sign_pos == 4:
292 s = s.replace('>', sign)
293 else:
294 # the default if nothing specified;
295 # this should be the most fitting sign position
296 s = sign + s
297
298 return s.replace('<', '').replace('>', '')
Martin v. Löwisdb786872001-01-21 18:52:33 +0000299
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000300def str(val):
301 """Convert float to integer, taking the locale into account."""
Thomas Wouters477c8d52006-05-27 19:21:47 +0000302 return format("%.12g", val)
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000303
Thomas Wouters477c8d52006-05-27 19:21:47 +0000304def atof(string, func=float):
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000305 "Parses a string as a float according to the locale settings."
306 #First, get rid of the grouping
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000307 ts = localeconv()['thousands_sep']
308 if ts:
Skip Montanaro249369c2004-04-10 16:39:32 +0000309 string = string.replace(ts, '')
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000310 #next, replace the decimal point with a dot
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000311 dd = localeconv()['decimal_point']
312 if dd:
Skip Montanaro249369c2004-04-10 16:39:32 +0000313 string = string.replace(dd, '.')
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000314 #finally, parse the string
Skip Montanaro249369c2004-04-10 16:39:32 +0000315 return func(string)
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000316
317def atoi(str):
318 "Converts a string to an integer according to the locale settings."
Eric S. Raymondbe9b5072001-02-09 10:48:30 +0000319 return atof(str, int)
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000320
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000321def _test():
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000322 setlocale(LC_ALL, "")
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000323 #do grouping
Thomas Wouters477c8d52006-05-27 19:21:47 +0000324 s1 = format("%d", 123456789,1)
Guido van Rossumbe19ed72007-02-09 05:37:30 +0000325 print(s1, "is", atoi(s1))
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000326 #standard formatting
Thomas Wouters477c8d52006-05-27 19:21:47 +0000327 s1 = str(3.14)
Guido van Rossumbe19ed72007-02-09 05:37:30 +0000328 print(s1, "is", atof(s1))
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000329
330### Locale name aliasing engine
331
332# Author: Marc-Andre Lemburg, mal@lemburg.com
Fredrik Lundh37a09822002-10-19 20:19:10 +0000333# Various tweaks by Fredrik Lundh <fredrik@pythonware.com>
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000334
335# store away the low-level version of setlocale (it's
336# overridden below)
337_setlocale = setlocale
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000338
Serhiy Storchakac8cc42e2013-12-19 21:21:25 +0200339def _replace_encoding(code, encoding):
340 if '.' in code:
341 langname = code[:code.index('.')]
342 else:
343 langname = code
344 # Convert the encoding to a C lib compatible encoding string
345 norm_encoding = encodings.normalize_encoding(encoding)
346 #print('norm encoding: %r' % norm_encoding)
347 norm_encoding = encodings.aliases.aliases.get(norm_encoding,
348 norm_encoding)
349 #print('aliased encoding: %r' % norm_encoding)
350 encoding = locale_encoding_alias.get(norm_encoding,
351 norm_encoding)
352 #print('found encoding %r' % encoding)
353 return langname + '.' + encoding
354
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000355def normalize(localename):
356
357 """ Returns a normalized locale code for the given locale
358 name.
359
360 The returned locale code is formatted for use with
361 setlocale().
362
363 If normalization fails, the original name is returned
364 unchanged.
365
366 If the given encoding is not known, the function defaults to
367 the default encoding for the locale code just like setlocale()
368 does.
369
370 """
Serhiy Storchakac8cc42e2013-12-19 21:21:25 +0200371 # Normalize the locale name and extract the encoding and modifier
372 code = localename.lower()
373 if ':' in code:
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000374 # ':' is sometimes used as encoding delimiter.
Serhiy Storchakac8cc42e2013-12-19 21:21:25 +0200375 code = code.replace(':', '.')
376 if '@' in code:
377 code, modifier = code.split('@', 1)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000378 else:
Serhiy Storchakac8cc42e2013-12-19 21:21:25 +0200379 modifier = ''
380 if '.' in code:
381 langname, encoding = code.split('.')[:2]
382 else:
383 langname = code
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000384 encoding = ''
385
Serhiy Storchakac8cc42e2013-12-19 21:21:25 +0200386 # First lookup: fullname (possibly with encoding and modifier)
387 lang_enc = langname
388 if encoding:
389 norm_encoding = encoding.replace('-', '')
390 norm_encoding = norm_encoding.replace('_', '')
391 lang_enc += '.' + norm_encoding
392 lookup_name = lang_enc
393 if modifier:
394 lookup_name += '@' + modifier
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000395 code = locale_alias.get(lookup_name, None)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000396 if code is not None:
397 return code
Serhiy Storchakac8cc42e2013-12-19 21:21:25 +0200398 #print('first lookup failed')
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000399
Serhiy Storchakac8cc42e2013-12-19 21:21:25 +0200400 if modifier:
401 # Second try: fullname without modifier (possibly with encoding)
402 code = locale_alias.get(lang_enc, None)
403 if code is not None:
404 #print('lookup without modifier succeeded')
405 if '@' not in code:
406 return code + '@' + modifier
407 if code.split('@', 1)[1].lower() == modifier:
408 return code
409 #print('second lookup failed')
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000410
Serhiy Storchakac8cc42e2013-12-19 21:21:25 +0200411 if encoding:
412 # Third try: langname (without encoding, possibly with modifier)
413 lookup_name = langname
414 if modifier:
415 lookup_name += '@' + modifier
416 code = locale_alias.get(lookup_name, None)
417 if code is not None:
418 #print('lookup without encoding succeeded')
419 if '@' not in code:
420 return _replace_encoding(code, encoding)
421 code, modifier = code.split('@', 1)
422 return _replace_encoding(code, encoding) + '@' + modifier
423
424 if modifier:
425 # Fourth try: langname (without encoding and modifier)
426 code = locale_alias.get(langname, None)
427 if code is not None:
428 #print('lookup without modifier and encoding succeeded')
429 if '@' not in code:
430 return _replace_encoding(code, encoding) + '@' + modifier
431 code, defmod = code.split('@', 1)
432 if defmod.lower() == modifier:
433 return _replace_encoding(code, encoding) + '@' + defmod
434
435 return localename
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000436
437def _parse_localename(localename):
438
439 """ Parses the locale code for localename and returns the
440 result as tuple (language code, encoding).
441
442 The localename is normalized and passed through the locale
443 alias engine. A ValueError is raised in case the locale name
444 cannot be parsed.
445
446 The language code corresponds to RFC 1766. code and encoding
447 can be None in case the values cannot be determined or are
Jeremy Hyltona05e2932000-06-28 14:48:01 +0000448 unknown to this implementation.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000449
450 """
451 code = normalize(localename)
Georg Brandlb709c2c2006-01-20 09:07:35 +0000452 if '@' in code:
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000453 # Deal with locale modifiers
Serhiy Storchakac8cc42e2013-12-19 21:21:25 +0200454 code, modifier = code.split('@', 1)
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000455 if modifier == 'euro' and '.' not in code:
456 # Assume Latin-9 for @euro locales. This is bogus,
457 # since some systems may use other encodings for these
458 # locales. Also, we ignore other modifiers.
459 return code, 'iso-8859-15'
Tim Peters230a60c2002-11-09 05:08:07 +0000460
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000461 if '.' in code:
Raymond Hettinger346e67f2005-01-01 06:10:26 +0000462 return tuple(code.split('.')[:2])
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000463 elif code == 'C':
464 return None, None
Collin Winterce36ad82007-08-30 01:19:48 +0000465 raise ValueError('unknown locale: %s' % localename)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000466
467def _build_localename(localetuple):
468
469 """ Builds a locale code from the given tuple (language code,
470 encoding).
471
472 No aliasing or normalizing takes place.
473
474 """
Petri Lehtinen3c85fe02011-11-04 21:35:07 +0200475 try:
476 language, encoding = localetuple
477
478 if language is None:
479 language = 'C'
480 if encoding is None:
481 return language
482 else:
483 return language + '.' + encoding
484 except (TypeError, ValueError):
485 raise TypeError('Locale must be None, a string, or an iterable of two strings -- language code, encoding.')
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000486
Matthias Klosef3f231f2005-09-20 07:02:49 +0000487def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000488
489 """ Tries to determine the default locale settings and returns
490 them as tuple (language code, encoding).
491
492 According to POSIX, a program which has not called
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000493 setlocale(LC_ALL, "") runs using the portable 'C' locale.
494 Calling setlocale(LC_ALL, "") lets it use the default locale as
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000495 defined by the LANG variable. Since we don't want to interfere
Thomas Wouters7e474022000-07-16 12:04:32 +0000496 with the current locale setting we thus emulate the behavior
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000497 in the way described above.
498
499 To maintain compatibility with other platforms, not only the
500 LANG variable is tested, but a list of variables given as
501 envvars parameter. The first found to be defined will be
502 used. envvars defaults to the search path used in GNU gettext;
503 it must always contain the variable name 'LANG'.
504
505 Except for the code 'C', the language code corresponds to RFC
506 1766. code and encoding can be None in case the values cannot
507 be determined.
508
509 """
Fredrik Lundh04661322000-07-09 23:16:10 +0000510
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000511 try:
512 # check if it's supported by the _locale module
513 import _locale
514 code, encoding = _locale._getdefaultlocale()
Fredrik Lundh04661322000-07-09 23:16:10 +0000515 except (ImportError, AttributeError):
516 pass
517 else:
Fredrik Lundh663809e2000-07-10 19:32:19 +0000518 # make sure the code/encoding values are valid
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000519 if sys.platform == "win32" and code and code[:2] == "0x":
520 # map windows language identifier to language name
521 code = windows_locale.get(int(code, 0))
Fredrik Lundh663809e2000-07-10 19:32:19 +0000522 # ...add other platform-specific processing here, if
523 # necessary...
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000524 return code, encoding
Fredrik Lundh04661322000-07-09 23:16:10 +0000525
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000526 # fall back on POSIX behaviour
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000527 import os
528 lookup = os.environ.get
529 for variable in envvars:
530 localename = lookup(variable,None)
Martin v. Löwisc8ae31d2004-07-26 12:45:18 +0000531 if localename:
Matthias Klosef3f231f2005-09-20 07:02:49 +0000532 if variable == 'LANGUAGE':
533 localename = localename.split(':')[0]
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000534 break
535 else:
536 localename = 'C'
537 return _parse_localename(localename)
538
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000539
540def getlocale(category=LC_CTYPE):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000541
542 """ Returns the current setting for the given locale category as
543 tuple (language code, encoding).
544
545 category may be one of the LC_* value except LC_ALL. It
546 defaults to LC_CTYPE.
547
548 Except for the code 'C', the language code corresponds to RFC
549 1766. code and encoding can be None in case the values cannot
550 be determined.
551
552 """
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000553 localename = _setlocale(category)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000554 if category == LC_ALL and ';' in localename:
Collin Winterce36ad82007-08-30 01:19:48 +0000555 raise TypeError('category LC_ALL is not supported')
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000556 return _parse_localename(localename)
557
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000558def setlocale(category, locale=None):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000559
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000560 """ Set the locale for the given category. The locale can be
Petri Lehtinen395ca722011-11-05 10:18:50 +0200561 a string, an iterable of two strings (language code and encoding),
562 or None.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000563
Petri Lehtinen395ca722011-11-05 10:18:50 +0200564 Iterables are converted to strings using the locale aliasing
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000565 engine. Locale strings are passed directly to the C lib.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000566
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000567 category may be given as one of the LC_* values.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000568
569 """
Guido van Rossum3172c5d2007-10-16 18:12:55 +0000570 if locale and not isinstance(locale, _builtin_str):
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000571 # convert to string
572 locale = normalize(_build_localename(locale))
573 return _setlocale(category, locale)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000574
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000575def resetlocale(category=LC_ALL):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000576
577 """ Sets the locale for category to the default setting.
578
579 The default setting is determined by calling
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000580 getdefaultlocale(). category defaults to LC_ALL.
581
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000582 """
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000583 _setlocale(category, _build_localename(getdefaultlocale()))
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000584
Ronald Oussorenfe8a3d62009-06-07 15:29:46 +0000585if sys.platform.startswith("win"):
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000586 # On Win32, this will return the ANSI code page
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000587 def getpreferredencoding(do_setlocale = True):
588 """Return the charset that the user is likely using."""
589 import _locale
Tim Petersa326f472002-11-05 03:49:09 +0000590 return _locale._getdefaultlocale()[1]
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000591else:
592 # On Unix, if CODESET is available, use that.
593 try:
594 CODESET
595 except NameError:
596 # Fall back to parsing environment variables :-(
597 def getpreferredencoding(do_setlocale = True):
598 """Return the charset that the user is likely using,
599 by looking at environment variables."""
Martin v. Löwis071ef772008-03-08 11:24:24 +0000600 res = getdefaultlocale()[1]
601 if res is None:
602 # LANG not set, default conservatively to ASCII
603 res = 'ascii'
604 return res
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000605 else:
606 def getpreferredencoding(do_setlocale = True):
607 """Return the charset that the user is likely using,
608 according to the system configuration."""
609 if do_setlocale:
610 oldloc = setlocale(LC_CTYPE)
Jeroen Ruigrok van der Wervenbcf85062009-05-06 05:33:24 +0000611 try:
612 setlocale(LC_CTYPE, "")
Jeroen Ruigrok van der Werven6ca2e0a2009-05-06 13:18:35 +0000613 except Error:
Jeroen Ruigrok van der Wervenbcf85062009-05-06 05:33:24 +0000614 pass
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000615 result = nl_langinfo(CODESET)
Ronald Oussoren6d77e072009-09-06 13:59:02 +0000616 if not result and sys.platform == 'darwin':
617 # nl_langinfo can return an empty string
618 # when the setting has an invalid value.
619 # Default to UTF-8 in that case because
620 # UTF-8 is the default charset on OSX and
621 # returning nothing will crash the
622 # interpreter.
623 result = 'UTF-8'
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000624 setlocale(LC_CTYPE, oldloc)
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000625 else:
Ronald Oussoren6d77e072009-09-06 13:59:02 +0000626 result = nl_langinfo(CODESET)
627 if not result and sys.platform == 'darwin':
628 # See above for explanation
629 result = 'UTF-8'
Antoine Pitrou6a448d42009-10-19 19:43:09 +0000630 return result
Tim Peters230a60c2002-11-09 05:08:07 +0000631
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000632
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000633### Database
634#
635# The following data was extracted from the locale.alias file which
636# comes with X11 and then hand edited removing the explicit encoding
637# definitions and adding some more aliases. The file is usually
638# available as /usr/lib/X11/locale/locale.alias.
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000639#
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000640
641#
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000642# The local_encoding_alias table maps lowercase encoding alias names
643# to C locale encoding names (case-sensitive). Note that normalize()
644# first looks up the encoding in the encodings.aliases dictionary and
645# then applies this mapping to find the correct C lib name for the
646# encoding.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000647#
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000648locale_encoding_alias = {
649
650 # Mappings for non-standard encoding names used in locale names
651 '437': 'C',
652 'c': 'C',
653 'en': 'ISO8859-1',
654 'jis': 'JIS7',
655 'jis7': 'JIS7',
656 'ajec': 'eucJP',
657
658 # Mappings from Python codec names to C lib encoding names
659 'ascii': 'ISO8859-1',
660 'latin_1': 'ISO8859-1',
661 'iso8859_1': 'ISO8859-1',
662 'iso8859_10': 'ISO8859-10',
663 'iso8859_11': 'ISO8859-11',
664 'iso8859_13': 'ISO8859-13',
665 'iso8859_14': 'ISO8859-14',
666 'iso8859_15': 'ISO8859-15',
Jeroen Ruigrok van der Werven4072ff32009-05-08 14:17:00 +0000667 'iso8859_16': 'ISO8859-16',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000668 'iso8859_2': 'ISO8859-2',
669 'iso8859_3': 'ISO8859-3',
670 'iso8859_4': 'ISO8859-4',
671 'iso8859_5': 'ISO8859-5',
672 'iso8859_6': 'ISO8859-6',
673 'iso8859_7': 'ISO8859-7',
674 'iso8859_8': 'ISO8859-8',
675 'iso8859_9': 'ISO8859-9',
676 'iso2022_jp': 'JIS7',
677 'shift_jis': 'SJIS',
678 'tactis': 'TACTIS',
679 'euc_jp': 'eucJP',
680 'euc_kr': 'eucKR',
Ronald Oussoren02a67ac2011-05-17 12:44:54 +0200681 'utf_8': 'UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000682 'koi8_r': 'KOI8-R',
683 'koi8_u': 'KOI8-U',
684 # XXX This list is still incomplete. If you know more
685 # mappings, please file a bug report. Thanks.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000686}
687
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000688#
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000689# The locale_alias table maps lowercase alias names to C locale names
690# (case-sensitive). Encodings are always separated from the locale
691# name using a dot ('.'); they should only be given in case the
692# language name is needed to interpret the given encoding alias
693# correctly (CJK codes often have this need).
694#
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000695# Note that the normalize() function which uses this tables
696# removes '_' and '-' characters from the encoding part of the
697# locale name before doing the lookup. This saves a lot of
698# space in the table.
699#
700# MAL 2004-12-10:
701# Updated alias mapping to most recent locale.alias file
702# from X.org distribution using makelocalealias.py.
703#
704# These are the differences compared to the old mapping (Python 2.4
705# and older):
706#
707# updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
708# updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
709# updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
710# updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
711# updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
712# updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
713# updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1'
714# updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
715# updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
716# updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
717# updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
718# updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
719# updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
720# updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP'
721# updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13'
722# updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13'
723# updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
724# updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
725# updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11'
726# updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312'
727# updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5'
728# updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5'
729#
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000730# MAL 2008-05-30:
731# Updated alias mapping to most recent locale.alias file
732# from X.org distribution using makelocalealias.py.
733#
734# These are the differences compared to the old mapping (Python 2.5
735# and older):
736#
737# updated 'cs_cs.iso88592' -> 'cs_CZ.ISO8859-2' to 'cs_CS.ISO8859-2'
738# updated 'serbocroatian' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
739# updated 'sh' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
740# updated 'sh_hr.iso88592' -> 'sh_HR.ISO8859-2' to 'hr_HR.ISO8859-2'
741# updated 'sh_sp' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
742# updated 'sh_yu' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
743# updated 'sp' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
744# updated 'sp_yu' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
745# updated 'sr' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
746# updated 'sr@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
747# updated 'sr_sp' -> 'sr_SP.ISO8859-2' to 'sr_CS.ISO8859-2'
748# updated 'sr_yu' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
749# updated 'sr_yu.cp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'
750# updated 'sr_yu.iso88592' -> 'sr_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
751# updated 'sr_yu.iso88595' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
752# updated 'sr_yu.iso88595@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
753# updated 'sr_yu.microsoftcp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'
754# updated 'sr_yu.utf8@cyrillic' -> 'sr_YU.UTF-8' to 'sr_CS.UTF-8'
755# updated 'sr_yu@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +0000756#
757# AP 2010-04-12:
758# Updated alias mapping to most recent locale.alias file
759# from X.org distribution using makelocalealias.py.
760#
761# These are the differences compared to the old mapping (Python 2.6.5
762# and older):
763#
764# updated 'ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
765# updated 'ru_ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
766# updated 'serbocroatian' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
767# updated 'sh' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
768# updated 'sh_yu' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
769# updated 'sr' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
770# updated 'sr@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
771# updated 'sr@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
772# updated 'sr_cs.utf8@latn' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8@latin'
773# updated 'sr_cs@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
774# updated 'sr_yu' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8@latin'
775# updated 'sr_yu.utf8@cyrillic' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8'
776# updated 'sr_yu@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
777#
Serhiy Storchaka715233c2013-12-20 18:23:26 +0200778# SS 2013-12-20:
779# Updated alias mapping to most recent locale.alias file
780# from X.org distribution using makelocalealias.py.
781#
782# These are the differences compared to the old mapping (Python 3.3.3
783# and older):
784#
785# updated 'a3' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
786# updated 'a3_az' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
787# updated 'a3_az.koi8c' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
788# updated 'cs_cs.iso88592' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
789# updated 'hebrew' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
790# updated 'hebrew.iso88598' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
791# updated 'sd' -> 'sd_IN@devanagari.UTF-8' to 'sd_IN.UTF-8'
792# updated 'sr@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
793# updated 'sr_cs' -> 'sr_RS.UTF-8' to 'sr_CS.UTF-8'
794# updated 'sr_cs.utf8@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
795# updated 'sr_cs@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000796
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000797locale_alias = {
Serhiy Storchaka715233c2013-12-20 18:23:26 +0200798 'a3': 'az_AZ.KOI8-C',
799 'a3_az': 'az_AZ.KOI8-C',
800 'a3_az.koi8c': 'az_AZ.KOI8-C',
801 'a3_az.koic': 'az_AZ.KOI8-C',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000802 'af': 'af_ZA.ISO8859-1',
803 'af_za': 'af_ZA.ISO8859-1',
804 'af_za.iso88591': 'af_ZA.ISO8859-1',
805 'am': 'am_ET.UTF-8',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000806 'am_et': 'am_ET.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000807 'american': 'en_US.ISO8859-1',
808 'american.iso88591': 'en_US.ISO8859-1',
809 'ar': 'ar_AA.ISO8859-6',
810 'ar_aa': 'ar_AA.ISO8859-6',
811 'ar_aa.iso88596': 'ar_AA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000812 'ar_ae': 'ar_AE.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000813 'ar_ae.iso88596': 'ar_AE.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000814 'ar_bh': 'ar_BH.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000815 'ar_bh.iso88596': 'ar_BH.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000816 'ar_dz': 'ar_DZ.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000817 'ar_dz.iso88596': 'ar_DZ.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000818 'ar_eg': 'ar_EG.ISO8859-6',
819 'ar_eg.iso88596': 'ar_EG.ISO8859-6',
Serhiy Storchaka715233c2013-12-20 18:23:26 +0200820 'ar_in': 'ar_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000821 'ar_iq': 'ar_IQ.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000822 'ar_iq.iso88596': 'ar_IQ.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000823 'ar_jo': 'ar_JO.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000824 'ar_jo.iso88596': 'ar_JO.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000825 'ar_kw': 'ar_KW.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000826 'ar_kw.iso88596': 'ar_KW.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000827 'ar_lb': 'ar_LB.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000828 'ar_lb.iso88596': 'ar_LB.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000829 'ar_ly': 'ar_LY.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000830 'ar_ly.iso88596': 'ar_LY.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000831 'ar_ma': 'ar_MA.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000832 'ar_ma.iso88596': 'ar_MA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000833 'ar_om': 'ar_OM.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000834 'ar_om.iso88596': 'ar_OM.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000835 'ar_qa': 'ar_QA.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000836 'ar_qa.iso88596': 'ar_QA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000837 'ar_sa': 'ar_SA.ISO8859-6',
838 'ar_sa.iso88596': 'ar_SA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000839 'ar_sd': 'ar_SD.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000840 'ar_sd.iso88596': 'ar_SD.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000841 'ar_sy': 'ar_SY.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000842 'ar_sy.iso88596': 'ar_SY.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000843 'ar_tn': 'ar_TN.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000844 'ar_tn.iso88596': 'ar_TN.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000845 'ar_ye': 'ar_YE.ISO8859-6',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000846 'ar_ye.iso88596': 'ar_YE.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000847 'arabic': 'ar_AA.ISO8859-6',
848 'arabic.iso88596': 'ar_AA.ISO8859-6',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +0000849 'as': 'as_IN.UTF-8',
Serhiy Storchaka715233c2013-12-20 18:23:26 +0200850 'as_in': 'as_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000851 'az': 'az_AZ.ISO8859-9E',
852 'az_az': 'az_AZ.ISO8859-9E',
853 'az_az.iso88599e': 'az_AZ.ISO8859-9E',
854 'be': 'be_BY.CP1251',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +0000855 'be@latin': 'be_BY.UTF-8@latin',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000856 'be_by': 'be_BY.CP1251',
857 'be_by.cp1251': 'be_BY.CP1251',
858 'be_by.microsoftcp1251': 'be_BY.CP1251',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +0000859 'be_by.utf8@latin': 'be_BY.UTF-8@latin',
860 'be_by@latin': 'be_BY.UTF-8@latin',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000861 'bg': 'bg_BG.CP1251',
862 'bg_bg': 'bg_BG.CP1251',
863 'bg_bg.cp1251': 'bg_BG.CP1251',
864 'bg_bg.iso88595': 'bg_BG.ISO8859-5',
865 'bg_bg.koi8r': 'bg_BG.KOI8-R',
866 'bg_bg.microsoftcp1251': 'bg_BG.CP1251',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000867 'bn_in': 'bn_IN.UTF-8',
Serhiy Storchaka715233c2013-12-20 18:23:26 +0200868 'bo_in': 'bo_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000869 'bokmal': 'nb_NO.ISO8859-1',
870 'bokm\xe5l': 'nb_NO.ISO8859-1',
871 'br': 'br_FR.ISO8859-1',
872 'br_fr': 'br_FR.ISO8859-1',
873 'br_fr.iso88591': 'br_FR.ISO8859-1',
874 'br_fr.iso885914': 'br_FR.ISO8859-14',
875 'br_fr.iso885915': 'br_FR.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000876 'br_fr.iso885915@euro': 'br_FR.ISO8859-15',
877 'br_fr.utf8@euro': 'br_FR.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000878 'br_fr@euro': 'br_FR.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000879 'bs': 'bs_BA.ISO8859-2',
880 'bs_ba': 'bs_BA.ISO8859-2',
881 'bs_ba.iso88592': 'bs_BA.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000882 'bulgarian': 'bg_BG.CP1251',
883 'c': 'C',
884 'c-french': 'fr_CA.ISO8859-1',
885 'c-french.iso88591': 'fr_CA.ISO8859-1',
Serhiy Storchaka715233c2013-12-20 18:23:26 +0200886 'c.ascii': 'C',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000887 'c.en': 'C',
888 'c.iso88591': 'en_US.ISO8859-1',
889 'c_c': 'C',
890 'c_c.c': 'C',
891 'ca': 'ca_ES.ISO8859-1',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +0000892 'ca_ad': 'ca_AD.ISO8859-1',
893 'ca_ad.iso88591': 'ca_AD.ISO8859-1',
894 'ca_ad.iso885915': 'ca_AD.ISO8859-15',
895 'ca_ad.iso885915@euro': 'ca_AD.ISO8859-15',
896 'ca_ad.utf8@euro': 'ca_AD.UTF-8',
897 'ca_ad@euro': 'ca_AD.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000898 'ca_es': 'ca_ES.ISO8859-1',
899 'ca_es.iso88591': 'ca_ES.ISO8859-1',
900 'ca_es.iso885915': 'ca_ES.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000901 'ca_es.iso885915@euro': 'ca_ES.ISO8859-15',
902 'ca_es.utf8@euro': 'ca_ES.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000903 'ca_es@euro': 'ca_ES.ISO8859-15',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +0000904 'ca_fr': 'ca_FR.ISO8859-1',
905 'ca_fr.iso88591': 'ca_FR.ISO8859-1',
906 'ca_fr.iso885915': 'ca_FR.ISO8859-15',
907 'ca_fr.iso885915@euro': 'ca_FR.ISO8859-15',
908 'ca_fr.utf8@euro': 'ca_FR.UTF-8',
909 'ca_fr@euro': 'ca_FR.ISO8859-15',
910 'ca_it': 'ca_IT.ISO8859-1',
911 'ca_it.iso88591': 'ca_IT.ISO8859-1',
912 'ca_it.iso885915': 'ca_IT.ISO8859-15',
913 'ca_it.iso885915@euro': 'ca_IT.ISO8859-15',
914 'ca_it.utf8@euro': 'ca_IT.UTF-8',
915 'ca_it@euro': 'ca_IT.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000916 'catalan': 'ca_ES.ISO8859-1',
917 'cextend': 'en_US.ISO8859-1',
918 'cextend.en': 'en_US.ISO8859-1',
919 'chinese-s': 'zh_CN.eucCN',
920 'chinese-t': 'zh_TW.eucTW',
921 'croatian': 'hr_HR.ISO8859-2',
922 'cs': 'cs_CZ.ISO8859-2',
923 'cs_cs': 'cs_CZ.ISO8859-2',
Serhiy Storchaka715233c2013-12-20 18:23:26 +0200924 'cs_cs.iso88592': 'cs_CZ.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000925 'cs_cz': 'cs_CZ.ISO8859-2',
926 'cs_cz.iso88592': 'cs_CZ.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000927 'cy': 'cy_GB.ISO8859-1',
928 'cy_gb': 'cy_GB.ISO8859-1',
929 'cy_gb.iso88591': 'cy_GB.ISO8859-1',
930 'cy_gb.iso885914': 'cy_GB.ISO8859-14',
931 'cy_gb.iso885915': 'cy_GB.ISO8859-15',
932 'cy_gb@euro': 'cy_GB.ISO8859-15',
933 'cz': 'cs_CZ.ISO8859-2',
934 'cz_cz': 'cs_CZ.ISO8859-2',
935 'czech': 'cs_CZ.ISO8859-2',
936 'da': 'da_DK.ISO8859-1',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +0000937 'da.iso885915': 'da_DK.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000938 'da_dk': 'da_DK.ISO8859-1',
939 'da_dk.88591': 'da_DK.ISO8859-1',
940 'da_dk.885915': 'da_DK.ISO8859-15',
941 'da_dk.iso88591': 'da_DK.ISO8859-1',
942 'da_dk.iso885915': 'da_DK.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000943 'da_dk@euro': 'da_DK.ISO8859-15',
944 'danish': 'da_DK.ISO8859-1',
945 'danish.iso88591': 'da_DK.ISO8859-1',
946 'dansk': 'da_DK.ISO8859-1',
947 'de': 'de_DE.ISO8859-1',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +0000948 'de.iso885915': 'de_DE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000949 'de_at': 'de_AT.ISO8859-1',
950 'de_at.iso88591': 'de_AT.ISO8859-1',
951 'de_at.iso885915': 'de_AT.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000952 'de_at.iso885915@euro': 'de_AT.ISO8859-15',
953 'de_at.utf8@euro': 'de_AT.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000954 'de_at@euro': 'de_AT.ISO8859-15',
955 'de_be': 'de_BE.ISO8859-1',
956 'de_be.iso88591': 'de_BE.ISO8859-1',
957 'de_be.iso885915': 'de_BE.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000958 'de_be.iso885915@euro': 'de_BE.ISO8859-15',
959 'de_be.utf8@euro': 'de_BE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000960 'de_be@euro': 'de_BE.ISO8859-15',
961 'de_ch': 'de_CH.ISO8859-1',
962 'de_ch.iso88591': 'de_CH.ISO8859-1',
963 'de_ch.iso885915': 'de_CH.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000964 'de_ch@euro': 'de_CH.ISO8859-15',
965 'de_de': 'de_DE.ISO8859-1',
966 'de_de.88591': 'de_DE.ISO8859-1',
967 'de_de.885915': 'de_DE.ISO8859-15',
968 'de_de.885915@euro': 'de_DE.ISO8859-15',
969 'de_de.iso88591': 'de_DE.ISO8859-1',
970 'de_de.iso885915': 'de_DE.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000971 'de_de.iso885915@euro': 'de_DE.ISO8859-15',
972 'de_de.utf8@euro': 'de_DE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000973 'de_de@euro': 'de_DE.ISO8859-15',
974 'de_lu': 'de_LU.ISO8859-1',
975 'de_lu.iso88591': 'de_LU.ISO8859-1',
976 'de_lu.iso885915': 'de_LU.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000977 'de_lu.iso885915@euro': 'de_LU.ISO8859-15',
978 'de_lu.utf8@euro': 'de_LU.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000979 'de_lu@euro': 'de_LU.ISO8859-15',
980 'deutsch': 'de_DE.ISO8859-1',
981 'dutch': 'nl_NL.ISO8859-1',
982 'dutch.iso88591': 'nl_BE.ISO8859-1',
983 'ee': 'ee_EE.ISO8859-4',
984 'ee_ee': 'ee_EE.ISO8859-4',
985 'ee_ee.iso88594': 'ee_EE.ISO8859-4',
986 'eesti': 'et_EE.ISO8859-1',
987 'el': 'el_GR.ISO8859-7',
988 'el_gr': 'el_GR.ISO8859-7',
989 'el_gr.iso88597': 'el_GR.ISO8859-7',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000990 'el_gr@euro': 'el_GR.ISO8859-15',
991 'en': 'en_US.ISO8859-1',
992 'en.iso88591': 'en_US.ISO8859-1',
993 'en_au': 'en_AU.ISO8859-1',
994 'en_au.iso88591': 'en_AU.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000995 'en_be': 'en_BE.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000996 'en_be@euro': 'en_BE.ISO8859-15',
997 'en_bw': 'en_BW.ISO8859-1',
Georg Brandlf08a9dd2008-06-10 16:57:31 +0000998 'en_bw.iso88591': 'en_BW.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000999 'en_ca': 'en_CA.ISO8859-1',
1000 'en_ca.iso88591': 'en_CA.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001001 'en_gb': 'en_GB.ISO8859-1',
1002 'en_gb.88591': 'en_GB.ISO8859-1',
1003 'en_gb.iso88591': 'en_GB.ISO8859-1',
1004 'en_gb.iso885915': 'en_GB.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001005 'en_gb@euro': 'en_GB.ISO8859-15',
1006 'en_hk': 'en_HK.ISO8859-1',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001007 'en_hk.iso88591': 'en_HK.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001008 'en_ie': 'en_IE.ISO8859-1',
1009 'en_ie.iso88591': 'en_IE.ISO8859-1',
1010 'en_ie.iso885915': 'en_IE.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001011 'en_ie.iso885915@euro': 'en_IE.ISO8859-15',
1012 'en_ie.utf8@euro': 'en_IE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001013 'en_ie@euro': 'en_IE.ISO8859-15',
1014 'en_in': 'en_IN.ISO8859-1',
1015 'en_nz': 'en_NZ.ISO8859-1',
1016 'en_nz.iso88591': 'en_NZ.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001017 'en_ph': 'en_PH.ISO8859-1',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001018 'en_ph.iso88591': 'en_PH.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001019 'en_sg': 'en_SG.ISO8859-1',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001020 'en_sg.iso88591': 'en_SG.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001021 'en_uk': 'en_GB.ISO8859-1',
1022 'en_us': 'en_US.ISO8859-1',
1023 'en_us.88591': 'en_US.ISO8859-1',
1024 'en_us.885915': 'en_US.ISO8859-15',
1025 'en_us.iso88591': 'en_US.ISO8859-1',
1026 'en_us.iso885915': 'en_US.ISO8859-15',
1027 'en_us.iso885915@euro': 'en_US.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001028 'en_us@euro': 'en_US.ISO8859-15',
1029 'en_us@euro@euro': 'en_US.ISO8859-15',
1030 'en_za': 'en_ZA.ISO8859-1',
1031 'en_za.88591': 'en_ZA.ISO8859-1',
1032 'en_za.iso88591': 'en_ZA.ISO8859-1',
1033 'en_za.iso885915': 'en_ZA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001034 'en_za@euro': 'en_ZA.ISO8859-15',
1035 'en_zw': 'en_ZW.ISO8859-1',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001036 'en_zw.iso88591': 'en_ZW.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001037 'eng_gb': 'en_GB.ISO8859-1',
1038 'eng_gb.8859': 'en_GB.ISO8859-1',
1039 'english': 'en_EN.ISO8859-1',
1040 'english.iso88591': 'en_EN.ISO8859-1',
1041 'english_uk': 'en_GB.ISO8859-1',
1042 'english_uk.8859': 'en_GB.ISO8859-1',
1043 'english_united-states': 'en_US.ISO8859-1',
1044 'english_united-states.437': 'C',
1045 'english_us': 'en_US.ISO8859-1',
1046 'english_us.8859': 'en_US.ISO8859-1',
1047 'english_us.ascii': 'en_US.ISO8859-1',
1048 'eo': 'eo_XX.ISO8859-3',
1049 'eo_eo': 'eo_EO.ISO8859-3',
1050 'eo_eo.iso88593': 'eo_EO.ISO8859-3',
1051 'eo_xx': 'eo_XX.ISO8859-3',
1052 'eo_xx.iso88593': 'eo_XX.ISO8859-3',
1053 'es': 'es_ES.ISO8859-1',
1054 'es_ar': 'es_AR.ISO8859-1',
1055 'es_ar.iso88591': 'es_AR.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001056 'es_bo': 'es_BO.ISO8859-1',
1057 'es_bo.iso88591': 'es_BO.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001058 'es_cl': 'es_CL.ISO8859-1',
1059 'es_cl.iso88591': 'es_CL.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001060 'es_co': 'es_CO.ISO8859-1',
1061 'es_co.iso88591': 'es_CO.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001062 'es_cr': 'es_CR.ISO8859-1',
1063 'es_cr.iso88591': 'es_CR.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001064 'es_do': 'es_DO.ISO8859-1',
1065 'es_do.iso88591': 'es_DO.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001066 'es_ec': 'es_EC.ISO8859-1',
1067 'es_ec.iso88591': 'es_EC.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001068 'es_es': 'es_ES.ISO8859-1',
1069 'es_es.88591': 'es_ES.ISO8859-1',
1070 'es_es.iso88591': 'es_ES.ISO8859-1',
1071 'es_es.iso885915': 'es_ES.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001072 'es_es.iso885915@euro': 'es_ES.ISO8859-15',
1073 'es_es.utf8@euro': 'es_ES.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001074 'es_es@euro': 'es_ES.ISO8859-15',
1075 'es_gt': 'es_GT.ISO8859-1',
1076 'es_gt.iso88591': 'es_GT.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001077 'es_hn': 'es_HN.ISO8859-1',
1078 'es_hn.iso88591': 'es_HN.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001079 'es_mx': 'es_MX.ISO8859-1',
1080 'es_mx.iso88591': 'es_MX.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001081 'es_ni': 'es_NI.ISO8859-1',
1082 'es_ni.iso88591': 'es_NI.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001083 'es_pa': 'es_PA.ISO8859-1',
1084 'es_pa.iso88591': 'es_PA.ISO8859-1',
1085 'es_pa.iso885915': 'es_PA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001086 'es_pa@euro': 'es_PA.ISO8859-15',
1087 'es_pe': 'es_PE.ISO8859-1',
1088 'es_pe.iso88591': 'es_PE.ISO8859-1',
1089 'es_pe.iso885915': 'es_PE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001090 'es_pe@euro': 'es_PE.ISO8859-15',
1091 'es_pr': 'es_PR.ISO8859-1',
1092 'es_pr.iso88591': 'es_PR.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001093 'es_py': 'es_PY.ISO8859-1',
1094 'es_py.iso88591': 'es_PY.ISO8859-1',
1095 'es_py.iso885915': 'es_PY.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001096 'es_py@euro': 'es_PY.ISO8859-15',
1097 'es_sv': 'es_SV.ISO8859-1',
1098 'es_sv.iso88591': 'es_SV.ISO8859-1',
1099 'es_sv.iso885915': 'es_SV.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001100 'es_sv@euro': 'es_SV.ISO8859-15',
1101 'es_us': 'es_US.ISO8859-1',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001102 'es_us.iso88591': 'es_US.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001103 'es_uy': 'es_UY.ISO8859-1',
1104 'es_uy.iso88591': 'es_UY.ISO8859-1',
1105 'es_uy.iso885915': 'es_UY.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001106 'es_uy@euro': 'es_UY.ISO8859-15',
1107 'es_ve': 'es_VE.ISO8859-1',
1108 'es_ve.iso88591': 'es_VE.ISO8859-1',
1109 'es_ve.iso885915': 'es_VE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001110 'es_ve@euro': 'es_VE.ISO8859-15',
1111 'estonian': 'et_EE.ISO8859-1',
1112 'et': 'et_EE.ISO8859-15',
1113 'et_ee': 'et_EE.ISO8859-15',
1114 'et_ee.iso88591': 'et_EE.ISO8859-1',
1115 'et_ee.iso885913': 'et_EE.ISO8859-13',
1116 'et_ee.iso885915': 'et_EE.ISO8859-15',
1117 'et_ee.iso88594': 'et_EE.ISO8859-4',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001118 'et_ee@euro': 'et_EE.ISO8859-15',
1119 'eu': 'eu_ES.ISO8859-1',
1120 'eu_es': 'eu_ES.ISO8859-1',
1121 'eu_es.iso88591': 'eu_ES.ISO8859-1',
1122 'eu_es.iso885915': 'eu_ES.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001123 'eu_es.iso885915@euro': 'eu_ES.ISO8859-15',
1124 'eu_es.utf8@euro': 'eu_ES.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001125 'eu_es@euro': 'eu_ES.ISO8859-15',
1126 'fa': 'fa_IR.UTF-8',
1127 'fa_ir': 'fa_IR.UTF-8',
1128 'fa_ir.isiri3342': 'fa_IR.ISIRI-3342',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001129 'fi': 'fi_FI.ISO8859-15',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001130 'fi.iso885915': 'fi_FI.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001131 'fi_fi': 'fi_FI.ISO8859-15',
1132 'fi_fi.88591': 'fi_FI.ISO8859-1',
1133 'fi_fi.iso88591': 'fi_FI.ISO8859-1',
1134 'fi_fi.iso885915': 'fi_FI.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001135 'fi_fi.iso885915@euro': 'fi_FI.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001136 'fi_fi.utf8@euro': 'fi_FI.UTF-8',
1137 'fi_fi@euro': 'fi_FI.ISO8859-15',
1138 'finnish': 'fi_FI.ISO8859-1',
1139 'finnish.iso88591': 'fi_FI.ISO8859-1',
1140 'fo': 'fo_FO.ISO8859-1',
1141 'fo_fo': 'fo_FO.ISO8859-1',
1142 'fo_fo.iso88591': 'fo_FO.ISO8859-1',
1143 'fo_fo.iso885915': 'fo_FO.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001144 'fo_fo@euro': 'fo_FO.ISO8859-15',
1145 'fr': 'fr_FR.ISO8859-1',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001146 'fr.iso885915': 'fr_FR.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001147 'fr_be': 'fr_BE.ISO8859-1',
1148 'fr_be.88591': 'fr_BE.ISO8859-1',
1149 'fr_be.iso88591': 'fr_BE.ISO8859-1',
1150 'fr_be.iso885915': 'fr_BE.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001151 'fr_be.iso885915@euro': 'fr_BE.ISO8859-15',
1152 'fr_be.utf8@euro': 'fr_BE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001153 'fr_be@euro': 'fr_BE.ISO8859-15',
1154 'fr_ca': 'fr_CA.ISO8859-1',
1155 'fr_ca.88591': 'fr_CA.ISO8859-1',
1156 'fr_ca.iso88591': 'fr_CA.ISO8859-1',
1157 'fr_ca.iso885915': 'fr_CA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001158 'fr_ca@euro': 'fr_CA.ISO8859-15',
1159 'fr_ch': 'fr_CH.ISO8859-1',
1160 'fr_ch.88591': 'fr_CH.ISO8859-1',
1161 'fr_ch.iso88591': 'fr_CH.ISO8859-1',
1162 'fr_ch.iso885915': 'fr_CH.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001163 'fr_ch@euro': 'fr_CH.ISO8859-15',
1164 'fr_fr': 'fr_FR.ISO8859-1',
1165 'fr_fr.88591': 'fr_FR.ISO8859-1',
1166 'fr_fr.iso88591': 'fr_FR.ISO8859-1',
1167 'fr_fr.iso885915': 'fr_FR.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001168 'fr_fr.iso885915@euro': 'fr_FR.ISO8859-15',
1169 'fr_fr.utf8@euro': 'fr_FR.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001170 'fr_fr@euro': 'fr_FR.ISO8859-15',
1171 'fr_lu': 'fr_LU.ISO8859-1',
1172 'fr_lu.88591': 'fr_LU.ISO8859-1',
1173 'fr_lu.iso88591': 'fr_LU.ISO8859-1',
1174 'fr_lu.iso885915': 'fr_LU.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001175 'fr_lu.iso885915@euro': 'fr_LU.ISO8859-15',
1176 'fr_lu.utf8@euro': 'fr_LU.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001177 'fr_lu@euro': 'fr_LU.ISO8859-15',
1178 'fran\xe7ais': 'fr_FR.ISO8859-1',
1179 'fre_fr': 'fr_FR.ISO8859-1',
1180 'fre_fr.8859': 'fr_FR.ISO8859-1',
1181 'french': 'fr_FR.ISO8859-1',
1182 'french.iso88591': 'fr_CH.ISO8859-1',
1183 'french_france': 'fr_FR.ISO8859-1',
1184 'french_france.8859': 'fr_FR.ISO8859-1',
1185 'ga': 'ga_IE.ISO8859-1',
1186 'ga_ie': 'ga_IE.ISO8859-1',
1187 'ga_ie.iso88591': 'ga_IE.ISO8859-1',
1188 'ga_ie.iso885914': 'ga_IE.ISO8859-14',
1189 'ga_ie.iso885915': 'ga_IE.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001190 'ga_ie.iso885915@euro': 'ga_IE.ISO8859-15',
1191 'ga_ie.utf8@euro': 'ga_IE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001192 'ga_ie@euro': 'ga_IE.ISO8859-15',
1193 'galego': 'gl_ES.ISO8859-1',
1194 'galician': 'gl_ES.ISO8859-1',
1195 'gd': 'gd_GB.ISO8859-1',
1196 'gd_gb': 'gd_GB.ISO8859-1',
1197 'gd_gb.iso88591': 'gd_GB.ISO8859-1',
1198 'gd_gb.iso885914': 'gd_GB.ISO8859-14',
1199 'gd_gb.iso885915': 'gd_GB.ISO8859-15',
1200 'gd_gb@euro': 'gd_GB.ISO8859-15',
1201 'ger_de': 'de_DE.ISO8859-1',
1202 'ger_de.8859': 'de_DE.ISO8859-1',
1203 'german': 'de_DE.ISO8859-1',
1204 'german.iso88591': 'de_CH.ISO8859-1',
1205 'german_germany': 'de_DE.ISO8859-1',
1206 'german_germany.8859': 'de_DE.ISO8859-1',
1207 'gl': 'gl_ES.ISO8859-1',
1208 'gl_es': 'gl_ES.ISO8859-1',
1209 'gl_es.iso88591': 'gl_ES.ISO8859-1',
1210 'gl_es.iso885915': 'gl_ES.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001211 'gl_es.iso885915@euro': 'gl_ES.ISO8859-15',
1212 'gl_es.utf8@euro': 'gl_ES.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001213 'gl_es@euro': 'gl_ES.ISO8859-15',
1214 'greek': 'el_GR.ISO8859-7',
1215 'greek.iso88597': 'el_GR.ISO8859-7',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001216 'gu_in': 'gu_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001217 'gv': 'gv_GB.ISO8859-1',
1218 'gv_gb': 'gv_GB.ISO8859-1',
1219 'gv_gb.iso88591': 'gv_GB.ISO8859-1',
1220 'gv_gb.iso885914': 'gv_GB.ISO8859-14',
1221 'gv_gb.iso885915': 'gv_GB.ISO8859-15',
1222 'gv_gb@euro': 'gv_GB.ISO8859-15',
1223 'he': 'he_IL.ISO8859-8',
1224 'he_il': 'he_IL.ISO8859-8',
1225 'he_il.cp1255': 'he_IL.CP1255',
1226 'he_il.iso88598': 'he_IL.ISO8859-8',
1227 'he_il.microsoftcp1255': 'he_IL.CP1255',
Serhiy Storchaka715233c2013-12-20 18:23:26 +02001228 'hebrew': 'he_IL.ISO8859-8',
1229 'hebrew.iso88598': 'he_IL.ISO8859-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001230 'hi': 'hi_IN.ISCII-DEV',
1231 'hi_in': 'hi_IN.ISCII-DEV',
1232 'hi_in.isciidev': 'hi_IN.ISCII-DEV',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001233 'hne': 'hne_IN.UTF-8',
Serhiy Storchaka715233c2013-12-20 18:23:26 +02001234 'hne_in': 'hne_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001235 'hr': 'hr_HR.ISO8859-2',
1236 'hr_hr': 'hr_HR.ISO8859-2',
1237 'hr_hr.iso88592': 'hr_HR.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001238 'hrvatski': 'hr_HR.ISO8859-2',
1239 'hu': 'hu_HU.ISO8859-2',
1240 'hu_hu': 'hu_HU.ISO8859-2',
1241 'hu_hu.iso88592': 'hu_HU.ISO8859-2',
1242 'hungarian': 'hu_HU.ISO8859-2',
1243 'icelandic': 'is_IS.ISO8859-1',
1244 'icelandic.iso88591': 'is_IS.ISO8859-1',
1245 'id': 'id_ID.ISO8859-1',
1246 'id_id': 'id_ID.ISO8859-1',
1247 'in': 'id_ID.ISO8859-1',
1248 'in_id': 'id_ID.ISO8859-1',
1249 'is': 'is_IS.ISO8859-1',
1250 'is_is': 'is_IS.ISO8859-1',
1251 'is_is.iso88591': 'is_IS.ISO8859-1',
1252 'is_is.iso885915': 'is_IS.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001253 'is_is@euro': 'is_IS.ISO8859-15',
1254 'iso-8859-1': 'en_US.ISO8859-1',
1255 'iso-8859-15': 'en_US.ISO8859-15',
1256 'iso8859-1': 'en_US.ISO8859-1',
1257 'iso8859-15': 'en_US.ISO8859-15',
1258 'iso_8859_1': 'en_US.ISO8859-1',
1259 'iso_8859_15': 'en_US.ISO8859-15',
1260 'it': 'it_IT.ISO8859-1',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001261 'it.iso885915': 'it_IT.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001262 'it_ch': 'it_CH.ISO8859-1',
1263 'it_ch.iso88591': 'it_CH.ISO8859-1',
1264 'it_ch.iso885915': 'it_CH.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001265 'it_ch@euro': 'it_CH.ISO8859-15',
1266 'it_it': 'it_IT.ISO8859-1',
1267 'it_it.88591': 'it_IT.ISO8859-1',
1268 'it_it.iso88591': 'it_IT.ISO8859-1',
1269 'it_it.iso885915': 'it_IT.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001270 'it_it.iso885915@euro': 'it_IT.ISO8859-15',
1271 'it_it.utf8@euro': 'it_IT.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001272 'it_it@euro': 'it_IT.ISO8859-15',
1273 'italian': 'it_IT.ISO8859-1',
1274 'italian.iso88591': 'it_IT.ISO8859-1',
1275 'iu': 'iu_CA.NUNACOM-8',
1276 'iu_ca': 'iu_CA.NUNACOM-8',
1277 'iu_ca.nunacom8': 'iu_CA.NUNACOM-8',
1278 'iw': 'he_IL.ISO8859-8',
1279 'iw_il': 'he_IL.ISO8859-8',
1280 'iw_il.iso88598': 'he_IL.ISO8859-8',
1281 'ja': 'ja_JP.eucJP',
1282 'ja.jis': 'ja_JP.JIS7',
1283 'ja.sjis': 'ja_JP.SJIS',
1284 'ja_jp': 'ja_JP.eucJP',
1285 'ja_jp.ajec': 'ja_JP.eucJP',
1286 'ja_jp.euc': 'ja_JP.eucJP',
1287 'ja_jp.eucjp': 'ja_JP.eucJP',
1288 'ja_jp.iso-2022-jp': 'ja_JP.JIS7',
1289 'ja_jp.iso2022jp': 'ja_JP.JIS7',
1290 'ja_jp.jis': 'ja_JP.JIS7',
1291 'ja_jp.jis7': 'ja_JP.JIS7',
1292 'ja_jp.mscode': 'ja_JP.SJIS',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001293 'ja_jp.pck': 'ja_JP.SJIS',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001294 'ja_jp.sjis': 'ja_JP.SJIS',
1295 'ja_jp.ujis': 'ja_JP.eucJP',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001296 'japan': 'ja_JP.eucJP',
1297 'japanese': 'ja_JP.eucJP',
1298 'japanese-euc': 'ja_JP.eucJP',
1299 'japanese.euc': 'ja_JP.eucJP',
1300 'japanese.sjis': 'ja_JP.SJIS',
1301 'jp_jp': 'ja_JP.eucJP',
1302 'ka': 'ka_GE.GEORGIAN-ACADEMY',
1303 'ka_ge': 'ka_GE.GEORGIAN-ACADEMY',
1304 'ka_ge.georgianacademy': 'ka_GE.GEORGIAN-ACADEMY',
1305 'ka_ge.georgianps': 'ka_GE.GEORGIAN-PS',
1306 'ka_ge.georgianrs': 'ka_GE.GEORGIAN-ACADEMY',
1307 'kl': 'kl_GL.ISO8859-1',
1308 'kl_gl': 'kl_GL.ISO8859-1',
1309 'kl_gl.iso88591': 'kl_GL.ISO8859-1',
1310 'kl_gl.iso885915': 'kl_GL.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001311 'kl_gl@euro': 'kl_GL.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001312 'km_kh': 'km_KH.UTF-8',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001313 'kn': 'kn_IN.UTF-8',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001314 'kn_in': 'kn_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001315 'ko': 'ko_KR.eucKR',
1316 'ko_kr': 'ko_KR.eucKR',
1317 'ko_kr.euc': 'ko_KR.eucKR',
1318 'ko_kr.euckr': 'ko_KR.eucKR',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001319 'korean': 'ko_KR.eucKR',
1320 'korean.euc': 'ko_KR.eucKR',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001321 'ks': 'ks_IN.UTF-8',
Serhiy Storchaka715233c2013-12-20 18:23:26 +02001322 'ks_in': 'ks_IN.UTF-8',
Serhiy Storchaka5eb01532013-12-26 21:20:59 +02001323 'ks_in@devanagari': 'ks_IN.UTF-8@devanagari',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001324 'kw': 'kw_GB.ISO8859-1',
1325 'kw_gb': 'kw_GB.ISO8859-1',
1326 'kw_gb.iso88591': 'kw_GB.ISO8859-1',
1327 'kw_gb.iso885914': 'kw_GB.ISO8859-14',
1328 'kw_gb.iso885915': 'kw_GB.ISO8859-15',
1329 'kw_gb@euro': 'kw_GB.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001330 'ky': 'ky_KG.UTF-8',
1331 'ky_kg': 'ky_KG.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001332 'lithuanian': 'lt_LT.ISO8859-13',
1333 'lo': 'lo_LA.MULELAO-1',
1334 'lo_la': 'lo_LA.MULELAO-1',
1335 'lo_la.cp1133': 'lo_LA.IBM-CP1133',
1336 'lo_la.ibmcp1133': 'lo_LA.IBM-CP1133',
1337 'lo_la.mulelao1': 'lo_LA.MULELAO-1',
1338 'lt': 'lt_LT.ISO8859-13',
1339 'lt_lt': 'lt_LT.ISO8859-13',
1340 'lt_lt.iso885913': 'lt_LT.ISO8859-13',
1341 'lt_lt.iso88594': 'lt_LT.ISO8859-4',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001342 'lv': 'lv_LV.ISO8859-13',
1343 'lv_lv': 'lv_LV.ISO8859-13',
1344 'lv_lv.iso885913': 'lv_LV.ISO8859-13',
1345 'lv_lv.iso88594': 'lv_LV.ISO8859-4',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001346 'mai': 'mai_IN.UTF-8',
Serhiy Storchaka715233c2013-12-20 18:23:26 +02001347 'mai_in': 'mai_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001348 'mi': 'mi_NZ.ISO8859-1',
1349 'mi_nz': 'mi_NZ.ISO8859-1',
1350 'mi_nz.iso88591': 'mi_NZ.ISO8859-1',
1351 'mk': 'mk_MK.ISO8859-5',
1352 'mk_mk': 'mk_MK.ISO8859-5',
1353 'mk_mk.cp1251': 'mk_MK.CP1251',
1354 'mk_mk.iso88595': 'mk_MK.ISO8859-5',
1355 'mk_mk.microsoftcp1251': 'mk_MK.CP1251',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001356 'ml': 'ml_IN.UTF-8',
Serhiy Storchaka715233c2013-12-20 18:23:26 +02001357 'ml_in': 'ml_IN.UTF-8',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001358 'mr': 'mr_IN.UTF-8',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001359 'mr_in': 'mr_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001360 'ms': 'ms_MY.ISO8859-1',
1361 'ms_my': 'ms_MY.ISO8859-1',
1362 'ms_my.iso88591': 'ms_MY.ISO8859-1',
1363 'mt': 'mt_MT.ISO8859-3',
1364 'mt_mt': 'mt_MT.ISO8859-3',
1365 'mt_mt.iso88593': 'mt_MT.ISO8859-3',
1366 'nb': 'nb_NO.ISO8859-1',
1367 'nb_no': 'nb_NO.ISO8859-1',
1368 'nb_no.88591': 'nb_NO.ISO8859-1',
1369 'nb_no.iso88591': 'nb_NO.ISO8859-1',
1370 'nb_no.iso885915': 'nb_NO.ISO8859-15',
1371 'nb_no@euro': 'nb_NO.ISO8859-15',
Serhiy Storchaka715233c2013-12-20 18:23:26 +02001372 'ne_np': 'ne_NP.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001373 'nl': 'nl_NL.ISO8859-1',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001374 'nl.iso885915': 'nl_NL.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001375 'nl_be': 'nl_BE.ISO8859-1',
1376 'nl_be.88591': 'nl_BE.ISO8859-1',
1377 'nl_be.iso88591': 'nl_BE.ISO8859-1',
1378 'nl_be.iso885915': 'nl_BE.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001379 'nl_be.iso885915@euro': 'nl_BE.ISO8859-15',
1380 'nl_be.utf8@euro': 'nl_BE.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001381 'nl_be@euro': 'nl_BE.ISO8859-15',
1382 'nl_nl': 'nl_NL.ISO8859-1',
1383 'nl_nl.88591': 'nl_NL.ISO8859-1',
1384 'nl_nl.iso88591': 'nl_NL.ISO8859-1',
1385 'nl_nl.iso885915': 'nl_NL.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001386 'nl_nl.iso885915@euro': 'nl_NL.ISO8859-15',
1387 'nl_nl.utf8@euro': 'nl_NL.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001388 'nl_nl@euro': 'nl_NL.ISO8859-15',
1389 'nn': 'nn_NO.ISO8859-1',
1390 'nn_no': 'nn_NO.ISO8859-1',
1391 'nn_no.88591': 'nn_NO.ISO8859-1',
1392 'nn_no.iso88591': 'nn_NO.ISO8859-1',
1393 'nn_no.iso885915': 'nn_NO.ISO8859-15',
1394 'nn_no@euro': 'nn_NO.ISO8859-15',
1395 'no': 'no_NO.ISO8859-1',
1396 'no@nynorsk': 'ny_NO.ISO8859-1',
1397 'no_no': 'no_NO.ISO8859-1',
1398 'no_no.88591': 'no_NO.ISO8859-1',
1399 'no_no.iso88591': 'no_NO.ISO8859-1',
1400 'no_no.iso885915': 'no_NO.ISO8859-15',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001401 'no_no.iso88591@bokmal': 'no_NO.ISO8859-1',
1402 'no_no.iso88591@nynorsk': 'no_NO.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001403 'no_no@euro': 'no_NO.ISO8859-15',
1404 'norwegian': 'no_NO.ISO8859-1',
1405 'norwegian.iso88591': 'no_NO.ISO8859-1',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001406 'nr': 'nr_ZA.ISO8859-1',
1407 'nr_za': 'nr_ZA.ISO8859-1',
1408 'nr_za.iso88591': 'nr_ZA.ISO8859-1',
1409 'nso': 'nso_ZA.ISO8859-15',
1410 'nso_za': 'nso_ZA.ISO8859-15',
1411 'nso_za.iso885915': 'nso_ZA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001412 'ny': 'ny_NO.ISO8859-1',
1413 'ny_no': 'ny_NO.ISO8859-1',
1414 'ny_no.88591': 'ny_NO.ISO8859-1',
1415 'ny_no.iso88591': 'ny_NO.ISO8859-1',
1416 'ny_no.iso885915': 'ny_NO.ISO8859-15',
1417 'ny_no@euro': 'ny_NO.ISO8859-15',
1418 'nynorsk': 'nn_NO.ISO8859-1',
1419 'oc': 'oc_FR.ISO8859-1',
1420 'oc_fr': 'oc_FR.ISO8859-1',
1421 'oc_fr.iso88591': 'oc_FR.ISO8859-1',
1422 'oc_fr.iso885915': 'oc_FR.ISO8859-15',
1423 'oc_fr@euro': 'oc_FR.ISO8859-15',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001424 'or': 'or_IN.UTF-8',
Serhiy Storchaka715233c2013-12-20 18:23:26 +02001425 'or_in': 'or_IN.UTF-8',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001426 'pa': 'pa_IN.UTF-8',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001427 'pa_in': 'pa_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001428 'pd': 'pd_US.ISO8859-1',
1429 'pd_de': 'pd_DE.ISO8859-1',
1430 'pd_de.iso88591': 'pd_DE.ISO8859-1',
1431 'pd_de.iso885915': 'pd_DE.ISO8859-15',
1432 'pd_de@euro': 'pd_DE.ISO8859-15',
1433 'pd_us': 'pd_US.ISO8859-1',
1434 'pd_us.iso88591': 'pd_US.ISO8859-1',
1435 'pd_us.iso885915': 'pd_US.ISO8859-15',
1436 'pd_us@euro': 'pd_US.ISO8859-15',
1437 'ph': 'ph_PH.ISO8859-1',
1438 'ph_ph': 'ph_PH.ISO8859-1',
1439 'ph_ph.iso88591': 'ph_PH.ISO8859-1',
1440 'pl': 'pl_PL.ISO8859-2',
1441 'pl_pl': 'pl_PL.ISO8859-2',
1442 'pl_pl.iso88592': 'pl_PL.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001443 'polish': 'pl_PL.ISO8859-2',
1444 'portuguese': 'pt_PT.ISO8859-1',
1445 'portuguese.iso88591': 'pt_PT.ISO8859-1',
1446 'portuguese_brazil': 'pt_BR.ISO8859-1',
1447 'portuguese_brazil.8859': 'pt_BR.ISO8859-1',
1448 'posix': 'C',
1449 'posix-utf2': 'C',
1450 'pp': 'pp_AN.ISO8859-1',
1451 'pp_an': 'pp_AN.ISO8859-1',
1452 'pp_an.iso88591': 'pp_AN.ISO8859-1',
1453 'pt': 'pt_PT.ISO8859-1',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001454 'pt.iso885915': 'pt_PT.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001455 'pt_br': 'pt_BR.ISO8859-1',
1456 'pt_br.88591': 'pt_BR.ISO8859-1',
1457 'pt_br.iso88591': 'pt_BR.ISO8859-1',
1458 'pt_br.iso885915': 'pt_BR.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001459 'pt_br@euro': 'pt_BR.ISO8859-15',
1460 'pt_pt': 'pt_PT.ISO8859-1',
1461 'pt_pt.88591': 'pt_PT.ISO8859-1',
1462 'pt_pt.iso88591': 'pt_PT.ISO8859-1',
1463 'pt_pt.iso885915': 'pt_PT.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001464 'pt_pt.iso885915@euro': 'pt_PT.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001465 'pt_pt.utf8@euro': 'pt_PT.UTF-8',
1466 'pt_pt@euro': 'pt_PT.ISO8859-15',
1467 'ro': 'ro_RO.ISO8859-2',
1468 'ro_ro': 'ro_RO.ISO8859-2',
1469 'ro_ro.iso88592': 'ro_RO.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001470 'romanian': 'ro_RO.ISO8859-2',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001471 'ru': 'ru_RU.UTF-8',
1472 'ru.koi8r': 'ru_RU.KOI8-R',
1473 'ru_ru': 'ru_RU.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001474 'ru_ru.cp1251': 'ru_RU.CP1251',
1475 'ru_ru.iso88595': 'ru_RU.ISO8859-5',
1476 'ru_ru.koi8r': 'ru_RU.KOI8-R',
1477 'ru_ru.microsoftcp1251': 'ru_RU.CP1251',
1478 'ru_ua': 'ru_UA.KOI8-U',
1479 'ru_ua.cp1251': 'ru_UA.CP1251',
1480 'ru_ua.koi8u': 'ru_UA.KOI8-U',
1481 'ru_ua.microsoftcp1251': 'ru_UA.CP1251',
1482 'rumanian': 'ro_RO.ISO8859-2',
1483 'russian': 'ru_RU.ISO8859-5',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001484 'rw': 'rw_RW.ISO8859-1',
1485 'rw_rw': 'rw_RW.ISO8859-1',
1486 'rw_rw.iso88591': 'rw_RW.ISO8859-1',
Serhiy Storchaka715233c2013-12-20 18:23:26 +02001487 'sd': 'sd_IN.UTF-8',
Serhiy Storchaka5eb01532013-12-26 21:20:59 +02001488 'sd@devanagari': 'sd_IN.UTF-8@devanagari',
1489 'sd_in': 'sd_IN.UTF-8',
1490 'sd_in@devanagari': 'sd_IN.UTF-8@devanagari',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001491 'se_no': 'se_NO.UTF-8',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001492 'serbocroatian': 'sr_RS.UTF-8@latin',
1493 'sh': 'sr_RS.UTF-8@latin',
1494 'sh_ba.iso88592@bosnia': 'sr_CS.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001495 'sh_hr': 'sh_HR.ISO8859-2',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001496 'sh_hr.iso88592': 'hr_HR.ISO8859-2',
1497 'sh_sp': 'sr_CS.ISO8859-2',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001498 'sh_yu': 'sr_RS.UTF-8@latin',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001499 'si': 'si_LK.UTF-8',
1500 'si_lk': 'si_LK.UTF-8',
1501 'sinhala': 'si_LK.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001502 'sk': 'sk_SK.ISO8859-2',
1503 'sk_sk': 'sk_SK.ISO8859-2',
1504 'sk_sk.iso88592': 'sk_SK.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001505 'sl': 'sl_SI.ISO8859-2',
1506 'sl_cs': 'sl_CS.ISO8859-2',
1507 'sl_si': 'sl_SI.ISO8859-2',
1508 'sl_si.iso88592': 'sl_SI.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001509 'slovak': 'sk_SK.ISO8859-2',
1510 'slovene': 'sl_SI.ISO8859-2',
1511 'slovenian': 'sl_SI.ISO8859-2',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001512 'sp': 'sr_CS.ISO8859-5',
1513 'sp_yu': 'sr_CS.ISO8859-5',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001514 'spanish': 'es_ES.ISO8859-1',
1515 'spanish.iso88591': 'es_ES.ISO8859-1',
1516 'spanish_spain': 'es_ES.ISO8859-1',
1517 'spanish_spain.8859': 'es_ES.ISO8859-1',
1518 'sq': 'sq_AL.ISO8859-2',
1519 'sq_al': 'sq_AL.ISO8859-2',
1520 'sq_al.iso88592': 'sq_AL.ISO8859-2',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001521 'sr': 'sr_RS.UTF-8',
1522 'sr@cyrillic': 'sr_RS.UTF-8',
1523 'sr@latin': 'sr_RS.UTF-8@latin',
Serhiy Storchaka715233c2013-12-20 18:23:26 +02001524 'sr@latn': 'sr_CS.UTF-8@latin',
1525 'sr_cs': 'sr_CS.UTF-8',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001526 'sr_cs.iso88592': 'sr_CS.ISO8859-2',
1527 'sr_cs.iso88592@latn': 'sr_CS.ISO8859-2',
1528 'sr_cs.iso88595': 'sr_CS.ISO8859-5',
Serhiy Storchaka715233c2013-12-20 18:23:26 +02001529 'sr_cs.utf8@latn': 'sr_CS.UTF-8@latin',
1530 'sr_cs@latn': 'sr_CS.UTF-8@latin',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001531 'sr_me': 'sr_ME.UTF-8',
1532 'sr_rs': 'sr_RS.UTF-8',
1533 'sr_rs.utf8@latn': 'sr_RS.UTF-8@latin',
1534 'sr_rs@latin': 'sr_RS.UTF-8@latin',
1535 'sr_rs@latn': 'sr_RS.UTF-8@latin',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001536 'sr_sp': 'sr_CS.ISO8859-2',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001537 'sr_yu': 'sr_RS.UTF-8@latin',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001538 'sr_yu.cp1251@cyrillic': 'sr_CS.CP1251',
1539 'sr_yu.iso88592': 'sr_CS.ISO8859-2',
1540 'sr_yu.iso88595': 'sr_CS.ISO8859-5',
1541 'sr_yu.iso88595@cyrillic': 'sr_CS.ISO8859-5',
1542 'sr_yu.microsoftcp1251@cyrillic': 'sr_CS.CP1251',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001543 'sr_yu.utf8@cyrillic': 'sr_RS.UTF-8',
1544 'sr_yu@cyrillic': 'sr_RS.UTF-8',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001545 'ss': 'ss_ZA.ISO8859-1',
1546 'ss_za': 'ss_ZA.ISO8859-1',
1547 'ss_za.iso88591': 'ss_ZA.ISO8859-1',
1548 'st': 'st_ZA.ISO8859-1',
1549 'st_za': 'st_ZA.ISO8859-1',
1550 'st_za.iso88591': 'st_ZA.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001551 'sv': 'sv_SE.ISO8859-1',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001552 'sv.iso885915': 'sv_SE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001553 'sv_fi': 'sv_FI.ISO8859-1',
1554 'sv_fi.iso88591': 'sv_FI.ISO8859-1',
1555 'sv_fi.iso885915': 'sv_FI.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001556 'sv_fi.iso885915@euro': 'sv_FI.ISO8859-15',
1557 'sv_fi.utf8@euro': 'sv_FI.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001558 'sv_fi@euro': 'sv_FI.ISO8859-15',
1559 'sv_se': 'sv_SE.ISO8859-1',
1560 'sv_se.88591': 'sv_SE.ISO8859-1',
1561 'sv_se.iso88591': 'sv_SE.ISO8859-1',
1562 'sv_se.iso885915': 'sv_SE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001563 'sv_se@euro': 'sv_SE.ISO8859-15',
1564 'swedish': 'sv_SE.ISO8859-1',
1565 'swedish.iso88591': 'sv_SE.ISO8859-1',
1566 'ta': 'ta_IN.TSCII-0',
1567 'ta_in': 'ta_IN.TSCII-0',
1568 'ta_in.tscii': 'ta_IN.TSCII-0',
1569 'ta_in.tscii0': 'ta_IN.TSCII-0',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001570 'te': 'te_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001571 'tg': 'tg_TJ.KOI8-C',
1572 'tg_tj': 'tg_TJ.KOI8-C',
1573 'tg_tj.koi8c': 'tg_TJ.KOI8-C',
1574 'th': 'th_TH.ISO8859-11',
1575 'th_th': 'th_TH.ISO8859-11',
1576 'th_th.iso885911': 'th_TH.ISO8859-11',
1577 'th_th.tactis': 'th_TH.TIS620',
1578 'th_th.tis620': 'th_TH.TIS620',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001579 'thai': 'th_TH.ISO8859-11',
1580 'tl': 'tl_PH.ISO8859-1',
1581 'tl_ph': 'tl_PH.ISO8859-1',
1582 'tl_ph.iso88591': 'tl_PH.ISO8859-1',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001583 'tn': 'tn_ZA.ISO8859-15',
1584 'tn_za': 'tn_ZA.ISO8859-15',
1585 'tn_za.iso885915': 'tn_ZA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001586 'tr': 'tr_TR.ISO8859-9',
1587 'tr_tr': 'tr_TR.ISO8859-9',
1588 'tr_tr.iso88599': 'tr_TR.ISO8859-9',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001589 'ts': 'ts_ZA.ISO8859-1',
1590 'ts_za': 'ts_ZA.ISO8859-1',
1591 'ts_za.iso88591': 'ts_ZA.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001592 'tt': 'tt_RU.TATAR-CYR',
1593 'tt_ru': 'tt_RU.TATAR-CYR',
1594 'tt_ru.koi8c': 'tt_RU.KOI8-C',
1595 'tt_ru.tatarcyr': 'tt_RU.TATAR-CYR',
1596 'turkish': 'tr_TR.ISO8859-9',
1597 'turkish.iso88599': 'tr_TR.ISO8859-9',
1598 'uk': 'uk_UA.KOI8-U',
1599 'uk_ua': 'uk_UA.KOI8-U',
1600 'uk_ua.cp1251': 'uk_UA.CP1251',
1601 'uk_ua.iso88595': 'uk_UA.ISO8859-5',
1602 'uk_ua.koi8u': 'uk_UA.KOI8-U',
1603 'uk_ua.microsoftcp1251': 'uk_UA.CP1251',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001604 'univ': 'en_US.utf',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001605 'universal': 'en_US.utf',
1606 'universal.utf8@ucs4': 'en_US.UTF-8',
1607 'ur': 'ur_PK.CP1256',
Serhiy Storchaka715233c2013-12-20 18:23:26 +02001608 'ur_in': 'ur_IN.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001609 'ur_pk': 'ur_PK.CP1256',
1610 'ur_pk.cp1256': 'ur_PK.CP1256',
1611 'ur_pk.microsoftcp1256': 'ur_PK.CP1256',
1612 'uz': 'uz_UZ.UTF-8',
1613 'uz_uz': 'uz_UZ.UTF-8',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001614 'uz_uz.iso88591': 'uz_UZ.ISO8859-1',
1615 'uz_uz.utf8@cyrillic': 'uz_UZ.UTF-8',
1616 'uz_uz@cyrillic': 'uz_UZ.UTF-8',
1617 've': 've_ZA.UTF-8',
1618 've_za': 've_ZA.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001619 'vi': 'vi_VN.TCVN',
1620 'vi_vn': 'vi_VN.TCVN',
1621 'vi_vn.tcvn': 'vi_VN.TCVN',
1622 'vi_vn.tcvn5712': 'vi_VN.TCVN',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001623 'vi_vn.viscii': 'vi_VN.VISCII',
1624 'vi_vn.viscii111': 'vi_VN.VISCII',
1625 'wa': 'wa_BE.ISO8859-1',
1626 'wa_be': 'wa_BE.ISO8859-1',
1627 'wa_be.iso88591': 'wa_BE.ISO8859-1',
1628 'wa_be.iso885915': 'wa_BE.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001629 'wa_be.iso885915@euro': 'wa_BE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001630 'wa_be@euro': 'wa_BE.ISO8859-15',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001631 'xh': 'xh_ZA.ISO8859-1',
1632 'xh_za': 'xh_ZA.ISO8859-1',
1633 'xh_za.iso88591': 'xh_ZA.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001634 'yi': 'yi_US.CP1255',
1635 'yi_us': 'yi_US.CP1255',
1636 'yi_us.cp1255': 'yi_US.CP1255',
1637 'yi_us.microsoftcp1255': 'yi_US.CP1255',
1638 'zh': 'zh_CN.eucCN',
1639 'zh_cn': 'zh_CN.gb2312',
1640 'zh_cn.big5': 'zh_TW.big5',
1641 'zh_cn.euc': 'zh_CN.eucCN',
1642 'zh_cn.gb18030': 'zh_CN.gb18030',
1643 'zh_cn.gb2312': 'zh_CN.gb2312',
1644 'zh_cn.gbk': 'zh_CN.gbk',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001645 'zh_hk': 'zh_HK.big5hkscs',
1646 'zh_hk.big5': 'zh_HK.big5',
Antoine Pitrou0c70d2d2010-04-11 22:35:34 +00001647 'zh_hk.big5hk': 'zh_HK.big5hkscs',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001648 'zh_hk.big5hkscs': 'zh_HK.big5hkscs',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001649 'zh_tw': 'zh_TW.big5',
1650 'zh_tw.big5': 'zh_TW.big5',
1651 'zh_tw.euc': 'zh_TW.eucTW',
Georg Brandlf08a9dd2008-06-10 16:57:31 +00001652 'zh_tw.euctw': 'zh_TW.eucTW',
1653 'zu': 'zu_ZA.ISO8859-1',
1654 'zu_za': 'zu_ZA.ISO8859-1',
1655 'zu_za.iso88591': 'zu_ZA.ISO8859-1',
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001656}
1657
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001658#
Georg Brandlb709c2c2006-01-20 09:07:35 +00001659# This maps Windows language identifiers to locale strings.
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001660#
Tim Peters777f1082006-01-20 20:03:24 +00001661# This list has been updated from
Georg Brandlb709c2c2006-01-20 09:07:35 +00001662# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001663# to include every locale up to Windows Vista.
Fredrik Lundh37a09822002-10-19 20:19:10 +00001664#
Georg Brandl5035c1c2006-01-20 13:38:26 +00001665# NOTE: this mapping is incomplete. If your language is missing, please
Éric Araujoa2b89e32011-11-29 16:36:17 +01001666# submit a bug report to the Python bug tracker at http://bugs.python.org/
Georg Brandl5035c1c2006-01-20 13:38:26 +00001667# Make sure you include the missing language identifier and the suggested
1668# locale code.
1669#
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001670
1671windows_locale = {
Georg Brandlb709c2c2006-01-20 09:07:35 +00001672 0x0436: "af_ZA", # Afrikaans
1673 0x041c: "sq_AL", # Albanian
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001674 0x0484: "gsw_FR",# Alsatian - France
1675 0x045e: "am_ET", # Amharic - Ethiopia
Georg Brandlb709c2c2006-01-20 09:07:35 +00001676 0x0401: "ar_SA", # Arabic - Saudi Arabia
1677 0x0801: "ar_IQ", # Arabic - Iraq
1678 0x0c01: "ar_EG", # Arabic - Egypt
1679 0x1001: "ar_LY", # Arabic - Libya
1680 0x1401: "ar_DZ", # Arabic - Algeria
1681 0x1801: "ar_MA", # Arabic - Morocco
1682 0x1c01: "ar_TN", # Arabic - Tunisia
1683 0x2001: "ar_OM", # Arabic - Oman
1684 0x2401: "ar_YE", # Arabic - Yemen
1685 0x2801: "ar_SY", # Arabic - Syria
1686 0x2c01: "ar_JO", # Arabic - Jordan
1687 0x3001: "ar_LB", # Arabic - Lebanon
1688 0x3401: "ar_KW", # Arabic - Kuwait
1689 0x3801: "ar_AE", # Arabic - United Arab Emirates
1690 0x3c01: "ar_BH", # Arabic - Bahrain
1691 0x4001: "ar_QA", # Arabic - Qatar
1692 0x042b: "hy_AM", # Armenian
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001693 0x044d: "as_IN", # Assamese - India
1694 0x042c: "az_AZ", # Azeri - Latin
Georg Brandlb709c2c2006-01-20 09:07:35 +00001695 0x082c: "az_AZ", # Azeri - Cyrillic
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001696 0x046d: "ba_RU", # Bashkir
1697 0x042d: "eu_ES", # Basque - Russia
Georg Brandlb709c2c2006-01-20 09:07:35 +00001698 0x0423: "be_BY", # Belarusian
1699 0x0445: "bn_IN", # Begali
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001700 0x201a: "bs_BA", # Bosnian - Cyrillic
1701 0x141a: "bs_BA", # Bosnian - Latin
Georg Brandlb709c2c2006-01-20 09:07:35 +00001702 0x047e: "br_FR", # Breton - France
1703 0x0402: "bg_BG", # Bulgarian
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001704# 0x0455: "my_MM", # Burmese - Not supported
Georg Brandlb709c2c2006-01-20 09:07:35 +00001705 0x0403: "ca_ES", # Catalan
1706 0x0004: "zh_CHS",# Chinese - Simplified
1707 0x0404: "zh_TW", # Chinese - Taiwan
1708 0x0804: "zh_CN", # Chinese - PRC
1709 0x0c04: "zh_HK", # Chinese - Hong Kong S.A.R.
1710 0x1004: "zh_SG", # Chinese - Singapore
1711 0x1404: "zh_MO", # Chinese - Macao S.A.R.
1712 0x7c04: "zh_CHT",# Chinese - Traditional
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001713 0x0483: "co_FR", # Corsican - France
Georg Brandlb709c2c2006-01-20 09:07:35 +00001714 0x041a: "hr_HR", # Croatian
1715 0x101a: "hr_BA", # Croatian - Bosnia
1716 0x0405: "cs_CZ", # Czech
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001717 0x0406: "da_DK", # Danish
Georg Brandlb709c2c2006-01-20 09:07:35 +00001718 0x048c: "gbz_AF",# Dari - Afghanistan
1719 0x0465: "div_MV",# Divehi - Maldives
1720 0x0413: "nl_NL", # Dutch - The Netherlands
1721 0x0813: "nl_BE", # Dutch - Belgium
1722 0x0409: "en_US", # English - United States
1723 0x0809: "en_GB", # English - United Kingdom
1724 0x0c09: "en_AU", # English - Australia
1725 0x1009: "en_CA", # English - Canada
1726 0x1409: "en_NZ", # English - New Zealand
1727 0x1809: "en_IE", # English - Ireland
1728 0x1c09: "en_ZA", # English - South Africa
1729 0x2009: "en_JA", # English - Jamaica
1730 0x2409: "en_CB", # English - Carribbean
1731 0x2809: "en_BZ", # English - Belize
1732 0x2c09: "en_TT", # English - Trinidad
1733 0x3009: "en_ZW", # English - Zimbabwe
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001734 0x3409: "en_PH", # English - Philippines
1735 0x4009: "en_IN", # English - India
1736 0x4409: "en_MY", # English - Malaysia
1737 0x4809: "en_IN", # English - Singapore
Georg Brandlb709c2c2006-01-20 09:07:35 +00001738 0x0425: "et_EE", # Estonian
1739 0x0438: "fo_FO", # Faroese
1740 0x0464: "fil_PH",# Filipino
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001741 0x040b: "fi_FI", # Finnish
Georg Brandlb709c2c2006-01-20 09:07:35 +00001742 0x040c: "fr_FR", # French - France
1743 0x080c: "fr_BE", # French - Belgium
1744 0x0c0c: "fr_CA", # French - Canada
1745 0x100c: "fr_CH", # French - Switzerland
1746 0x140c: "fr_LU", # French - Luxembourg
1747 0x180c: "fr_MC", # French - Monaco
1748 0x0462: "fy_NL", # Frisian - Netherlands
1749 0x0456: "gl_ES", # Galician
1750 0x0437: "ka_GE", # Georgian
1751 0x0407: "de_DE", # German - Germany
1752 0x0807: "de_CH", # German - Switzerland
1753 0x0c07: "de_AT", # German - Austria
1754 0x1007: "de_LU", # German - Luxembourg
1755 0x1407: "de_LI", # German - Liechtenstein
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001756 0x0408: "el_GR", # Greek
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001757 0x046f: "kl_GL", # Greenlandic - Greenland
Georg Brandlb709c2c2006-01-20 09:07:35 +00001758 0x0447: "gu_IN", # Gujarati
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001759 0x0468: "ha_NG", # Hausa - Latin
Georg Brandlb709c2c2006-01-20 09:07:35 +00001760 0x040d: "he_IL", # Hebrew
1761 0x0439: "hi_IN", # Hindi
1762 0x040e: "hu_HU", # Hungarian
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001763 0x040f: "is_IS", # Icelandic
Georg Brandlb709c2c2006-01-20 09:07:35 +00001764 0x0421: "id_ID", # Indonesian
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001765 0x045d: "iu_CA", # Inuktitut - Syllabics
Georg Brandlb709c2c2006-01-20 09:07:35 +00001766 0x085d: "iu_CA", # Inuktitut - Latin
1767 0x083c: "ga_IE", # Irish - Ireland
Georg Brandlb709c2c2006-01-20 09:07:35 +00001768 0x0410: "it_IT", # Italian - Italy
1769 0x0810: "it_CH", # Italian - Switzerland
1770 0x0411: "ja_JP", # Japanese
1771 0x044b: "kn_IN", # Kannada - India
1772 0x043f: "kk_KZ", # Kazakh
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001773 0x0453: "kh_KH", # Khmer - Cambodia
1774 0x0486: "qut_GT",# K'iche - Guatemala
1775 0x0487: "rw_RW", # Kinyarwanda - Rwanda
Georg Brandlb709c2c2006-01-20 09:07:35 +00001776 0x0457: "kok_IN",# Konkani
1777 0x0412: "ko_KR", # Korean
1778 0x0440: "ky_KG", # Kyrgyz
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001779 0x0454: "lo_LA", # Lao - Lao PDR
Georg Brandlb709c2c2006-01-20 09:07:35 +00001780 0x0426: "lv_LV", # Latvian
1781 0x0427: "lt_LT", # Lithuanian
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001782 0x082e: "dsb_DE",# Lower Sorbian - Germany
Georg Brandlb709c2c2006-01-20 09:07:35 +00001783 0x046e: "lb_LU", # Luxembourgish
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001784 0x042f: "mk_MK", # FYROM Macedonian
Georg Brandlb709c2c2006-01-20 09:07:35 +00001785 0x043e: "ms_MY", # Malay - Malaysia
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001786 0x083e: "ms_BN", # Malay - Brunei Darussalam
Georg Brandlb709c2c2006-01-20 09:07:35 +00001787 0x044c: "ml_IN", # Malayalam - India
1788 0x043a: "mt_MT", # Maltese
1789 0x0481: "mi_NZ", # Maori
1790 0x047a: "arn_CL",# Mapudungun
1791 0x044e: "mr_IN", # Marathi
1792 0x047c: "moh_CA",# Mohawk - Canada
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001793 0x0450: "mn_MN", # Mongolian - Cyrillic
1794 0x0850: "mn_CN", # Mongolian - PRC
Georg Brandlb709c2c2006-01-20 09:07:35 +00001795 0x0461: "ne_NP", # Nepali
1796 0x0414: "nb_NO", # Norwegian - Bokmal
1797 0x0814: "nn_NO", # Norwegian - Nynorsk
1798 0x0482: "oc_FR", # Occitan - France
1799 0x0448: "or_IN", # Oriya - India
1800 0x0463: "ps_AF", # Pashto - Afghanistan
1801 0x0429: "fa_IR", # Persian
1802 0x0415: "pl_PL", # Polish
1803 0x0416: "pt_BR", # Portuguese - Brazil
1804 0x0816: "pt_PT", # Portuguese - Portugal
1805 0x0446: "pa_IN", # Punjabi
1806 0x046b: "quz_BO",# Quechua (Bolivia)
1807 0x086b: "quz_EC",# Quechua (Ecuador)
1808 0x0c6b: "quz_PE",# Quechua (Peru)
1809 0x0418: "ro_RO", # Romanian - Romania
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001810 0x0417: "rm_CH", # Romansh
Georg Brandlb709c2c2006-01-20 09:07:35 +00001811 0x0419: "ru_RU", # Russian
1812 0x243b: "smn_FI",# Sami Finland
1813 0x103b: "smj_NO",# Sami Norway
1814 0x143b: "smj_SE",# Sami Sweden
1815 0x043b: "se_NO", # Sami Northern Norway
1816 0x083b: "se_SE", # Sami Northern Sweden
1817 0x0c3b: "se_FI", # Sami Northern Finland
1818 0x203b: "sms_FI",# Sami Skolt
1819 0x183b: "sma_NO",# Sami Southern Norway
1820 0x1c3b: "sma_SE",# Sami Southern Sweden
1821 0x044f: "sa_IN", # Sanskrit
1822 0x0c1a: "sr_SP", # Serbian - Cyrillic
1823 0x1c1a: "sr_BA", # Serbian - Bosnia Cyrillic
1824 0x081a: "sr_SP", # Serbian - Latin
1825 0x181a: "sr_BA", # Serbian - Bosnia Latin
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001826 0x045b: "si_LK", # Sinhala - Sri Lanka
Georg Brandlb709c2c2006-01-20 09:07:35 +00001827 0x046c: "ns_ZA", # Northern Sotho
1828 0x0432: "tn_ZA", # Setswana - Southern Africa
1829 0x041b: "sk_SK", # Slovak
1830 0x0424: "sl_SI", # Slovenian
1831 0x040a: "es_ES", # Spanish - Spain
1832 0x080a: "es_MX", # Spanish - Mexico
1833 0x0c0a: "es_ES", # Spanish - Spain (Modern)
1834 0x100a: "es_GT", # Spanish - Guatemala
1835 0x140a: "es_CR", # Spanish - Costa Rica
1836 0x180a: "es_PA", # Spanish - Panama
1837 0x1c0a: "es_DO", # Spanish - Dominican Republic
1838 0x200a: "es_VE", # Spanish - Venezuela
1839 0x240a: "es_CO", # Spanish - Colombia
1840 0x280a: "es_PE", # Spanish - Peru
1841 0x2c0a: "es_AR", # Spanish - Argentina
1842 0x300a: "es_EC", # Spanish - Ecuador
1843 0x340a: "es_CL", # Spanish - Chile
1844 0x380a: "es_UR", # Spanish - Uruguay
1845 0x3c0a: "es_PY", # Spanish - Paraguay
1846 0x400a: "es_BO", # Spanish - Bolivia
1847 0x440a: "es_SV", # Spanish - El Salvador
1848 0x480a: "es_HN", # Spanish - Honduras
1849 0x4c0a: "es_NI", # Spanish - Nicaragua
1850 0x500a: "es_PR", # Spanish - Puerto Rico
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001851 0x540a: "es_US", # Spanish - United States
1852# 0x0430: "", # Sutu - Not supported
Georg Brandlb709c2c2006-01-20 09:07:35 +00001853 0x0441: "sw_KE", # Swahili
1854 0x041d: "sv_SE", # Swedish - Sweden
1855 0x081d: "sv_FI", # Swedish - Finland
1856 0x045a: "syr_SY",# Syriac
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001857 0x0428: "tg_TJ", # Tajik - Cyrillic
1858 0x085f: "tmz_DZ",# Tamazight - Latin
Georg Brandlb709c2c2006-01-20 09:07:35 +00001859 0x0449: "ta_IN", # Tamil
1860 0x0444: "tt_RU", # Tatar
1861 0x044a: "te_IN", # Telugu
1862 0x041e: "th_TH", # Thai
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001863 0x0851: "bo_BT", # Tibetan - Bhutan
1864 0x0451: "bo_CN", # Tibetan - PRC
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001865 0x041f: "tr_TR", # Turkish
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001866 0x0442: "tk_TM", # Turkmen - Cyrillic
1867 0x0480: "ug_CN", # Uighur - Arabic
Georg Brandlb709c2c2006-01-20 09:07:35 +00001868 0x0422: "uk_UA", # Ukrainian
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001869 0x042e: "wen_DE",# Upper Sorbian - Germany
Georg Brandlb709c2c2006-01-20 09:07:35 +00001870 0x0420: "ur_PK", # Urdu
1871 0x0820: "ur_IN", # Urdu - India
1872 0x0443: "uz_UZ", # Uzbek - Latin
1873 0x0843: "uz_UZ", # Uzbek - Cyrillic
1874 0x042a: "vi_VN", # Vietnamese
1875 0x0452: "cy_GB", # Welsh
Jeroen Ruigrok van der Werven0a866942009-05-08 14:18:00 +00001876 0x0488: "wo_SN", # Wolof - Senegal
1877 0x0434: "xh_ZA", # Xhosa - South Africa
1878 0x0485: "sah_RU",# Yakut - Cyrillic
1879 0x0478: "ii_CN", # Yi - PRC
1880 0x046a: "yo_NG", # Yoruba - Nigeria
1881 0x0435: "zu_ZA", # Zulu
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001882}
1883
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001884def _print_locale():
1885
1886 """ Test function.
1887 """
1888 categories = {}
1889 def _init_categories(categories=categories):
1890 for k,v in globals().items():
1891 if k[:3] == 'LC_':
1892 categories[k] = v
1893 _init_categories()
1894 del categories['LC_ALL']
1895
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001896 print('Locale defaults as determined by getdefaultlocale():')
1897 print('-'*72)
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001898 lang, enc = getdefaultlocale()
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001899 print('Language: ', lang or '(undefined)')
1900 print('Encoding: ', enc or '(undefined)')
1901 print()
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001902
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001903 print('Locale settings on startup:')
1904 print('-'*72)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001905 for name,category in categories.items():
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001906 print(name, '...')
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001907 lang, enc = getlocale(category)
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001908 print(' Language: ', lang or '(undefined)')
1909 print(' Encoding: ', enc or '(undefined)')
1910 print()
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001911
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001912 print()
1913 print('Locale settings after calling resetlocale():')
1914 print('-'*72)
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001915 resetlocale()
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001916 for name,category in categories.items():
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001917 print(name, '...')
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001918 lang, enc = getlocale(category)
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001919 print(' Language: ', lang or '(undefined)')
1920 print(' Encoding: ', enc or '(undefined)')
1921 print()
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001922
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001923 try:
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001924 setlocale(LC_ALL, "")
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001925 except:
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001926 print('NOTE:')
1927 print('setlocale(LC_ALL, "") does not support the default locale')
1928 print('given in the OS environment variables.')
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001929 else:
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001930 print()
1931 print('Locale settings after calling setlocale(LC_ALL, ""):')
1932 print('-'*72)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001933 for name,category in categories.items():
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001934 print(name, '...')
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001935 lang, enc = getlocale(category)
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001936 print(' Language: ', lang or '(undefined)')
1937 print(' Encoding: ', enc or '(undefined)')
1938 print()
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001939
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001940###
Guido van Rossumeef1d4e1997-11-19 19:01:43 +00001941
Tim Peters1baf8292001-01-24 10:13:46 +00001942try:
1943 LC_MESSAGES
Skip Montanaro0897f0c2002-03-25 21:40:36 +00001944except NameError:
Tim Peters1baf8292001-01-24 10:13:46 +00001945 pass
1946else:
1947 __all__.append("LC_MESSAGES")
1948
Guido van Rossumeef1d4e1997-11-19 19:01:43 +00001949if __name__=='__main__':
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001950 print('Locale aliasing:')
1951 print()
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001952 _print_locale()
Guido van Rossumbe19ed72007-02-09 05:37:30 +00001953 print()
1954 print('Number formatting:')
1955 print()
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001956 _test()