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