blob: cfc69b1b2e686b2bba3c009894de607117328fab [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
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +000014import sys, encodings, encodings.aliases
Marc-André Lemburg5431bc32000-06-07 09:11:40 +000015
Fredrik Lundh6c86b992000-07-09 17:12:58 +000016# Try importing the _locale module.
17#
18# If this fails, fall back on a basic 'C' locale emulation.
Guido van Rossumeef1d4e1997-11-19 19:01:43 +000019
Tim Peters1baf8292001-01-24 10:13:46 +000020# Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before
21# trying the import. So __all__ is also fiddled at the end of the file.
Skip Montanaro17ab1232001-01-24 06:27:27 +000022__all__ = ["setlocale","Error","localeconv","strcoll","strxfrm",
23 "format","str","atof","atoi","LC_CTYPE","LC_COLLATE",
Tim Peters1baf8292001-01-24 10:13:46 +000024 "LC_TIME","LC_MONETARY","LC_NUMERIC", "LC_ALL","CHAR_MAX"]
Skip Montanaro17ab1232001-01-24 06:27:27 +000025
Marc-André Lemburg23481142000-06-08 17:49:41 +000026try:
Fredrik Lundh6c86b992000-07-09 17:12:58 +000027
Marc-André Lemburg23481142000-06-08 17:49:41 +000028 from _locale import *
29
30except ImportError:
31
Fredrik Lundh6c86b992000-07-09 17:12:58 +000032 # Locale emulation
33
Marc-André Lemburg23481142000-06-08 17:49:41 +000034 CHAR_MAX = 127
35 LC_ALL = 6
36 LC_COLLATE = 3
37 LC_CTYPE = 0
38 LC_MESSAGES = 5
39 LC_MONETARY = 4
40 LC_NUMERIC = 1
41 LC_TIME = 2
42 Error = ValueError
43
44 def localeconv():
Fredrik Lundh6c86b992000-07-09 17:12:58 +000045 """ localeconv() -> dict.
Marc-André Lemburg23481142000-06-08 17:49:41 +000046 Returns numeric and monetary locale-specific parameters.
47 """
48 # 'C' locale default values
49 return {'grouping': [127],
50 'currency_symbol': '',
51 'n_sign_posn': 127,
Fredrik Lundh6c86b992000-07-09 17:12:58 +000052 'p_cs_precedes': 127,
53 'n_cs_precedes': 127,
54 'mon_grouping': [],
Marc-André Lemburg23481142000-06-08 17:49:41 +000055 'n_sep_by_space': 127,
56 'decimal_point': '.',
57 'negative_sign': '',
58 'positive_sign': '',
Fredrik Lundh6c86b992000-07-09 17:12:58 +000059 'p_sep_by_space': 127,
Marc-André Lemburg23481142000-06-08 17:49:41 +000060 'int_curr_symbol': '',
Fredrik Lundh6c86b992000-07-09 17:12:58 +000061 'p_sign_posn': 127,
Marc-André Lemburg23481142000-06-08 17:49:41 +000062 'thousands_sep': '',
Fredrik Lundh6c86b992000-07-09 17:12:58 +000063 'mon_thousands_sep': '',
64 'frac_digits': 127,
Marc-André Lemburg23481142000-06-08 17:49:41 +000065 'mon_decimal_point': '',
66 'int_frac_digits': 127}
Fredrik Lundh6c86b992000-07-09 17:12:58 +000067
Marc-André Lemburg23481142000-06-08 17:49:41 +000068 def setlocale(category, value=None):
Fredrik Lundh6c86b992000-07-09 17:12:58 +000069 """ setlocale(integer,string=None) -> string.
Marc-André Lemburg23481142000-06-08 17:49:41 +000070 Activates/queries locale processing.
71 """
Martin v. Löwis103d6e72003-03-30 15:42:13 +000072 if value not in (None, '', 'C'):
Fredrik Lundh6c86b992000-07-09 17:12:58 +000073 raise Error, '_locale emulation only supports "C" locale'
Marc-André Lemburg23481142000-06-08 17:49:41 +000074 return 'C'
75
76 def strcoll(a,b):
Fredrik Lundh6c86b992000-07-09 17:12:58 +000077 """ strcoll(string,string) -> int.
Marc-André Lemburg23481142000-06-08 17:49:41 +000078 Compares two strings according to the locale.
79 """
80 return cmp(a,b)
81
82 def strxfrm(s):
Fredrik Lundh6c86b992000-07-09 17:12:58 +000083 """ strxfrm(string) -> string.
Marc-André Lemburg23481142000-06-08 17:49:41 +000084 Returns a string that behaves for cmp locale-aware.
85 """
86 return s
Marc-André Lemburg5431bc32000-06-07 09:11:40 +000087
88### Number formatting APIs
89
90# Author: Martin von Loewis
Guido van Rossumeef1d4e1997-11-19 19:01:43 +000091
92#perform the grouping from right to left
93def _group(s):
94 conv=localeconv()
95 grouping=conv['grouping']
Guido van Rossum67addfe2001-04-16 16:04:10 +000096 if not grouping:return (s, 0)
Guido van Rossumeef1d4e1997-11-19 19:01:43 +000097 result=""
Martin v. Löwis88ad12a2001-04-13 08:09:50 +000098 seps = 0
99 spaces = ""
100 if s[-1] == ' ':
101 sp = s.find(' ')
102 spaces = s[sp:]
103 s = s[:sp]
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000104 while s and grouping:
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000105 # if grouping is -1, we are done
Guido van Rossum45e2fbc1998-03-26 21:13:24 +0000106 if grouping[0]==CHAR_MAX:
107 break
108 # 0: re-use last group ad infinitum
109 elif grouping[0]!=0:
110 #process last group
111 group=grouping[0]
112 grouping=grouping[1:]
113 if result:
114 result=s[-group:]+conv['thousands_sep']+result
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000115 seps += 1
Guido van Rossum45e2fbc1998-03-26 21:13:24 +0000116 else:
117 result=s[-group:]
118 s=s[:-group]
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000119 if s and s[-1] not in "0123456789":
120 # the leading string is only spaces and signs
121 return s+result+spaces,seps
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000122 if not result:
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000123 return s+spaces,seps
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000124 if s:
Guido van Rossum45e2fbc1998-03-26 21:13:24 +0000125 result=s+conv['thousands_sep']+result
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000126 seps += 1
127 return result+spaces,seps
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000128
129def format(f,val,grouping=0):
130 """Formats a value in the same way that the % formatting would use,
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000131 but takes the current locale into account.
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000132 Grouping is applied if the third parameter is true."""
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000133 result = f % val
Martin v. Löwisdb786872001-01-21 18:52:33 +0000134 fields = result.split(".")
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000135 seps = 0
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000136 if grouping:
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000137 fields[0],seps=_group(fields[0])
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000138 if len(fields)==2:
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000139 result = fields[0]+localeconv()['decimal_point']+fields[1]
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000140 elif len(fields)==1:
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000141 result = fields[0]
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000142 else:
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000143 raise Error, "Too many decimal points in result string"
144
Martin v. Löwis88ad12a2001-04-13 08:09:50 +0000145 while seps:
146 # If the number was formatted for a specific width, then it
147 # might have been filled with spaces to the left or right. If
148 # so, kill as much spaces as there where separators.
149 # Leading zeroes as fillers are not yet dealt with, as it is
150 # not clear how they should interact with grouping.
151 sp = result.find(" ")
152 if sp==-1:break
153 result = result[:sp]+result[sp+1:]
154 seps -= 1
155
156 return result
Martin v. Löwisdb786872001-01-21 18:52:33 +0000157
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000158def str(val):
159 """Convert float to integer, taking the locale into account."""
160 return format("%.12g",val)
161
Brett Cannonaaeffaf2004-03-23 23:50:17 +0000162def atof(string,func=float):
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000163 "Parses a string as a float according to the locale settings."
164 #First, get rid of the grouping
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000165 ts = localeconv()['thousands_sep']
166 if ts:
Skip Montanaro249369c2004-04-10 16:39:32 +0000167 string = string.replace(ts, '')
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000168 #next, replace the decimal point with a dot
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000169 dd = localeconv()['decimal_point']
170 if dd:
Skip Montanaro249369c2004-04-10 16:39:32 +0000171 string = string.replace(dd, '.')
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000172 #finally, parse the string
Skip Montanaro249369c2004-04-10 16:39:32 +0000173 return func(string)
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000174
175def atoi(str):
176 "Converts a string to an integer according to the locale settings."
Eric S. Raymondbe9b5072001-02-09 10:48:30 +0000177 return atof(str, int)
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000178
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000179def _test():
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000180 setlocale(LC_ALL, "")
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000181 #do grouping
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000182 s1=format("%d", 123456789,1)
183 print s1, "is", atoi(s1)
Guido van Rossumeef1d4e1997-11-19 19:01:43 +0000184 #standard formatting
185 s1=str(3.14)
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000186 print s1, "is", atof(s1)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000187
188### Locale name aliasing engine
189
190# Author: Marc-Andre Lemburg, mal@lemburg.com
Fredrik Lundh37a09822002-10-19 20:19:10 +0000191# Various tweaks by Fredrik Lundh <fredrik@pythonware.com>
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000192
193# store away the low-level version of setlocale (it's
194# overridden below)
195_setlocale = setlocale
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000196
197def normalize(localename):
198
199 """ Returns a normalized locale code for the given locale
200 name.
201
202 The returned locale code is formatted for use with
203 setlocale().
204
205 If normalization fails, the original name is returned
206 unchanged.
207
208 If the given encoding is not known, the function defaults to
209 the default encoding for the locale code just like setlocale()
210 does.
211
212 """
213 # Normalize the locale name and extract the encoding
Eric S. Raymondbe9b5072001-02-09 10:48:30 +0000214 fullname = localename.lower()
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000215 if ':' in fullname:
216 # ':' is sometimes used as encoding delimiter.
Eric S. Raymondbe9b5072001-02-09 10:48:30 +0000217 fullname = fullname.replace(':', '.')
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000218 if '.' in fullname:
Eric S. Raymondbe9b5072001-02-09 10:48:30 +0000219 langname, encoding = fullname.split('.')[:2]
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000220 fullname = langname + '.' + encoding
221 else:
222 langname = fullname
223 encoding = ''
224
225 # First lookup: fullname (possibly with encoding)
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000226 norm_encoding = encoding.replace('-', '')
227 norm_encoding = norm_encoding.replace('_', '')
228 lookup_name = langname + '.' + encoding
229 code = locale_alias.get(lookup_name, None)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000230 if code is not None:
231 return code
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000232 #print 'first lookup failed'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000233
234 # Second try: langname (without encoding)
235 code = locale_alias.get(langname, None)
236 if code is not None:
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000237 #print 'langname lookup succeeded'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000238 if '.' in code:
Eric S. Raymondbe9b5072001-02-09 10:48:30 +0000239 langname, defenc = code.split('.')
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000240 else:
241 langname = code
242 defenc = ''
243 if encoding:
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000244 # Convert the encoding to a C lib compatible encoding string
245 norm_encoding = encodings.normalize_encoding(encoding)
246 #print 'norm encoding: %r' % norm_encoding
247 norm_encoding = encodings.aliases.aliases.get(norm_encoding,
248 norm_encoding)
249 #print 'aliased encoding: %r' % norm_encoding
250 encoding = locale_encoding_alias.get(norm_encoding,
251 norm_encoding)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000252 else:
253 encoding = defenc
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000254 #print 'found encoding %r' % encoding
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000255 if encoding:
256 return langname + '.' + encoding
257 else:
258 return langname
259
260 else:
261 return localename
262
263def _parse_localename(localename):
264
265 """ Parses the locale code for localename and returns the
266 result as tuple (language code, encoding).
267
268 The localename is normalized and passed through the locale
269 alias engine. A ValueError is raised in case the locale name
270 cannot be parsed.
271
272 The language code corresponds to RFC 1766. code and encoding
273 can be None in case the values cannot be determined or are
Jeremy Hyltona05e2932000-06-28 14:48:01 +0000274 unknown to this implementation.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000275
276 """
277 code = normalize(localename)
Georg Brandlb709c2c2006-01-20 09:07:35 +0000278 if '@' in code:
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000279 # Deal with locale modifiers
280 code, modifier = code.split('@')
281 if modifier == 'euro' and '.' not in code:
282 # Assume Latin-9 for @euro locales. This is bogus,
283 # since some systems may use other encodings for these
284 # locales. Also, we ignore other modifiers.
285 return code, 'iso-8859-15'
Tim Peters230a60c2002-11-09 05:08:07 +0000286
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000287 if '.' in code:
Raymond Hettinger346e67f2005-01-01 06:10:26 +0000288 return tuple(code.split('.')[:2])
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000289 elif code == 'C':
290 return None, None
Andrew M. Kuchling1f877ef2001-08-13 14:50:44 +0000291 raise ValueError, 'unknown locale: %s' % localename
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000292
293def _build_localename(localetuple):
294
295 """ Builds a locale code from the given tuple (language code,
296 encoding).
297
298 No aliasing or normalizing takes place.
299
300 """
301 language, encoding = localetuple
302 if language is None:
303 language = 'C'
304 if encoding is None:
305 return language
306 else:
307 return language + '.' + encoding
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000308
Matthias Klosef3f231f2005-09-20 07:02:49 +0000309def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000310
311 """ Tries to determine the default locale settings and returns
312 them as tuple (language code, encoding).
313
314 According to POSIX, a program which has not called
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000315 setlocale(LC_ALL, "") runs using the portable 'C' locale.
316 Calling setlocale(LC_ALL, "") lets it use the default locale as
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000317 defined by the LANG variable. Since we don't want to interfere
Thomas Wouters7e474022000-07-16 12:04:32 +0000318 with the current locale setting we thus emulate the behavior
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000319 in the way described above.
320
321 To maintain compatibility with other platforms, not only the
322 LANG variable is tested, but a list of variables given as
323 envvars parameter. The first found to be defined will be
324 used. envvars defaults to the search path used in GNU gettext;
325 it must always contain the variable name 'LANG'.
326
327 Except for the code 'C', the language code corresponds to RFC
328 1766. code and encoding can be None in case the values cannot
329 be determined.
330
331 """
Fredrik Lundh04661322000-07-09 23:16:10 +0000332
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000333 try:
334 # check if it's supported by the _locale module
335 import _locale
336 code, encoding = _locale._getdefaultlocale()
Fredrik Lundh04661322000-07-09 23:16:10 +0000337 except (ImportError, AttributeError):
338 pass
339 else:
Fredrik Lundh663809e2000-07-10 19:32:19 +0000340 # make sure the code/encoding values are valid
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000341 if sys.platform == "win32" and code and code[:2] == "0x":
342 # map windows language identifier to language name
343 code = windows_locale.get(int(code, 0))
Fredrik Lundh663809e2000-07-10 19:32:19 +0000344 # ...add other platform-specific processing here, if
345 # necessary...
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000346 return code, encoding
Fredrik Lundh04661322000-07-09 23:16:10 +0000347
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000348 # fall back on POSIX behaviour
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000349 import os
350 lookup = os.environ.get
351 for variable in envvars:
352 localename = lookup(variable,None)
Martin v. Löwisc8ae31d2004-07-26 12:45:18 +0000353 if localename:
Matthias Klosef3f231f2005-09-20 07:02:49 +0000354 if variable == 'LANGUAGE':
355 localename = localename.split(':')[0]
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000356 break
357 else:
358 localename = 'C'
359 return _parse_localename(localename)
360
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000361
362def getlocale(category=LC_CTYPE):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000363
364 """ Returns the current setting for the given locale category as
365 tuple (language code, encoding).
366
367 category may be one of the LC_* value except LC_ALL. It
368 defaults to LC_CTYPE.
369
370 Except for the code 'C', the language code corresponds to RFC
371 1766. code and encoding can be None in case the values cannot
372 be determined.
373
374 """
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000375 localename = _setlocale(category)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000376 if category == LC_ALL and ';' in localename:
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000377 raise TypeError, 'category LC_ALL is not supported'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000378 return _parse_localename(localename)
379
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000380def setlocale(category, locale=None):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000381
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000382 """ Set the locale for the given category. The locale can be
383 a string, a locale tuple (language code, encoding), or None.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000384
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000385 Locale tuples are converted to strings the locale aliasing
386 engine. Locale strings are passed directly to the C lib.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000387
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000388 category may be given as one of the LC_* values.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000389
390 """
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000391 if locale and type(locale) is not type(""):
392 # convert to string
393 locale = normalize(_build_localename(locale))
394 return _setlocale(category, locale)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000395
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000396def resetlocale(category=LC_ALL):
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000397
398 """ Sets the locale for category to the default setting.
399
400 The default setting is determined by calling
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000401 getdefaultlocale(). category defaults to LC_ALL.
402
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000403 """
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000404 _setlocale(category, _build_localename(getdefaultlocale()))
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000405
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000406if sys.platform in ('win32', 'darwin', 'mac'):
407 # On Win32, this will return the ANSI code page
408 # On the Mac, it should return the system encoding;
409 # it might return "ascii" instead
410 def getpreferredencoding(do_setlocale = True):
411 """Return the charset that the user is likely using."""
412 import _locale
Tim Petersa326f472002-11-05 03:49:09 +0000413 return _locale._getdefaultlocale()[1]
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000414else:
415 # On Unix, if CODESET is available, use that.
416 try:
417 CODESET
418 except NameError:
419 # Fall back to parsing environment variables :-(
420 def getpreferredencoding(do_setlocale = True):
421 """Return the charset that the user is likely using,
422 by looking at environment variables."""
423 return getdefaultlocale()[1]
424 else:
425 def getpreferredencoding(do_setlocale = True):
426 """Return the charset that the user is likely using,
427 according to the system configuration."""
428 if do_setlocale:
429 oldloc = setlocale(LC_CTYPE)
430 setlocale(LC_CTYPE, "")
431 result = nl_langinfo(CODESET)
432 setlocale(LC_CTYPE, oldloc)
433 return result
434 else:
435 return nl_langinfo(CODESET)
Tim Peters230a60c2002-11-09 05:08:07 +0000436
Martin v. Löwisf0a46682002-11-03 17:20:12 +0000437
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000438### Database
439#
440# The following data was extracted from the locale.alias file which
441# comes with X11 and then hand edited removing the explicit encoding
442# definitions and adding some more aliases. The file is usually
443# available as /usr/lib/X11/locale/locale.alias.
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000444#
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000445
446#
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000447# The local_encoding_alias table maps lowercase encoding alias names
448# to C locale encoding names (case-sensitive). Note that normalize()
449# first looks up the encoding in the encodings.aliases dictionary and
450# then applies this mapping to find the correct C lib name for the
451# encoding.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000452#
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000453locale_encoding_alias = {
454
455 # Mappings for non-standard encoding names used in locale names
456 '437': 'C',
457 'c': 'C',
458 'en': 'ISO8859-1',
459 'jis': 'JIS7',
460 'jis7': 'JIS7',
461 'ajec': 'eucJP',
462
463 # Mappings from Python codec names to C lib encoding names
464 'ascii': 'ISO8859-1',
465 'latin_1': 'ISO8859-1',
466 'iso8859_1': 'ISO8859-1',
467 'iso8859_10': 'ISO8859-10',
468 'iso8859_11': 'ISO8859-11',
469 'iso8859_13': 'ISO8859-13',
470 'iso8859_14': 'ISO8859-14',
471 'iso8859_15': 'ISO8859-15',
472 'iso8859_2': 'ISO8859-2',
473 'iso8859_3': 'ISO8859-3',
474 'iso8859_4': 'ISO8859-4',
475 'iso8859_5': 'ISO8859-5',
476 'iso8859_6': 'ISO8859-6',
477 'iso8859_7': 'ISO8859-7',
478 'iso8859_8': 'ISO8859-8',
479 'iso8859_9': 'ISO8859-9',
480 'iso2022_jp': 'JIS7',
481 'shift_jis': 'SJIS',
482 'tactis': 'TACTIS',
483 'euc_jp': 'eucJP',
484 'euc_kr': 'eucKR',
Marc-André Lemburgb4cebd42004-12-13 19:56:01 +0000485 'utf_8': 'UTF8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000486 'koi8_r': 'KOI8-R',
487 'koi8_u': 'KOI8-U',
488 # XXX This list is still incomplete. If you know more
489 # mappings, please file a bug report. Thanks.
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000490}
491
Fredrik Lundh6c86b992000-07-09 17:12:58 +0000492#
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000493# The locale_alias table maps lowercase alias names to C locale names
494# (case-sensitive). Encodings are always separated from the locale
495# name using a dot ('.'); they should only be given in case the
496# language name is needed to interpret the given encoding alias
497# correctly (CJK codes often have this need).
498#
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000499# Note that the normalize() function which uses this tables
500# removes '_' and '-' characters from the encoding part of the
501# locale name before doing the lookup. This saves a lot of
502# space in the table.
503#
504# MAL 2004-12-10:
505# Updated alias mapping to most recent locale.alias file
506# from X.org distribution using makelocalealias.py.
507#
508# These are the differences compared to the old mapping (Python 2.4
509# and older):
510#
511# updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
512# updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
513# updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
514# updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
515# updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
516# updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
517# updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1'
518# updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
519# updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
520# updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
521# updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
522# updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
523# updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
524# updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP'
525# updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13'
526# updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13'
527# updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
528# updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
529# updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11'
530# updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312'
531# updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5'
532# updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5'
533#
Marc-André Lemburg5431bc32000-06-07 09:11:40 +0000534locale_alias = {
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000535 'a3': 'a3_AZ.KOI8-C',
536 'a3_az': 'a3_AZ.KOI8-C',
537 'a3_az.koi8c': 'a3_AZ.KOI8-C',
538 'af': 'af_ZA.ISO8859-1',
539 'af_za': 'af_ZA.ISO8859-1',
540 'af_za.iso88591': 'af_ZA.ISO8859-1',
541 'am': 'am_ET.UTF-8',
542 'american': 'en_US.ISO8859-1',
543 'american.iso88591': 'en_US.ISO8859-1',
544 'ar': 'ar_AA.ISO8859-6',
545 'ar_aa': 'ar_AA.ISO8859-6',
546 'ar_aa.iso88596': 'ar_AA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000547 'ar_ae': 'ar_AE.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000548 'ar_bh': 'ar_BH.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000549 'ar_dz': 'ar_DZ.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000550 'ar_eg': 'ar_EG.ISO8859-6',
551 'ar_eg.iso88596': 'ar_EG.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000552 'ar_iq': 'ar_IQ.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000553 'ar_jo': 'ar_JO.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000554 'ar_kw': 'ar_KW.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000555 'ar_lb': 'ar_LB.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000556 'ar_ly': 'ar_LY.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000557 'ar_ma': 'ar_MA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000558 'ar_om': 'ar_OM.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000559 'ar_qa': 'ar_QA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000560 'ar_sa': 'ar_SA.ISO8859-6',
561 'ar_sa.iso88596': 'ar_SA.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000562 'ar_sd': 'ar_SD.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000563 'ar_sy': 'ar_SY.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000564 'ar_tn': 'ar_TN.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000565 'ar_ye': 'ar_YE.ISO8859-6',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000566 'arabic': 'ar_AA.ISO8859-6',
567 'arabic.iso88596': 'ar_AA.ISO8859-6',
568 'az': 'az_AZ.ISO8859-9E',
569 'az_az': 'az_AZ.ISO8859-9E',
570 'az_az.iso88599e': 'az_AZ.ISO8859-9E',
571 'be': 'be_BY.CP1251',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000572 'be_by': 'be_BY.CP1251',
573 'be_by.cp1251': 'be_BY.CP1251',
574 'be_by.microsoftcp1251': 'be_BY.CP1251',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000575 'bg': 'bg_BG.CP1251',
576 'bg_bg': 'bg_BG.CP1251',
577 'bg_bg.cp1251': 'bg_BG.CP1251',
578 'bg_bg.iso88595': 'bg_BG.ISO8859-5',
579 'bg_bg.koi8r': 'bg_BG.KOI8-R',
580 'bg_bg.microsoftcp1251': 'bg_BG.CP1251',
581 'bokmal': 'nb_NO.ISO8859-1',
582 'bokm\xe5l': 'nb_NO.ISO8859-1',
583 'br': 'br_FR.ISO8859-1',
584 'br_fr': 'br_FR.ISO8859-1',
585 'br_fr.iso88591': 'br_FR.ISO8859-1',
586 'br_fr.iso885914': 'br_FR.ISO8859-14',
587 'br_fr.iso885915': 'br_FR.ISO8859-15',
588 'br_fr@euro': 'br_FR.ISO8859-15',
589 'bulgarian': 'bg_BG.CP1251',
590 'c': 'C',
591 'c-french': 'fr_CA.ISO8859-1',
592 'c-french.iso88591': 'fr_CA.ISO8859-1',
593 'c.en': 'C',
594 'c.iso88591': 'en_US.ISO8859-1',
595 'c_c': 'C',
596 'c_c.c': 'C',
597 'ca': 'ca_ES.ISO8859-1',
598 'ca_es': 'ca_ES.ISO8859-1',
599 'ca_es.iso88591': 'ca_ES.ISO8859-1',
600 'ca_es.iso885915': 'ca_ES.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000601 'ca_es@euro': 'ca_ES.ISO8859-15',
602 'catalan': 'ca_ES.ISO8859-1',
603 'cextend': 'en_US.ISO8859-1',
604 'cextend.en': 'en_US.ISO8859-1',
605 'chinese-s': 'zh_CN.eucCN',
606 'chinese-t': 'zh_TW.eucTW',
607 'croatian': 'hr_HR.ISO8859-2',
608 'cs': 'cs_CZ.ISO8859-2',
609 'cs_cs': 'cs_CZ.ISO8859-2',
610 'cs_cs.iso88592': 'cs_CZ.ISO8859-2',
611 'cs_cz': 'cs_CZ.ISO8859-2',
612 'cs_cz.iso88592': 'cs_CZ.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000613 'cy': 'cy_GB.ISO8859-1',
614 'cy_gb': 'cy_GB.ISO8859-1',
615 'cy_gb.iso88591': 'cy_GB.ISO8859-1',
616 'cy_gb.iso885914': 'cy_GB.ISO8859-14',
617 'cy_gb.iso885915': 'cy_GB.ISO8859-15',
618 'cy_gb@euro': 'cy_GB.ISO8859-15',
619 'cz': 'cs_CZ.ISO8859-2',
620 'cz_cz': 'cs_CZ.ISO8859-2',
621 'czech': 'cs_CZ.ISO8859-2',
622 'da': 'da_DK.ISO8859-1',
623 'da_dk': 'da_DK.ISO8859-1',
624 'da_dk.88591': 'da_DK.ISO8859-1',
625 'da_dk.885915': 'da_DK.ISO8859-15',
626 'da_dk.iso88591': 'da_DK.ISO8859-1',
627 'da_dk.iso885915': 'da_DK.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000628 'da_dk@euro': 'da_DK.ISO8859-15',
629 'danish': 'da_DK.ISO8859-1',
630 'danish.iso88591': 'da_DK.ISO8859-1',
631 'dansk': 'da_DK.ISO8859-1',
632 'de': 'de_DE.ISO8859-1',
633 'de_at': 'de_AT.ISO8859-1',
634 'de_at.iso88591': 'de_AT.ISO8859-1',
635 'de_at.iso885915': 'de_AT.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000636 'de_at@euro': 'de_AT.ISO8859-15',
637 'de_be': 'de_BE.ISO8859-1',
638 'de_be.iso88591': 'de_BE.ISO8859-1',
639 'de_be.iso885915': 'de_BE.ISO8859-15',
640 'de_be@euro': 'de_BE.ISO8859-15',
641 'de_ch': 'de_CH.ISO8859-1',
642 'de_ch.iso88591': 'de_CH.ISO8859-1',
643 'de_ch.iso885915': 'de_CH.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000644 'de_ch@euro': 'de_CH.ISO8859-15',
645 'de_de': 'de_DE.ISO8859-1',
646 'de_de.88591': 'de_DE.ISO8859-1',
647 'de_de.885915': 'de_DE.ISO8859-15',
648 'de_de.885915@euro': 'de_DE.ISO8859-15',
649 'de_de.iso88591': 'de_DE.ISO8859-1',
650 'de_de.iso885915': 'de_DE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000651 'de_de@euro': 'de_DE.ISO8859-15',
652 'de_lu': 'de_LU.ISO8859-1',
653 'de_lu.iso88591': 'de_LU.ISO8859-1',
654 'de_lu.iso885915': 'de_LU.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000655 'de_lu@euro': 'de_LU.ISO8859-15',
656 'deutsch': 'de_DE.ISO8859-1',
657 'dutch': 'nl_NL.ISO8859-1',
658 'dutch.iso88591': 'nl_BE.ISO8859-1',
659 'ee': 'ee_EE.ISO8859-4',
660 'ee_ee': 'ee_EE.ISO8859-4',
661 'ee_ee.iso88594': 'ee_EE.ISO8859-4',
662 'eesti': 'et_EE.ISO8859-1',
663 'el': 'el_GR.ISO8859-7',
664 'el_gr': 'el_GR.ISO8859-7',
665 'el_gr.iso88597': 'el_GR.ISO8859-7',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000666 'el_gr@euro': 'el_GR.ISO8859-15',
667 'en': 'en_US.ISO8859-1',
668 'en.iso88591': 'en_US.ISO8859-1',
669 'en_au': 'en_AU.ISO8859-1',
670 'en_au.iso88591': 'en_AU.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000671 'en_be': 'en_BE.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000672 'en_be@euro': 'en_BE.ISO8859-15',
673 'en_bw': 'en_BW.ISO8859-1',
674 'en_ca': 'en_CA.ISO8859-1',
675 'en_ca.iso88591': 'en_CA.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000676 'en_gb': 'en_GB.ISO8859-1',
677 'en_gb.88591': 'en_GB.ISO8859-1',
678 'en_gb.iso88591': 'en_GB.ISO8859-1',
679 'en_gb.iso885915': 'en_GB.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000680 'en_gb@euro': 'en_GB.ISO8859-15',
681 'en_hk': 'en_HK.ISO8859-1',
682 'en_ie': 'en_IE.ISO8859-1',
683 'en_ie.iso88591': 'en_IE.ISO8859-1',
684 'en_ie.iso885915': 'en_IE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000685 'en_ie@euro': 'en_IE.ISO8859-15',
686 'en_in': 'en_IN.ISO8859-1',
687 'en_nz': 'en_NZ.ISO8859-1',
688 'en_nz.iso88591': 'en_NZ.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000689 'en_ph': 'en_PH.ISO8859-1',
690 'en_sg': 'en_SG.ISO8859-1',
691 'en_uk': 'en_GB.ISO8859-1',
692 'en_us': 'en_US.ISO8859-1',
693 'en_us.88591': 'en_US.ISO8859-1',
694 'en_us.885915': 'en_US.ISO8859-15',
695 'en_us.iso88591': 'en_US.ISO8859-1',
696 'en_us.iso885915': 'en_US.ISO8859-15',
697 'en_us.iso885915@euro': 'en_US.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000698 'en_us@euro': 'en_US.ISO8859-15',
699 'en_us@euro@euro': 'en_US.ISO8859-15',
700 'en_za': 'en_ZA.ISO8859-1',
701 'en_za.88591': 'en_ZA.ISO8859-1',
702 'en_za.iso88591': 'en_ZA.ISO8859-1',
703 'en_za.iso885915': 'en_ZA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000704 'en_za@euro': 'en_ZA.ISO8859-15',
705 'en_zw': 'en_ZW.ISO8859-1',
706 'eng_gb': 'en_GB.ISO8859-1',
707 'eng_gb.8859': 'en_GB.ISO8859-1',
708 'english': 'en_EN.ISO8859-1',
709 'english.iso88591': 'en_EN.ISO8859-1',
710 'english_uk': 'en_GB.ISO8859-1',
711 'english_uk.8859': 'en_GB.ISO8859-1',
712 'english_united-states': 'en_US.ISO8859-1',
713 'english_united-states.437': 'C',
714 'english_us': 'en_US.ISO8859-1',
715 'english_us.8859': 'en_US.ISO8859-1',
716 'english_us.ascii': 'en_US.ISO8859-1',
717 'eo': 'eo_XX.ISO8859-3',
718 'eo_eo': 'eo_EO.ISO8859-3',
719 'eo_eo.iso88593': 'eo_EO.ISO8859-3',
720 'eo_xx': 'eo_XX.ISO8859-3',
721 'eo_xx.iso88593': 'eo_XX.ISO8859-3',
722 'es': 'es_ES.ISO8859-1',
723 'es_ar': 'es_AR.ISO8859-1',
724 'es_ar.iso88591': 'es_AR.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000725 'es_bo': 'es_BO.ISO8859-1',
726 'es_bo.iso88591': 'es_BO.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000727 'es_cl': 'es_CL.ISO8859-1',
728 'es_cl.iso88591': 'es_CL.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000729 'es_co': 'es_CO.ISO8859-1',
730 'es_co.iso88591': 'es_CO.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000731 'es_cr': 'es_CR.ISO8859-1',
732 'es_cr.iso88591': 'es_CR.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000733 'es_do': 'es_DO.ISO8859-1',
734 'es_do.iso88591': 'es_DO.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000735 'es_ec': 'es_EC.ISO8859-1',
736 'es_ec.iso88591': 'es_EC.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000737 'es_es': 'es_ES.ISO8859-1',
738 'es_es.88591': 'es_ES.ISO8859-1',
739 'es_es.iso88591': 'es_ES.ISO8859-1',
740 'es_es.iso885915': 'es_ES.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000741 'es_es@euro': 'es_ES.ISO8859-15',
742 'es_gt': 'es_GT.ISO8859-1',
743 'es_gt.iso88591': 'es_GT.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000744 'es_hn': 'es_HN.ISO8859-1',
745 'es_hn.iso88591': 'es_HN.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000746 'es_mx': 'es_MX.ISO8859-1',
747 'es_mx.iso88591': 'es_MX.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000748 'es_ni': 'es_NI.ISO8859-1',
749 'es_ni.iso88591': 'es_NI.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000750 'es_pa': 'es_PA.ISO8859-1',
751 'es_pa.iso88591': 'es_PA.ISO8859-1',
752 'es_pa.iso885915': 'es_PA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000753 'es_pa@euro': 'es_PA.ISO8859-15',
754 'es_pe': 'es_PE.ISO8859-1',
755 'es_pe.iso88591': 'es_PE.ISO8859-1',
756 'es_pe.iso885915': 'es_PE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000757 'es_pe@euro': 'es_PE.ISO8859-15',
758 'es_pr': 'es_PR.ISO8859-1',
759 'es_pr.iso88591': 'es_PR.ISO8859-1',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000760 'es_py': 'es_PY.ISO8859-1',
761 'es_py.iso88591': 'es_PY.ISO8859-1',
762 'es_py.iso885915': 'es_PY.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000763 'es_py@euro': 'es_PY.ISO8859-15',
764 'es_sv': 'es_SV.ISO8859-1',
765 'es_sv.iso88591': 'es_SV.ISO8859-1',
766 'es_sv.iso885915': 'es_SV.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000767 'es_sv@euro': 'es_SV.ISO8859-15',
768 'es_us': 'es_US.ISO8859-1',
769 'es_uy': 'es_UY.ISO8859-1',
770 'es_uy.iso88591': 'es_UY.ISO8859-1',
771 'es_uy.iso885915': 'es_UY.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000772 'es_uy@euro': 'es_UY.ISO8859-15',
773 'es_ve': 'es_VE.ISO8859-1',
774 'es_ve.iso88591': 'es_VE.ISO8859-1',
775 'es_ve.iso885915': 'es_VE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000776 'es_ve@euro': 'es_VE.ISO8859-15',
777 'estonian': 'et_EE.ISO8859-1',
778 'et': 'et_EE.ISO8859-15',
779 'et_ee': 'et_EE.ISO8859-15',
780 'et_ee.iso88591': 'et_EE.ISO8859-1',
781 'et_ee.iso885913': 'et_EE.ISO8859-13',
782 'et_ee.iso885915': 'et_EE.ISO8859-15',
783 'et_ee.iso88594': 'et_EE.ISO8859-4',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000784 'et_ee@euro': 'et_EE.ISO8859-15',
785 'eu': 'eu_ES.ISO8859-1',
786 'eu_es': 'eu_ES.ISO8859-1',
787 'eu_es.iso88591': 'eu_ES.ISO8859-1',
788 'eu_es.iso885915': 'eu_ES.ISO8859-15',
789 'eu_es@euro': 'eu_ES.ISO8859-15',
790 'fa': 'fa_IR.UTF-8',
791 'fa_ir': 'fa_IR.UTF-8',
792 'fa_ir.isiri3342': 'fa_IR.ISIRI-3342',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000793 'fi': 'fi_FI.ISO8859-15',
794 'fi_fi': 'fi_FI.ISO8859-15',
795 'fi_fi.88591': 'fi_FI.ISO8859-1',
796 'fi_fi.iso88591': 'fi_FI.ISO8859-1',
797 'fi_fi.iso885915': 'fi_FI.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000798 'fi_fi.utf8@euro': 'fi_FI.UTF-8',
799 'fi_fi@euro': 'fi_FI.ISO8859-15',
800 'finnish': 'fi_FI.ISO8859-1',
801 'finnish.iso88591': 'fi_FI.ISO8859-1',
802 'fo': 'fo_FO.ISO8859-1',
803 'fo_fo': 'fo_FO.ISO8859-1',
804 'fo_fo.iso88591': 'fo_FO.ISO8859-1',
805 'fo_fo.iso885915': 'fo_FO.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000806 'fo_fo@euro': 'fo_FO.ISO8859-15',
807 'fr': 'fr_FR.ISO8859-1',
808 'fr_be': 'fr_BE.ISO8859-1',
809 'fr_be.88591': 'fr_BE.ISO8859-1',
810 'fr_be.iso88591': 'fr_BE.ISO8859-1',
811 'fr_be.iso885915': 'fr_BE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000812 'fr_be@euro': 'fr_BE.ISO8859-15',
813 'fr_ca': 'fr_CA.ISO8859-1',
814 'fr_ca.88591': 'fr_CA.ISO8859-1',
815 'fr_ca.iso88591': 'fr_CA.ISO8859-1',
816 'fr_ca.iso885915': 'fr_CA.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000817 'fr_ca@euro': 'fr_CA.ISO8859-15',
818 'fr_ch': 'fr_CH.ISO8859-1',
819 'fr_ch.88591': 'fr_CH.ISO8859-1',
820 'fr_ch.iso88591': 'fr_CH.ISO8859-1',
821 'fr_ch.iso885915': 'fr_CH.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000822 'fr_ch@euro': 'fr_CH.ISO8859-15',
823 'fr_fr': 'fr_FR.ISO8859-1',
824 'fr_fr.88591': 'fr_FR.ISO8859-1',
825 'fr_fr.iso88591': 'fr_FR.ISO8859-1',
826 'fr_fr.iso885915': 'fr_FR.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000827 'fr_fr@euro': 'fr_FR.ISO8859-15',
828 'fr_lu': 'fr_LU.ISO8859-1',
829 'fr_lu.88591': 'fr_LU.ISO8859-1',
830 'fr_lu.iso88591': 'fr_LU.ISO8859-1',
831 'fr_lu.iso885915': 'fr_LU.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000832 'fr_lu@euro': 'fr_LU.ISO8859-15',
833 'fran\xe7ais': 'fr_FR.ISO8859-1',
834 'fre_fr': 'fr_FR.ISO8859-1',
835 'fre_fr.8859': 'fr_FR.ISO8859-1',
836 'french': 'fr_FR.ISO8859-1',
837 'french.iso88591': 'fr_CH.ISO8859-1',
838 'french_france': 'fr_FR.ISO8859-1',
839 'french_france.8859': 'fr_FR.ISO8859-1',
840 'ga': 'ga_IE.ISO8859-1',
841 'ga_ie': 'ga_IE.ISO8859-1',
842 'ga_ie.iso88591': 'ga_IE.ISO8859-1',
843 'ga_ie.iso885914': 'ga_IE.ISO8859-14',
844 'ga_ie.iso885915': 'ga_IE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000845 'ga_ie@euro': 'ga_IE.ISO8859-15',
846 'galego': 'gl_ES.ISO8859-1',
847 'galician': 'gl_ES.ISO8859-1',
848 'gd': 'gd_GB.ISO8859-1',
849 'gd_gb': 'gd_GB.ISO8859-1',
850 'gd_gb.iso88591': 'gd_GB.ISO8859-1',
851 'gd_gb.iso885914': 'gd_GB.ISO8859-14',
852 'gd_gb.iso885915': 'gd_GB.ISO8859-15',
853 'gd_gb@euro': 'gd_GB.ISO8859-15',
854 'ger_de': 'de_DE.ISO8859-1',
855 'ger_de.8859': 'de_DE.ISO8859-1',
856 'german': 'de_DE.ISO8859-1',
857 'german.iso88591': 'de_CH.ISO8859-1',
858 'german_germany': 'de_DE.ISO8859-1',
859 'german_germany.8859': 'de_DE.ISO8859-1',
860 'gl': 'gl_ES.ISO8859-1',
861 'gl_es': 'gl_ES.ISO8859-1',
862 'gl_es.iso88591': 'gl_ES.ISO8859-1',
863 'gl_es.iso885915': 'gl_ES.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000864 'gl_es@euro': 'gl_ES.ISO8859-15',
865 'greek': 'el_GR.ISO8859-7',
866 'greek.iso88597': 'el_GR.ISO8859-7',
867 'gv': 'gv_GB.ISO8859-1',
868 'gv_gb': 'gv_GB.ISO8859-1',
869 'gv_gb.iso88591': 'gv_GB.ISO8859-1',
870 'gv_gb.iso885914': 'gv_GB.ISO8859-14',
871 'gv_gb.iso885915': 'gv_GB.ISO8859-15',
872 'gv_gb@euro': 'gv_GB.ISO8859-15',
873 'he': 'he_IL.ISO8859-8',
874 'he_il': 'he_IL.ISO8859-8',
875 'he_il.cp1255': 'he_IL.CP1255',
876 'he_il.iso88598': 'he_IL.ISO8859-8',
877 'he_il.microsoftcp1255': 'he_IL.CP1255',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000878 'hebrew': 'iw_IL.ISO8859-8',
879 'hebrew.iso88598': 'iw_IL.ISO8859-8',
880 'hi': 'hi_IN.ISCII-DEV',
881 'hi_in': 'hi_IN.ISCII-DEV',
882 'hi_in.isciidev': 'hi_IN.ISCII-DEV',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000883 'hr': 'hr_HR.ISO8859-2',
884 'hr_hr': 'hr_HR.ISO8859-2',
885 'hr_hr.iso88592': 'hr_HR.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000886 'hrvatski': 'hr_HR.ISO8859-2',
887 'hu': 'hu_HU.ISO8859-2',
888 'hu_hu': 'hu_HU.ISO8859-2',
889 'hu_hu.iso88592': 'hu_HU.ISO8859-2',
890 'hungarian': 'hu_HU.ISO8859-2',
891 'icelandic': 'is_IS.ISO8859-1',
892 'icelandic.iso88591': 'is_IS.ISO8859-1',
893 'id': 'id_ID.ISO8859-1',
894 'id_id': 'id_ID.ISO8859-1',
895 'in': 'id_ID.ISO8859-1',
896 'in_id': 'id_ID.ISO8859-1',
897 'is': 'is_IS.ISO8859-1',
898 'is_is': 'is_IS.ISO8859-1',
899 'is_is.iso88591': 'is_IS.ISO8859-1',
900 'is_is.iso885915': 'is_IS.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000901 'is_is@euro': 'is_IS.ISO8859-15',
902 'iso-8859-1': 'en_US.ISO8859-1',
903 'iso-8859-15': 'en_US.ISO8859-15',
904 'iso8859-1': 'en_US.ISO8859-1',
905 'iso8859-15': 'en_US.ISO8859-15',
906 'iso_8859_1': 'en_US.ISO8859-1',
907 'iso_8859_15': 'en_US.ISO8859-15',
908 'it': 'it_IT.ISO8859-1',
909 'it_ch': 'it_CH.ISO8859-1',
910 'it_ch.iso88591': 'it_CH.ISO8859-1',
911 'it_ch.iso885915': 'it_CH.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000912 'it_ch@euro': 'it_CH.ISO8859-15',
913 'it_it': 'it_IT.ISO8859-1',
914 'it_it.88591': 'it_IT.ISO8859-1',
915 'it_it.iso88591': 'it_IT.ISO8859-1',
916 'it_it.iso885915': 'it_IT.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000917 'it_it@euro': 'it_IT.ISO8859-15',
918 'italian': 'it_IT.ISO8859-1',
919 'italian.iso88591': 'it_IT.ISO8859-1',
920 'iu': 'iu_CA.NUNACOM-8',
921 'iu_ca': 'iu_CA.NUNACOM-8',
922 'iu_ca.nunacom8': 'iu_CA.NUNACOM-8',
923 'iw': 'he_IL.ISO8859-8',
924 'iw_il': 'he_IL.ISO8859-8',
925 'iw_il.iso88598': 'he_IL.ISO8859-8',
926 'ja': 'ja_JP.eucJP',
927 'ja.jis': 'ja_JP.JIS7',
928 'ja.sjis': 'ja_JP.SJIS',
929 'ja_jp': 'ja_JP.eucJP',
930 'ja_jp.ajec': 'ja_JP.eucJP',
931 'ja_jp.euc': 'ja_JP.eucJP',
932 'ja_jp.eucjp': 'ja_JP.eucJP',
933 'ja_jp.iso-2022-jp': 'ja_JP.JIS7',
934 'ja_jp.iso2022jp': 'ja_JP.JIS7',
935 'ja_jp.jis': 'ja_JP.JIS7',
936 'ja_jp.jis7': 'ja_JP.JIS7',
937 'ja_jp.mscode': 'ja_JP.SJIS',
938 'ja_jp.sjis': 'ja_JP.SJIS',
939 'ja_jp.ujis': 'ja_JP.eucJP',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000940 'japan': 'ja_JP.eucJP',
941 'japanese': 'ja_JP.eucJP',
942 'japanese-euc': 'ja_JP.eucJP',
943 'japanese.euc': 'ja_JP.eucJP',
944 'japanese.sjis': 'ja_JP.SJIS',
945 'jp_jp': 'ja_JP.eucJP',
946 'ka': 'ka_GE.GEORGIAN-ACADEMY',
947 'ka_ge': 'ka_GE.GEORGIAN-ACADEMY',
948 'ka_ge.georgianacademy': 'ka_GE.GEORGIAN-ACADEMY',
949 'ka_ge.georgianps': 'ka_GE.GEORGIAN-PS',
950 'ka_ge.georgianrs': 'ka_GE.GEORGIAN-ACADEMY',
951 'kl': 'kl_GL.ISO8859-1',
952 'kl_gl': 'kl_GL.ISO8859-1',
953 'kl_gl.iso88591': 'kl_GL.ISO8859-1',
954 'kl_gl.iso885915': 'kl_GL.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000955 'kl_gl@euro': 'kl_GL.ISO8859-15',
956 'ko': 'ko_KR.eucKR',
957 'ko_kr': 'ko_KR.eucKR',
958 'ko_kr.euc': 'ko_KR.eucKR',
959 'ko_kr.euckr': 'ko_KR.eucKR',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000960 'korean': 'ko_KR.eucKR',
961 'korean.euc': 'ko_KR.eucKR',
962 'kw': 'kw_GB.ISO8859-1',
963 'kw_gb': 'kw_GB.ISO8859-1',
964 'kw_gb.iso88591': 'kw_GB.ISO8859-1',
965 'kw_gb.iso885914': 'kw_GB.ISO8859-14',
966 'kw_gb.iso885915': 'kw_GB.ISO8859-15',
967 'kw_gb@euro': 'kw_GB.ISO8859-15',
968 'lithuanian': 'lt_LT.ISO8859-13',
969 'lo': 'lo_LA.MULELAO-1',
970 'lo_la': 'lo_LA.MULELAO-1',
971 'lo_la.cp1133': 'lo_LA.IBM-CP1133',
972 'lo_la.ibmcp1133': 'lo_LA.IBM-CP1133',
973 'lo_la.mulelao1': 'lo_LA.MULELAO-1',
974 'lt': 'lt_LT.ISO8859-13',
975 'lt_lt': 'lt_LT.ISO8859-13',
976 'lt_lt.iso885913': 'lt_LT.ISO8859-13',
977 'lt_lt.iso88594': 'lt_LT.ISO8859-4',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000978 'lv': 'lv_LV.ISO8859-13',
979 'lv_lv': 'lv_LV.ISO8859-13',
980 'lv_lv.iso885913': 'lv_LV.ISO8859-13',
981 'lv_lv.iso88594': 'lv_LV.ISO8859-4',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000982 'mi': 'mi_NZ.ISO8859-1',
983 'mi_nz': 'mi_NZ.ISO8859-1',
984 'mi_nz.iso88591': 'mi_NZ.ISO8859-1',
985 'mk': 'mk_MK.ISO8859-5',
986 'mk_mk': 'mk_MK.ISO8859-5',
987 'mk_mk.cp1251': 'mk_MK.CP1251',
988 'mk_mk.iso88595': 'mk_MK.ISO8859-5',
989 'mk_mk.microsoftcp1251': 'mk_MK.CP1251',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +0000990 'ms': 'ms_MY.ISO8859-1',
991 'ms_my': 'ms_MY.ISO8859-1',
992 'ms_my.iso88591': 'ms_MY.ISO8859-1',
993 'mt': 'mt_MT.ISO8859-3',
994 'mt_mt': 'mt_MT.ISO8859-3',
995 'mt_mt.iso88593': 'mt_MT.ISO8859-3',
996 'nb': 'nb_NO.ISO8859-1',
997 'nb_no': 'nb_NO.ISO8859-1',
998 'nb_no.88591': 'nb_NO.ISO8859-1',
999 'nb_no.iso88591': 'nb_NO.ISO8859-1',
1000 'nb_no.iso885915': 'nb_NO.ISO8859-15',
1001 'nb_no@euro': 'nb_NO.ISO8859-15',
1002 'nl': 'nl_NL.ISO8859-1',
1003 'nl_be': 'nl_BE.ISO8859-1',
1004 'nl_be.88591': 'nl_BE.ISO8859-1',
1005 'nl_be.iso88591': 'nl_BE.ISO8859-1',
1006 'nl_be.iso885915': 'nl_BE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001007 'nl_be@euro': 'nl_BE.ISO8859-15',
1008 'nl_nl': 'nl_NL.ISO8859-1',
1009 'nl_nl.88591': 'nl_NL.ISO8859-1',
1010 'nl_nl.iso88591': 'nl_NL.ISO8859-1',
1011 'nl_nl.iso885915': 'nl_NL.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001012 'nl_nl@euro': 'nl_NL.ISO8859-15',
1013 'nn': 'nn_NO.ISO8859-1',
1014 'nn_no': 'nn_NO.ISO8859-1',
1015 'nn_no.88591': 'nn_NO.ISO8859-1',
1016 'nn_no.iso88591': 'nn_NO.ISO8859-1',
1017 'nn_no.iso885915': 'nn_NO.ISO8859-15',
1018 'nn_no@euro': 'nn_NO.ISO8859-15',
1019 'no': 'no_NO.ISO8859-1',
1020 'no@nynorsk': 'ny_NO.ISO8859-1',
1021 'no_no': 'no_NO.ISO8859-1',
1022 'no_no.88591': 'no_NO.ISO8859-1',
1023 'no_no.iso88591': 'no_NO.ISO8859-1',
1024 'no_no.iso885915': 'no_NO.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001025 'no_no@euro': 'no_NO.ISO8859-15',
1026 'norwegian': 'no_NO.ISO8859-1',
1027 'norwegian.iso88591': 'no_NO.ISO8859-1',
1028 'ny': 'ny_NO.ISO8859-1',
1029 'ny_no': 'ny_NO.ISO8859-1',
1030 'ny_no.88591': 'ny_NO.ISO8859-1',
1031 'ny_no.iso88591': 'ny_NO.ISO8859-1',
1032 'ny_no.iso885915': 'ny_NO.ISO8859-15',
1033 'ny_no@euro': 'ny_NO.ISO8859-15',
1034 'nynorsk': 'nn_NO.ISO8859-1',
1035 'oc': 'oc_FR.ISO8859-1',
1036 'oc_fr': 'oc_FR.ISO8859-1',
1037 'oc_fr.iso88591': 'oc_FR.ISO8859-1',
1038 'oc_fr.iso885915': 'oc_FR.ISO8859-15',
1039 'oc_fr@euro': 'oc_FR.ISO8859-15',
1040 'pd': 'pd_US.ISO8859-1',
1041 'pd_de': 'pd_DE.ISO8859-1',
1042 'pd_de.iso88591': 'pd_DE.ISO8859-1',
1043 'pd_de.iso885915': 'pd_DE.ISO8859-15',
1044 'pd_de@euro': 'pd_DE.ISO8859-15',
1045 'pd_us': 'pd_US.ISO8859-1',
1046 'pd_us.iso88591': 'pd_US.ISO8859-1',
1047 'pd_us.iso885915': 'pd_US.ISO8859-15',
1048 'pd_us@euro': 'pd_US.ISO8859-15',
1049 'ph': 'ph_PH.ISO8859-1',
1050 'ph_ph': 'ph_PH.ISO8859-1',
1051 'ph_ph.iso88591': 'ph_PH.ISO8859-1',
1052 'pl': 'pl_PL.ISO8859-2',
1053 'pl_pl': 'pl_PL.ISO8859-2',
1054 'pl_pl.iso88592': 'pl_PL.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001055 'polish': 'pl_PL.ISO8859-2',
1056 'portuguese': 'pt_PT.ISO8859-1',
1057 'portuguese.iso88591': 'pt_PT.ISO8859-1',
1058 'portuguese_brazil': 'pt_BR.ISO8859-1',
1059 'portuguese_brazil.8859': 'pt_BR.ISO8859-1',
1060 'posix': 'C',
1061 'posix-utf2': 'C',
1062 'pp': 'pp_AN.ISO8859-1',
1063 'pp_an': 'pp_AN.ISO8859-1',
1064 'pp_an.iso88591': 'pp_AN.ISO8859-1',
1065 'pt': 'pt_PT.ISO8859-1',
1066 'pt_br': 'pt_BR.ISO8859-1',
1067 'pt_br.88591': 'pt_BR.ISO8859-1',
1068 'pt_br.iso88591': 'pt_BR.ISO8859-1',
1069 'pt_br.iso885915': 'pt_BR.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001070 'pt_br@euro': 'pt_BR.ISO8859-15',
1071 'pt_pt': 'pt_PT.ISO8859-1',
1072 'pt_pt.88591': 'pt_PT.ISO8859-1',
1073 'pt_pt.iso88591': 'pt_PT.ISO8859-1',
1074 'pt_pt.iso885915': 'pt_PT.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001075 'pt_pt.utf8@euro': 'pt_PT.UTF-8',
1076 'pt_pt@euro': 'pt_PT.ISO8859-15',
1077 'ro': 'ro_RO.ISO8859-2',
1078 'ro_ro': 'ro_RO.ISO8859-2',
1079 'ro_ro.iso88592': 'ro_RO.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001080 'romanian': 'ro_RO.ISO8859-2',
1081 'ru': 'ru_RU.ISO8859-5',
1082 'ru_ru': 'ru_RU.ISO8859-5',
1083 'ru_ru.cp1251': 'ru_RU.CP1251',
1084 'ru_ru.iso88595': 'ru_RU.ISO8859-5',
1085 'ru_ru.koi8r': 'ru_RU.KOI8-R',
1086 'ru_ru.microsoftcp1251': 'ru_RU.CP1251',
1087 'ru_ua': 'ru_UA.KOI8-U',
1088 'ru_ua.cp1251': 'ru_UA.CP1251',
1089 'ru_ua.koi8u': 'ru_UA.KOI8-U',
1090 'ru_ua.microsoftcp1251': 'ru_UA.CP1251',
1091 'rumanian': 'ro_RO.ISO8859-2',
1092 'russian': 'ru_RU.ISO8859-5',
1093 'se_no': 'se_NO.UTF-8',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001094 'serbocroatian': 'sh_YU.ISO8859-2',
1095 'sh': 'sh_YU.ISO8859-2',
1096 'sh_hr': 'sh_HR.ISO8859-2',
1097 'sh_hr.iso88592': 'sh_HR.ISO8859-2',
1098 'sh_sp': 'sh_YU.ISO8859-2',
1099 'sh_yu': 'sh_YU.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001100 'sk': 'sk_SK.ISO8859-2',
1101 'sk_sk': 'sk_SK.ISO8859-2',
1102 'sk_sk.iso88592': 'sk_SK.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001103 'sl': 'sl_SI.ISO8859-2',
1104 'sl_cs': 'sl_CS.ISO8859-2',
1105 'sl_si': 'sl_SI.ISO8859-2',
1106 'sl_si.iso88592': 'sl_SI.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001107 'slovak': 'sk_SK.ISO8859-2',
1108 'slovene': 'sl_SI.ISO8859-2',
1109 'slovenian': 'sl_SI.ISO8859-2',
1110 'sp': 'sp_YU.ISO8859-5',
1111 'sp_yu': 'sp_YU.ISO8859-5',
1112 'spanish': 'es_ES.ISO8859-1',
1113 'spanish.iso88591': 'es_ES.ISO8859-1',
1114 'spanish_spain': 'es_ES.ISO8859-1',
1115 'spanish_spain.8859': 'es_ES.ISO8859-1',
1116 'sq': 'sq_AL.ISO8859-2',
1117 'sq_al': 'sq_AL.ISO8859-2',
1118 'sq_al.iso88592': 'sq_AL.ISO8859-2',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001119 'sr': 'sr_YU.ISO8859-5',
1120 'sr@cyrillic': 'sr_YU.ISO8859-5',
1121 'sr_sp': 'sr_SP.ISO8859-2',
1122 'sr_yu': 'sr_YU.ISO8859-5',
1123 'sr_yu.cp1251@cyrillic': 'sr_YU.CP1251',
1124 'sr_yu.iso88592': 'sr_YU.ISO8859-2',
1125 'sr_yu.iso88595': 'sr_YU.ISO8859-5',
1126 'sr_yu.iso88595@cyrillic': 'sr_YU.ISO8859-5',
1127 'sr_yu.microsoftcp1251@cyrillic': 'sr_YU.CP1251',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001128 'sr_yu.utf8@cyrillic': 'sr_YU.UTF-8',
1129 'sr_yu@cyrillic': 'sr_YU.ISO8859-5',
1130 'sv': 'sv_SE.ISO8859-1',
1131 'sv_fi': 'sv_FI.ISO8859-1',
1132 'sv_fi.iso88591': 'sv_FI.ISO8859-1',
1133 'sv_fi.iso885915': 'sv_FI.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001134 'sv_fi@euro': 'sv_FI.ISO8859-15',
1135 'sv_se': 'sv_SE.ISO8859-1',
1136 'sv_se.88591': 'sv_SE.ISO8859-1',
1137 'sv_se.iso88591': 'sv_SE.ISO8859-1',
1138 'sv_se.iso885915': 'sv_SE.ISO8859-15',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001139 'sv_se@euro': 'sv_SE.ISO8859-15',
1140 'swedish': 'sv_SE.ISO8859-1',
1141 'swedish.iso88591': 'sv_SE.ISO8859-1',
1142 'ta': 'ta_IN.TSCII-0',
1143 'ta_in': 'ta_IN.TSCII-0',
1144 'ta_in.tscii': 'ta_IN.TSCII-0',
1145 'ta_in.tscii0': 'ta_IN.TSCII-0',
1146 'tg': 'tg_TJ.KOI8-C',
1147 'tg_tj': 'tg_TJ.KOI8-C',
1148 'tg_tj.koi8c': 'tg_TJ.KOI8-C',
1149 'th': 'th_TH.ISO8859-11',
1150 'th_th': 'th_TH.ISO8859-11',
1151 'th_th.iso885911': 'th_TH.ISO8859-11',
1152 'th_th.tactis': 'th_TH.TIS620',
1153 'th_th.tis620': 'th_TH.TIS620',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001154 'thai': 'th_TH.ISO8859-11',
1155 'tl': 'tl_PH.ISO8859-1',
1156 'tl_ph': 'tl_PH.ISO8859-1',
1157 'tl_ph.iso88591': 'tl_PH.ISO8859-1',
1158 'tr': 'tr_TR.ISO8859-9',
1159 'tr_tr': 'tr_TR.ISO8859-9',
1160 'tr_tr.iso88599': 'tr_TR.ISO8859-9',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001161 'tt': 'tt_RU.TATAR-CYR',
1162 'tt_ru': 'tt_RU.TATAR-CYR',
1163 'tt_ru.koi8c': 'tt_RU.KOI8-C',
1164 'tt_ru.tatarcyr': 'tt_RU.TATAR-CYR',
1165 'turkish': 'tr_TR.ISO8859-9',
1166 'turkish.iso88599': 'tr_TR.ISO8859-9',
1167 'uk': 'uk_UA.KOI8-U',
1168 'uk_ua': 'uk_UA.KOI8-U',
1169 'uk_ua.cp1251': 'uk_UA.CP1251',
1170 'uk_ua.iso88595': 'uk_UA.ISO8859-5',
1171 'uk_ua.koi8u': 'uk_UA.KOI8-U',
1172 'uk_ua.microsoftcp1251': 'uk_UA.CP1251',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001173 'univ': 'en_US.utf',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001174 'universal': 'en_US.utf',
1175 'universal.utf8@ucs4': 'en_US.UTF-8',
1176 'ur': 'ur_PK.CP1256',
1177 'ur_pk': 'ur_PK.CP1256',
1178 'ur_pk.cp1256': 'ur_PK.CP1256',
1179 'ur_pk.microsoftcp1256': 'ur_PK.CP1256',
1180 'uz': 'uz_UZ.UTF-8',
1181 'uz_uz': 'uz_UZ.UTF-8',
1182 'vi': 'vi_VN.TCVN',
1183 'vi_vn': 'vi_VN.TCVN',
1184 'vi_vn.tcvn': 'vi_VN.TCVN',
1185 'vi_vn.tcvn5712': 'vi_VN.TCVN',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001186 'vi_vn.viscii': 'vi_VN.VISCII',
1187 'vi_vn.viscii111': 'vi_VN.VISCII',
1188 'wa': 'wa_BE.ISO8859-1',
1189 'wa_be': 'wa_BE.ISO8859-1',
1190 'wa_be.iso88591': 'wa_BE.ISO8859-1',
1191 'wa_be.iso885915': 'wa_BE.ISO8859-15',
1192 'wa_be@euro': 'wa_BE.ISO8859-15',
1193 'yi': 'yi_US.CP1255',
1194 'yi_us': 'yi_US.CP1255',
1195 'yi_us.cp1255': 'yi_US.CP1255',
1196 'yi_us.microsoftcp1255': 'yi_US.CP1255',
1197 'zh': 'zh_CN.eucCN',
1198 'zh_cn': 'zh_CN.gb2312',
1199 'zh_cn.big5': 'zh_TW.big5',
1200 'zh_cn.euc': 'zh_CN.eucCN',
1201 'zh_cn.gb18030': 'zh_CN.gb18030',
1202 'zh_cn.gb2312': 'zh_CN.gb2312',
1203 'zh_cn.gbk': 'zh_CN.gbk',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001204 'zh_hk': 'zh_HK.big5hkscs',
1205 'zh_hk.big5': 'zh_HK.big5',
1206 'zh_hk.big5hkscs': 'zh_HK.big5hkscs',
Marc-André Lemburgbb4f1bd2004-12-10 21:58:14 +00001207 'zh_tw': 'zh_TW.big5',
1208 'zh_tw.big5': 'zh_TW.big5',
1209 'zh_tw.euc': 'zh_TW.eucTW',
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001210}
1211
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001212#
Georg Brandlb709c2c2006-01-20 09:07:35 +00001213# This maps Windows language identifiers to locale strings.
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001214#
Tim Peters777f1082006-01-20 20:03:24 +00001215# This list has been updated from
Georg Brandlb709c2c2006-01-20 09:07:35 +00001216# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp
1217# to include every locale up to Windows XP.
Fredrik Lundh37a09822002-10-19 20:19:10 +00001218#
Georg Brandl5035c1c2006-01-20 13:38:26 +00001219# NOTE: this mapping is incomplete. If your language is missing, please
1220# submit a bug report to Python bug manager, which you can find via:
1221# http://www.python.org/dev/
1222# Make sure you include the missing language identifier and the suggested
1223# locale code.
1224#
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001225
1226windows_locale = {
Georg Brandlb709c2c2006-01-20 09:07:35 +00001227 0x0436: "af_ZA", # Afrikaans
1228 0x041c: "sq_AL", # Albanian
1229 0x0401: "ar_SA", # Arabic - Saudi Arabia
1230 0x0801: "ar_IQ", # Arabic - Iraq
1231 0x0c01: "ar_EG", # Arabic - Egypt
1232 0x1001: "ar_LY", # Arabic - Libya
1233 0x1401: "ar_DZ", # Arabic - Algeria
1234 0x1801: "ar_MA", # Arabic - Morocco
1235 0x1c01: "ar_TN", # Arabic - Tunisia
1236 0x2001: "ar_OM", # Arabic - Oman
1237 0x2401: "ar_YE", # Arabic - Yemen
1238 0x2801: "ar_SY", # Arabic - Syria
1239 0x2c01: "ar_JO", # Arabic - Jordan
1240 0x3001: "ar_LB", # Arabic - Lebanon
1241 0x3401: "ar_KW", # Arabic - Kuwait
1242 0x3801: "ar_AE", # Arabic - United Arab Emirates
1243 0x3c01: "ar_BH", # Arabic - Bahrain
1244 0x4001: "ar_QA", # Arabic - Qatar
1245 0x042b: "hy_AM", # Armenian
1246 0x042c: "az_AZ", # Azeri Latin
1247 0x082c: "az_AZ", # Azeri - Cyrillic
1248 0x042d: "eu_ES", # Basque
1249 0x0423: "be_BY", # Belarusian
1250 0x0445: "bn_IN", # Begali
1251 0x201a: "bs_BA", # Bosnian
1252 0x141a: "bs_BA", # Bosnian - Cyrillic
1253 0x047e: "br_FR", # Breton - France
1254 0x0402: "bg_BG", # Bulgarian
1255 0x0403: "ca_ES", # Catalan
1256 0x0004: "zh_CHS",# Chinese - Simplified
1257 0x0404: "zh_TW", # Chinese - Taiwan
1258 0x0804: "zh_CN", # Chinese - PRC
1259 0x0c04: "zh_HK", # Chinese - Hong Kong S.A.R.
1260 0x1004: "zh_SG", # Chinese - Singapore
1261 0x1404: "zh_MO", # Chinese - Macao S.A.R.
1262 0x7c04: "zh_CHT",# Chinese - Traditional
1263 0x041a: "hr_HR", # Croatian
1264 0x101a: "hr_BA", # Croatian - Bosnia
1265 0x0405: "cs_CZ", # Czech
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001266 0x0406: "da_DK", # Danish
Georg Brandlb709c2c2006-01-20 09:07:35 +00001267 0x048c: "gbz_AF",# Dari - Afghanistan
1268 0x0465: "div_MV",# Divehi - Maldives
1269 0x0413: "nl_NL", # Dutch - The Netherlands
1270 0x0813: "nl_BE", # Dutch - Belgium
1271 0x0409: "en_US", # English - United States
1272 0x0809: "en_GB", # English - United Kingdom
1273 0x0c09: "en_AU", # English - Australia
1274 0x1009: "en_CA", # English - Canada
1275 0x1409: "en_NZ", # English - New Zealand
1276 0x1809: "en_IE", # English - Ireland
1277 0x1c09: "en_ZA", # English - South Africa
1278 0x2009: "en_JA", # English - Jamaica
1279 0x2409: "en_CB", # English - Carribbean
1280 0x2809: "en_BZ", # English - Belize
1281 0x2c09: "en_TT", # English - Trinidad
1282 0x3009: "en_ZW", # English - Zimbabwe
1283 0x3409: "en_PH", # English - Phillippines
1284 0x0425: "et_EE", # Estonian
1285 0x0438: "fo_FO", # Faroese
1286 0x0464: "fil_PH",# Filipino
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001287 0x040b: "fi_FI", # Finnish
Georg Brandlb709c2c2006-01-20 09:07:35 +00001288 0x040c: "fr_FR", # French - France
1289 0x080c: "fr_BE", # French - Belgium
1290 0x0c0c: "fr_CA", # French - Canada
1291 0x100c: "fr_CH", # French - Switzerland
1292 0x140c: "fr_LU", # French - Luxembourg
1293 0x180c: "fr_MC", # French - Monaco
1294 0x0462: "fy_NL", # Frisian - Netherlands
1295 0x0456: "gl_ES", # Galician
1296 0x0437: "ka_GE", # Georgian
1297 0x0407: "de_DE", # German - Germany
1298 0x0807: "de_CH", # German - Switzerland
1299 0x0c07: "de_AT", # German - Austria
1300 0x1007: "de_LU", # German - Luxembourg
1301 0x1407: "de_LI", # German - Liechtenstein
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001302 0x0408: "el_GR", # Greek
Georg Brandlb709c2c2006-01-20 09:07:35 +00001303 0x0447: "gu_IN", # Gujarati
1304 0x040d: "he_IL", # Hebrew
1305 0x0439: "hi_IN", # Hindi
1306 0x040e: "hu_HU", # Hungarian
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001307 0x040f: "is_IS", # Icelandic
Georg Brandlb709c2c2006-01-20 09:07:35 +00001308 0x0421: "id_ID", # Indonesian
1309 0x045d: "iu_CA", # Inuktitut
1310 0x085d: "iu_CA", # Inuktitut - Latin
1311 0x083c: "ga_IE", # Irish - Ireland
1312 0x0434: "xh_ZA", # Xhosa - South Africa
1313 0x0435: "zu_ZA", # Zulu
1314 0x0410: "it_IT", # Italian - Italy
1315 0x0810: "it_CH", # Italian - Switzerland
1316 0x0411: "ja_JP", # Japanese
1317 0x044b: "kn_IN", # Kannada - India
1318 0x043f: "kk_KZ", # Kazakh
1319 0x0457: "kok_IN",# Konkani
1320 0x0412: "ko_KR", # Korean
1321 0x0440: "ky_KG", # Kyrgyz
1322 0x0426: "lv_LV", # Latvian
1323 0x0427: "lt_LT", # Lithuanian
1324 0x046e: "lb_LU", # Luxembourgish
1325 0x042f: "mk_MK", # FYRO Macedonian
1326 0x043e: "ms_MY", # Malay - Malaysia
1327 0x083e: "ms_BN", # Malay - Brunei
1328 0x044c: "ml_IN", # Malayalam - India
1329 0x043a: "mt_MT", # Maltese
1330 0x0481: "mi_NZ", # Maori
1331 0x047a: "arn_CL",# Mapudungun
1332 0x044e: "mr_IN", # Marathi
1333 0x047c: "moh_CA",# Mohawk - Canada
1334 0x0450: "mn_MN", # Mongolian
1335 0x0461: "ne_NP", # Nepali
1336 0x0414: "nb_NO", # Norwegian - Bokmal
1337 0x0814: "nn_NO", # Norwegian - Nynorsk
1338 0x0482: "oc_FR", # Occitan - France
1339 0x0448: "or_IN", # Oriya - India
1340 0x0463: "ps_AF", # Pashto - Afghanistan
1341 0x0429: "fa_IR", # Persian
1342 0x0415: "pl_PL", # Polish
1343 0x0416: "pt_BR", # Portuguese - Brazil
1344 0x0816: "pt_PT", # Portuguese - Portugal
1345 0x0446: "pa_IN", # Punjabi
1346 0x046b: "quz_BO",# Quechua (Bolivia)
1347 0x086b: "quz_EC",# Quechua (Ecuador)
1348 0x0c6b: "quz_PE",# Quechua (Peru)
1349 0x0418: "ro_RO", # Romanian - Romania
1350 0x0417: "rm_CH", # Raeto-Romanese
1351 0x0419: "ru_RU", # Russian
1352 0x243b: "smn_FI",# Sami Finland
1353 0x103b: "smj_NO",# Sami Norway
1354 0x143b: "smj_SE",# Sami Sweden
1355 0x043b: "se_NO", # Sami Northern Norway
1356 0x083b: "se_SE", # Sami Northern Sweden
1357 0x0c3b: "se_FI", # Sami Northern Finland
1358 0x203b: "sms_FI",# Sami Skolt
1359 0x183b: "sma_NO",# Sami Southern Norway
1360 0x1c3b: "sma_SE",# Sami Southern Sweden
1361 0x044f: "sa_IN", # Sanskrit
1362 0x0c1a: "sr_SP", # Serbian - Cyrillic
1363 0x1c1a: "sr_BA", # Serbian - Bosnia Cyrillic
1364 0x081a: "sr_SP", # Serbian - Latin
1365 0x181a: "sr_BA", # Serbian - Bosnia Latin
1366 0x046c: "ns_ZA", # Northern Sotho
1367 0x0432: "tn_ZA", # Setswana - Southern Africa
1368 0x041b: "sk_SK", # Slovak
1369 0x0424: "sl_SI", # Slovenian
1370 0x040a: "es_ES", # Spanish - Spain
1371 0x080a: "es_MX", # Spanish - Mexico
1372 0x0c0a: "es_ES", # Spanish - Spain (Modern)
1373 0x100a: "es_GT", # Spanish - Guatemala
1374 0x140a: "es_CR", # Spanish - Costa Rica
1375 0x180a: "es_PA", # Spanish - Panama
1376 0x1c0a: "es_DO", # Spanish - Dominican Republic
1377 0x200a: "es_VE", # Spanish - Venezuela
1378 0x240a: "es_CO", # Spanish - Colombia
1379 0x280a: "es_PE", # Spanish - Peru
1380 0x2c0a: "es_AR", # Spanish - Argentina
1381 0x300a: "es_EC", # Spanish - Ecuador
1382 0x340a: "es_CL", # Spanish - Chile
1383 0x380a: "es_UR", # Spanish - Uruguay
1384 0x3c0a: "es_PY", # Spanish - Paraguay
1385 0x400a: "es_BO", # Spanish - Bolivia
1386 0x440a: "es_SV", # Spanish - El Salvador
1387 0x480a: "es_HN", # Spanish - Honduras
1388 0x4c0a: "es_NI", # Spanish - Nicaragua
1389 0x500a: "es_PR", # Spanish - Puerto Rico
1390 0x0441: "sw_KE", # Swahili
1391 0x041d: "sv_SE", # Swedish - Sweden
1392 0x081d: "sv_FI", # Swedish - Finland
1393 0x045a: "syr_SY",# Syriac
1394 0x0449: "ta_IN", # Tamil
1395 0x0444: "tt_RU", # Tatar
1396 0x044a: "te_IN", # Telugu
1397 0x041e: "th_TH", # Thai
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001398 0x041f: "tr_TR", # Turkish
Georg Brandlb709c2c2006-01-20 09:07:35 +00001399 0x0422: "uk_UA", # Ukrainian
1400 0x0420: "ur_PK", # Urdu
1401 0x0820: "ur_IN", # Urdu - India
1402 0x0443: "uz_UZ", # Uzbek - Latin
1403 0x0843: "uz_UZ", # Uzbek - Cyrillic
1404 0x042a: "vi_VN", # Vietnamese
1405 0x0452: "cy_GB", # Welsh
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001406}
1407
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001408def _print_locale():
1409
1410 """ Test function.
1411 """
1412 categories = {}
1413 def _init_categories(categories=categories):
1414 for k,v in globals().items():
1415 if k[:3] == 'LC_':
1416 categories[k] = v
1417 _init_categories()
1418 del categories['LC_ALL']
1419
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001420 print 'Locale defaults as determined by getdefaultlocale():'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001421 print '-'*72
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001422 lang, enc = getdefaultlocale()
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001423 print 'Language: ', lang or '(undefined)'
1424 print 'Encoding: ', enc or '(undefined)'
1425 print
1426
1427 print 'Locale settings on startup:'
1428 print '-'*72
1429 for name,category in categories.items():
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001430 print name, '...'
1431 lang, enc = getlocale(category)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001432 print ' Language: ', lang or '(undefined)'
1433 print ' Encoding: ', enc or '(undefined)'
1434 print
1435
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001436 print
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001437 print 'Locale settings after calling resetlocale():'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001438 print '-'*72
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001439 resetlocale()
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001440 for name,category in categories.items():
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001441 print name, '...'
1442 lang, enc = getlocale(category)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001443 print ' Language: ', lang or '(undefined)'
1444 print ' Encoding: ', enc or '(undefined)'
1445 print
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001446
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001447 try:
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001448 setlocale(LC_ALL, "")
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001449 except:
1450 print 'NOTE:'
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001451 print 'setlocale(LC_ALL, "") does not support the default locale'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001452 print 'given in the OS environment variables.'
1453 else:
1454 print
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001455 print 'Locale settings after calling setlocale(LC_ALL, ""):'
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001456 print '-'*72
1457 for name,category in categories.items():
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001458 print name, '...'
1459 lang, enc = getlocale(category)
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001460 print ' Language: ', lang or '(undefined)'
1461 print ' Encoding: ', enc or '(undefined)'
1462 print
Fredrik Lundh6c86b992000-07-09 17:12:58 +00001463
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001464###
Guido van Rossumeef1d4e1997-11-19 19:01:43 +00001465
Tim Peters1baf8292001-01-24 10:13:46 +00001466try:
1467 LC_MESSAGES
Skip Montanaro0897f0c2002-03-25 21:40:36 +00001468except NameError:
Tim Peters1baf8292001-01-24 10:13:46 +00001469 pass
1470else:
1471 __all__.append("LC_MESSAGES")
1472
Guido van Rossumeef1d4e1997-11-19 19:01:43 +00001473if __name__=='__main__':
Marc-André Lemburg5431bc32000-06-07 09:11:40 +00001474 print 'Locale aliasing:'
1475 print
1476 _print_locale()
1477 print
1478 print 'Number formatting:'
1479 print
1480 _test()