Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1 | """ Locale support. |
Guido van Rossum | 4b8c6ea | 2000-02-04 15:39:30 +0000 | [diff] [blame] | 2 | |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 3 | The module provides low-level access to the C lib's locale APIs |
| 4 | and adds high level number formatting APIs as well as a locale |
| 5 | aliasing engine to complement these. |
| 6 | |
| 7 | The aliasing engine includes support for many commonly used locale |
| 8 | names and maps them to values suitable for passing to the C lib's |
| 9 | setlocale() function. It also includes default encodings for all |
| 10 | supported locale names. |
| 11 | |
| 12 | """ |
| 13 | |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 14 | import sys, encodings, encodings.aliases |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 15 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 16 | # Try importing the _locale module. |
| 17 | # |
| 18 | # If this fails, fall back on a basic 'C' locale emulation. |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 19 | |
Tim Peters | 1baf829 | 2001-01-24 10:13:46 +0000 | [diff] [blame] | 20 | # Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before |
| 21 | # trying the import. So __all__ is also fiddled at the end of the file. |
Skip Montanaro | 17ab123 | 2001-01-24 06:27:27 +0000 | [diff] [blame] | 22 | __all__ = ["setlocale","Error","localeconv","strcoll","strxfrm", |
| 23 | "format","str","atof","atoi","LC_CTYPE","LC_COLLATE", |
Tim Peters | 1baf829 | 2001-01-24 10:13:46 +0000 | [diff] [blame] | 24 | "LC_TIME","LC_MONETARY","LC_NUMERIC", "LC_ALL","CHAR_MAX"] |
Skip Montanaro | 17ab123 | 2001-01-24 06:27:27 +0000 | [diff] [blame] | 25 | |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 26 | try: |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 27 | |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 28 | from _locale import * |
| 29 | |
| 30 | except ImportError: |
| 31 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 32 | # Locale emulation |
| 33 | |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 34 | CHAR_MAX = 127 |
| 35 | LC_ALL = 6 |
| 36 | LC_COLLATE = 3 |
| 37 | LC_CTYPE = 0 |
| 38 | LC_MESSAGES = 5 |
| 39 | LC_MONETARY = 4 |
| 40 | LC_NUMERIC = 1 |
| 41 | LC_TIME = 2 |
| 42 | Error = ValueError |
| 43 | |
| 44 | def localeconv(): |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 45 | """ localeconv() -> dict. |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 46 | Returns numeric and monetary locale-specific parameters. |
| 47 | """ |
| 48 | # 'C' locale default values |
| 49 | return {'grouping': [127], |
| 50 | 'currency_symbol': '', |
| 51 | 'n_sign_posn': 127, |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 52 | 'p_cs_precedes': 127, |
| 53 | 'n_cs_precedes': 127, |
| 54 | 'mon_grouping': [], |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 55 | 'n_sep_by_space': 127, |
| 56 | 'decimal_point': '.', |
| 57 | 'negative_sign': '', |
| 58 | 'positive_sign': '', |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 59 | 'p_sep_by_space': 127, |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 60 | 'int_curr_symbol': '', |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 61 | 'p_sign_posn': 127, |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 62 | 'thousands_sep': '', |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 63 | 'mon_thousands_sep': '', |
| 64 | 'frac_digits': 127, |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 65 | 'mon_decimal_point': '', |
| 66 | 'int_frac_digits': 127} |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 67 | |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 68 | def setlocale(category, value=None): |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 69 | """ setlocale(integer,string=None) -> string. |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 70 | Activates/queries locale processing. |
| 71 | """ |
Martin v. Löwis | 103d6e7 | 2003-03-30 15:42:13 +0000 | [diff] [blame] | 72 | if value not in (None, '', 'C'): |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 73 | raise Error, '_locale emulation only supports "C" locale' |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 74 | return 'C' |
| 75 | |
| 76 | def strcoll(a,b): |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 77 | """ strcoll(string,string) -> int. |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 78 | Compares two strings according to the locale. |
| 79 | """ |
| 80 | return cmp(a,b) |
| 81 | |
| 82 | def strxfrm(s): |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 83 | """ strxfrm(string) -> string. |
Marc-André Lemburg | 2348114 | 2000-06-08 17:49:41 +0000 | [diff] [blame] | 84 | Returns a string that behaves for cmp locale-aware. |
| 85 | """ |
| 86 | return s |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 87 | |
| 88 | ### Number formatting APIs |
| 89 | |
| 90 | # Author: Martin von Loewis |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 91 | |
| 92 | #perform the grouping from right to left |
| 93 | def _group(s): |
| 94 | conv=localeconv() |
| 95 | grouping=conv['grouping'] |
Guido van Rossum | 67addfe | 2001-04-16 16:04:10 +0000 | [diff] [blame] | 96 | if not grouping:return (s, 0) |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 97 | result="" |
Martin v. Löwis | 88ad12a | 2001-04-13 08:09:50 +0000 | [diff] [blame] | 98 | seps = 0 |
| 99 | spaces = "" |
| 100 | if s[-1] == ' ': |
| 101 | sp = s.find(' ') |
| 102 | spaces = s[sp:] |
| 103 | s = s[:sp] |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 104 | while s and grouping: |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 105 | # if grouping is -1, we are done |
Guido van Rossum | 45e2fbc | 1998-03-26 21:13:24 +0000 | [diff] [blame] | 106 | if grouping[0]==CHAR_MAX: |
| 107 | break |
| 108 | # 0: re-use last group ad infinitum |
| 109 | elif grouping[0]!=0: |
| 110 | #process last group |
| 111 | group=grouping[0] |
| 112 | grouping=grouping[1:] |
| 113 | if result: |
| 114 | result=s[-group:]+conv['thousands_sep']+result |
Martin v. Löwis | 88ad12a | 2001-04-13 08:09:50 +0000 | [diff] [blame] | 115 | seps += 1 |
Guido van Rossum | 45e2fbc | 1998-03-26 21:13:24 +0000 | [diff] [blame] | 116 | else: |
| 117 | result=s[-group:] |
| 118 | s=s[:-group] |
Martin v. Löwis | 88ad12a | 2001-04-13 08:09:50 +0000 | [diff] [blame] | 119 | if s and s[-1] not in "0123456789": |
| 120 | # the leading string is only spaces and signs |
| 121 | return s+result+spaces,seps |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 122 | if not result: |
Martin v. Löwis | 88ad12a | 2001-04-13 08:09:50 +0000 | [diff] [blame] | 123 | return s+spaces,seps |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 124 | if s: |
Guido van Rossum | 45e2fbc | 1998-03-26 21:13:24 +0000 | [diff] [blame] | 125 | result=s+conv['thousands_sep']+result |
Martin v. Löwis | 88ad12a | 2001-04-13 08:09:50 +0000 | [diff] [blame] | 126 | seps += 1 |
| 127 | return result+spaces,seps |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 128 | |
| 129 | def format(f,val,grouping=0): |
| 130 | """Formats a value in the same way that the % formatting would use, |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 131 | but takes the current locale into account. |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 132 | Grouping is applied if the third parameter is true.""" |
Martin v. Löwis | 88ad12a | 2001-04-13 08:09:50 +0000 | [diff] [blame] | 133 | result = f % val |
Martin v. Löwis | db78687 | 2001-01-21 18:52:33 +0000 | [diff] [blame] | 134 | fields = result.split(".") |
Martin v. Löwis | 88ad12a | 2001-04-13 08:09:50 +0000 | [diff] [blame] | 135 | seps = 0 |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 136 | if grouping: |
Martin v. Löwis | 88ad12a | 2001-04-13 08:09:50 +0000 | [diff] [blame] | 137 | fields[0],seps=_group(fields[0]) |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 138 | if len(fields)==2: |
Martin v. Löwis | 88ad12a | 2001-04-13 08:09:50 +0000 | [diff] [blame] | 139 | result = fields[0]+localeconv()['decimal_point']+fields[1] |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 140 | elif len(fields)==1: |
Martin v. Löwis | 88ad12a | 2001-04-13 08:09:50 +0000 | [diff] [blame] | 141 | result = fields[0] |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 142 | else: |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 143 | raise Error, "Too many decimal points in result string" |
| 144 | |
Martin v. Löwis | 88ad12a | 2001-04-13 08:09:50 +0000 | [diff] [blame] | 145 | while seps: |
| 146 | # If the number was formatted for a specific width, then it |
| 147 | # might have been filled with spaces to the left or right. If |
| 148 | # so, kill as much spaces as there where separators. |
| 149 | # Leading zeroes as fillers are not yet dealt with, as it is |
| 150 | # not clear how they should interact with grouping. |
| 151 | sp = result.find(" ") |
| 152 | if sp==-1:break |
| 153 | result = result[:sp]+result[sp+1:] |
| 154 | seps -= 1 |
| 155 | |
| 156 | return result |
Martin v. Löwis | db78687 | 2001-01-21 18:52:33 +0000 | [diff] [blame] | 157 | |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 158 | def str(val): |
| 159 | """Convert float to integer, taking the locale into account.""" |
| 160 | return format("%.12g",val) |
| 161 | |
Brett Cannon | aaeffaf | 2004-03-23 23:50:17 +0000 | [diff] [blame] | 162 | def atof(string,func=float): |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 163 | "Parses a string as a float according to the locale settings." |
| 164 | #First, get rid of the grouping |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 165 | ts = localeconv()['thousands_sep'] |
| 166 | if ts: |
Skip Montanaro | 249369c | 2004-04-10 16:39:32 +0000 | [diff] [blame] | 167 | string = string.replace(ts, '') |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 168 | #next, replace the decimal point with a dot |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 169 | dd = localeconv()['decimal_point'] |
| 170 | if dd: |
Skip Montanaro | 249369c | 2004-04-10 16:39:32 +0000 | [diff] [blame] | 171 | string = string.replace(dd, '.') |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 172 | #finally, parse the string |
Skip Montanaro | 249369c | 2004-04-10 16:39:32 +0000 | [diff] [blame] | 173 | return func(string) |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 174 | |
| 175 | def atoi(str): |
| 176 | "Converts a string to an integer according to the locale settings." |
Eric S. Raymond | be9b507 | 2001-02-09 10:48:30 +0000 | [diff] [blame] | 177 | return atof(str, int) |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 178 | |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 179 | def _test(): |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 180 | setlocale(LC_ALL, "") |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 181 | #do grouping |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 182 | s1=format("%d", 123456789,1) |
| 183 | print s1, "is", atoi(s1) |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 184 | #standard formatting |
| 185 | s1=str(3.14) |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 186 | print s1, "is", atof(s1) |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 187 | |
| 188 | ### Locale name aliasing engine |
| 189 | |
| 190 | # Author: Marc-Andre Lemburg, mal@lemburg.com |
Fredrik Lundh | 37a0982 | 2002-10-19 20:19:10 +0000 | [diff] [blame] | 191 | # Various tweaks by Fredrik Lundh <fredrik@pythonware.com> |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 192 | |
| 193 | # store away the low-level version of setlocale (it's |
| 194 | # overridden below) |
| 195 | _setlocale = setlocale |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 196 | |
| 197 | def normalize(localename): |
| 198 | |
| 199 | """ Returns a normalized locale code for the given locale |
| 200 | name. |
| 201 | |
| 202 | The returned locale code is formatted for use with |
| 203 | setlocale(). |
| 204 | |
| 205 | If normalization fails, the original name is returned |
| 206 | unchanged. |
| 207 | |
| 208 | If the given encoding is not known, the function defaults to |
| 209 | the default encoding for the locale code just like setlocale() |
| 210 | does. |
| 211 | |
| 212 | """ |
| 213 | # Normalize the locale name and extract the encoding |
Eric S. Raymond | be9b507 | 2001-02-09 10:48:30 +0000 | [diff] [blame] | 214 | fullname = localename.lower() |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 215 | if ':' in fullname: |
| 216 | # ':' is sometimes used as encoding delimiter. |
Eric S. Raymond | be9b507 | 2001-02-09 10:48:30 +0000 | [diff] [blame] | 217 | fullname = fullname.replace(':', '.') |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 218 | if '.' in fullname: |
Eric S. Raymond | be9b507 | 2001-02-09 10:48:30 +0000 | [diff] [blame] | 219 | langname, encoding = fullname.split('.')[:2] |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 220 | fullname = langname + '.' + encoding |
| 221 | else: |
| 222 | langname = fullname |
| 223 | encoding = '' |
| 224 | |
| 225 | # First lookup: fullname (possibly with encoding) |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 226 | norm_encoding = encoding.replace('-', '') |
| 227 | norm_encoding = norm_encoding.replace('_', '') |
| 228 | lookup_name = langname + '.' + encoding |
| 229 | code = locale_alias.get(lookup_name, None) |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 230 | if code is not None: |
| 231 | return code |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 232 | #print 'first lookup failed' |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 233 | |
| 234 | # Second try: langname (without encoding) |
| 235 | code = locale_alias.get(langname, None) |
| 236 | if code is not None: |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 237 | #print 'langname lookup succeeded' |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 238 | if '.' in code: |
Eric S. Raymond | be9b507 | 2001-02-09 10:48:30 +0000 | [diff] [blame] | 239 | langname, defenc = code.split('.') |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 240 | else: |
| 241 | langname = code |
| 242 | defenc = '' |
| 243 | if encoding: |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 244 | # Convert the encoding to a C lib compatible encoding string |
| 245 | norm_encoding = encodings.normalize_encoding(encoding) |
| 246 | #print 'norm encoding: %r' % norm_encoding |
| 247 | norm_encoding = encodings.aliases.aliases.get(norm_encoding, |
| 248 | norm_encoding) |
| 249 | #print 'aliased encoding: %r' % norm_encoding |
| 250 | encoding = locale_encoding_alias.get(norm_encoding, |
| 251 | norm_encoding) |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 252 | else: |
| 253 | encoding = defenc |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 254 | #print 'found encoding %r' % encoding |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 255 | if encoding: |
| 256 | return langname + '.' + encoding |
| 257 | else: |
| 258 | return langname |
| 259 | |
| 260 | else: |
| 261 | return localename |
| 262 | |
| 263 | def _parse_localename(localename): |
| 264 | |
| 265 | """ Parses the locale code for localename and returns the |
| 266 | result as tuple (language code, encoding). |
| 267 | |
| 268 | The localename is normalized and passed through the locale |
| 269 | alias engine. A ValueError is raised in case the locale name |
| 270 | cannot be parsed. |
| 271 | |
| 272 | The language code corresponds to RFC 1766. code and encoding |
| 273 | can be None in case the values cannot be determined or are |
Jeremy Hylton | a05e293 | 2000-06-28 14:48:01 +0000 | [diff] [blame] | 274 | unknown to this implementation. |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 275 | |
| 276 | """ |
| 277 | code = normalize(localename) |
Martin v. Löwis | f0a4668 | 2002-11-03 17:20:12 +0000 | [diff] [blame] | 278 | if '@' in localename: |
| 279 | # Deal with locale modifiers |
| 280 | code, modifier = code.split('@') |
| 281 | if modifier == 'euro' and '.' not in code: |
| 282 | # Assume Latin-9 for @euro locales. This is bogus, |
| 283 | # since some systems may use other encodings for these |
| 284 | # locales. Also, we ignore other modifiers. |
| 285 | return code, 'iso-8859-15' |
Tim Peters | 230a60c | 2002-11-09 05:08:07 +0000 | [diff] [blame] | 286 | |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 287 | if '.' in code: |
Raymond Hettinger | 346e67f | 2005-01-01 06:10:26 +0000 | [diff] [blame] | 288 | return tuple(code.split('.')[:2]) |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 289 | elif code == 'C': |
| 290 | return None, None |
Andrew M. Kuchling | 1f877ef | 2001-08-13 14:50:44 +0000 | [diff] [blame] | 291 | raise ValueError, 'unknown locale: %s' % localename |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 292 | |
| 293 | def _build_localename(localetuple): |
| 294 | |
| 295 | """ Builds a locale code from the given tuple (language code, |
| 296 | encoding). |
| 297 | |
| 298 | No aliasing or normalizing takes place. |
| 299 | |
| 300 | """ |
| 301 | language, encoding = localetuple |
| 302 | if language is None: |
| 303 | language = 'C' |
| 304 | if encoding is None: |
| 305 | return language |
| 306 | else: |
| 307 | return language + '.' + encoding |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 308 | |
| 309 | def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')): |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 310 | |
| 311 | """ Tries to determine the default locale settings and returns |
| 312 | them as tuple (language code, encoding). |
| 313 | |
| 314 | According to POSIX, a program which has not called |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 315 | setlocale(LC_ALL, "") runs using the portable 'C' locale. |
| 316 | Calling setlocale(LC_ALL, "") lets it use the default locale as |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 317 | defined by the LANG variable. Since we don't want to interfere |
Thomas Wouters | 7e47402 | 2000-07-16 12:04:32 +0000 | [diff] [blame] | 318 | with the current locale setting we thus emulate the behavior |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 319 | in the way described above. |
| 320 | |
| 321 | To maintain compatibility with other platforms, not only the |
| 322 | LANG variable is tested, but a list of variables given as |
| 323 | envvars parameter. The first found to be defined will be |
| 324 | used. envvars defaults to the search path used in GNU gettext; |
| 325 | it must always contain the variable name 'LANG'. |
| 326 | |
| 327 | Except for the code 'C', the language code corresponds to RFC |
| 328 | 1766. code and encoding can be None in case the values cannot |
| 329 | be determined. |
| 330 | |
| 331 | """ |
Fredrik Lundh | 0466132 | 2000-07-09 23:16:10 +0000 | [diff] [blame] | 332 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 333 | try: |
| 334 | # check if it's supported by the _locale module |
| 335 | import _locale |
| 336 | code, encoding = _locale._getdefaultlocale() |
Fredrik Lundh | 0466132 | 2000-07-09 23:16:10 +0000 | [diff] [blame] | 337 | except (ImportError, AttributeError): |
| 338 | pass |
| 339 | else: |
Fredrik Lundh | 663809e | 2000-07-10 19:32:19 +0000 | [diff] [blame] | 340 | # make sure the code/encoding values are valid |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 341 | if sys.platform == "win32" and code and code[:2] == "0x": |
| 342 | # map windows language identifier to language name |
| 343 | code = windows_locale.get(int(code, 0)) |
Fredrik Lundh | 663809e | 2000-07-10 19:32:19 +0000 | [diff] [blame] | 344 | # ...add other platform-specific processing here, if |
| 345 | # necessary... |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 346 | return code, encoding |
Fredrik Lundh | 0466132 | 2000-07-09 23:16:10 +0000 | [diff] [blame] | 347 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 348 | # fall back on POSIX behaviour |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 349 | import os |
| 350 | lookup = os.environ.get |
| 351 | for variable in envvars: |
| 352 | localename = lookup(variable,None) |
Martin v. Löwis | c8ae31d | 2004-07-26 12:45:18 +0000 | [diff] [blame] | 353 | if localename: |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 354 | break |
| 355 | else: |
| 356 | localename = 'C' |
| 357 | return _parse_localename(localename) |
| 358 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 359 | |
| 360 | def getlocale(category=LC_CTYPE): |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 361 | |
| 362 | """ Returns the current setting for the given locale category as |
| 363 | tuple (language code, encoding). |
| 364 | |
| 365 | category may be one of the LC_* value except LC_ALL. It |
| 366 | defaults to LC_CTYPE. |
| 367 | |
| 368 | Except for the code 'C', the language code corresponds to RFC |
| 369 | 1766. code and encoding can be None in case the values cannot |
| 370 | be determined. |
| 371 | |
| 372 | """ |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 373 | localename = _setlocale(category) |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 374 | if category == LC_ALL and ';' in localename: |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 375 | raise TypeError, 'category LC_ALL is not supported' |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 376 | return _parse_localename(localename) |
| 377 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 378 | def setlocale(category, locale=None): |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 379 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 380 | """ Set the locale for the given category. The locale can be |
| 381 | a string, a locale tuple (language code, encoding), or None. |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 382 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 383 | Locale tuples are converted to strings the locale aliasing |
| 384 | engine. Locale strings are passed directly to the C lib. |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 385 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 386 | category may be given as one of the LC_* values. |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 387 | |
| 388 | """ |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 389 | if locale and type(locale) is not type(""): |
| 390 | # convert to string |
| 391 | locale = normalize(_build_localename(locale)) |
| 392 | return _setlocale(category, locale) |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 393 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 394 | def resetlocale(category=LC_ALL): |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 395 | |
| 396 | """ Sets the locale for category to the default setting. |
| 397 | |
| 398 | The default setting is determined by calling |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 399 | getdefaultlocale(). category defaults to LC_ALL. |
| 400 | |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 401 | """ |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 402 | _setlocale(category, _build_localename(getdefaultlocale())) |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 403 | |
Martin v. Löwis | f0a4668 | 2002-11-03 17:20:12 +0000 | [diff] [blame] | 404 | if sys.platform in ('win32', 'darwin', 'mac'): |
| 405 | # On Win32, this will return the ANSI code page |
| 406 | # On the Mac, it should return the system encoding; |
| 407 | # it might return "ascii" instead |
| 408 | def getpreferredencoding(do_setlocale = True): |
| 409 | """Return the charset that the user is likely using.""" |
| 410 | import _locale |
Tim Peters | a326f47 | 2002-11-05 03:49:09 +0000 | [diff] [blame] | 411 | return _locale._getdefaultlocale()[1] |
Martin v. Löwis | f0a4668 | 2002-11-03 17:20:12 +0000 | [diff] [blame] | 412 | else: |
| 413 | # On Unix, if CODESET is available, use that. |
| 414 | try: |
| 415 | CODESET |
| 416 | except NameError: |
| 417 | # Fall back to parsing environment variables :-( |
| 418 | def getpreferredencoding(do_setlocale = True): |
| 419 | """Return the charset that the user is likely using, |
| 420 | by looking at environment variables.""" |
| 421 | return getdefaultlocale()[1] |
| 422 | else: |
| 423 | def getpreferredencoding(do_setlocale = True): |
| 424 | """Return the charset that the user is likely using, |
| 425 | according to the system configuration.""" |
| 426 | if do_setlocale: |
| 427 | oldloc = setlocale(LC_CTYPE) |
| 428 | setlocale(LC_CTYPE, "") |
| 429 | result = nl_langinfo(CODESET) |
| 430 | setlocale(LC_CTYPE, oldloc) |
| 431 | return result |
| 432 | else: |
| 433 | return nl_langinfo(CODESET) |
Tim Peters | 230a60c | 2002-11-09 05:08:07 +0000 | [diff] [blame] | 434 | |
Martin v. Löwis | f0a4668 | 2002-11-03 17:20:12 +0000 | [diff] [blame] | 435 | |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 436 | ### Database |
| 437 | # |
| 438 | # The following data was extracted from the locale.alias file which |
| 439 | # comes with X11 and then hand edited removing the explicit encoding |
| 440 | # definitions and adding some more aliases. The file is usually |
| 441 | # available as /usr/lib/X11/locale/locale.alias. |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 442 | # |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 443 | |
| 444 | # |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 445 | # The local_encoding_alias table maps lowercase encoding alias names |
| 446 | # to C locale encoding names (case-sensitive). Note that normalize() |
| 447 | # first looks up the encoding in the encodings.aliases dictionary and |
| 448 | # then applies this mapping to find the correct C lib name for the |
| 449 | # encoding. |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 450 | # |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 451 | locale_encoding_alias = { |
| 452 | |
| 453 | # Mappings for non-standard encoding names used in locale names |
| 454 | '437': 'C', |
| 455 | 'c': 'C', |
| 456 | 'en': 'ISO8859-1', |
| 457 | 'jis': 'JIS7', |
| 458 | 'jis7': 'JIS7', |
| 459 | 'ajec': 'eucJP', |
| 460 | |
| 461 | # Mappings from Python codec names to C lib encoding names |
| 462 | 'ascii': 'ISO8859-1', |
| 463 | 'latin_1': 'ISO8859-1', |
| 464 | 'iso8859_1': 'ISO8859-1', |
| 465 | 'iso8859_10': 'ISO8859-10', |
| 466 | 'iso8859_11': 'ISO8859-11', |
| 467 | 'iso8859_13': 'ISO8859-13', |
| 468 | 'iso8859_14': 'ISO8859-14', |
| 469 | 'iso8859_15': 'ISO8859-15', |
| 470 | 'iso8859_2': 'ISO8859-2', |
| 471 | 'iso8859_3': 'ISO8859-3', |
| 472 | 'iso8859_4': 'ISO8859-4', |
| 473 | 'iso8859_5': 'ISO8859-5', |
| 474 | 'iso8859_6': 'ISO8859-6', |
| 475 | 'iso8859_7': 'ISO8859-7', |
| 476 | 'iso8859_8': 'ISO8859-8', |
| 477 | 'iso8859_9': 'ISO8859-9', |
| 478 | 'iso2022_jp': 'JIS7', |
| 479 | 'shift_jis': 'SJIS', |
| 480 | 'tactis': 'TACTIS', |
| 481 | 'euc_jp': 'eucJP', |
| 482 | 'euc_kr': 'eucKR', |
Marc-André Lemburg | b4cebd4 | 2004-12-13 19:56:01 +0000 | [diff] [blame] | 483 | 'utf_8': 'UTF8', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 484 | 'koi8_r': 'KOI8-R', |
| 485 | 'koi8_u': 'KOI8-U', |
| 486 | # XXX This list is still incomplete. If you know more |
| 487 | # mappings, please file a bug report. Thanks. |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 488 | } |
| 489 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 490 | # |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 491 | # The locale_alias table maps lowercase alias names to C locale names |
| 492 | # (case-sensitive). Encodings are always separated from the locale |
| 493 | # name using a dot ('.'); they should only be given in case the |
| 494 | # language name is needed to interpret the given encoding alias |
| 495 | # correctly (CJK codes often have this need). |
| 496 | # |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 497 | # Note that the normalize() function which uses this tables |
| 498 | # removes '_' and '-' characters from the encoding part of the |
| 499 | # locale name before doing the lookup. This saves a lot of |
| 500 | # space in the table. |
| 501 | # |
| 502 | # MAL 2004-12-10: |
| 503 | # Updated alias mapping to most recent locale.alias file |
| 504 | # from X.org distribution using makelocalealias.py. |
| 505 | # |
| 506 | # These are the differences compared to the old mapping (Python 2.4 |
| 507 | # and older): |
| 508 | # |
| 509 | # updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251' |
| 510 | # updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251' |
| 511 | # updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251' |
| 512 | # updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2' |
| 513 | # updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2' |
| 514 | # updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2' |
| 515 | # updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1' |
| 516 | # updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15' |
| 517 | # updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15' |
| 518 | # updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15' |
| 519 | # updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15' |
| 520 | # updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8' |
| 521 | # updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8' |
| 522 | # updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP' |
| 523 | # updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13' |
| 524 | # updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13' |
| 525 | # updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2' |
| 526 | # updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2' |
| 527 | # updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11' |
| 528 | # updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312' |
| 529 | # updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5' |
| 530 | # updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5' |
| 531 | # |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 532 | locale_alias = { |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 533 | 'a3': 'a3_AZ.KOI8-C', |
| 534 | 'a3_az': 'a3_AZ.KOI8-C', |
| 535 | 'a3_az.koi8c': 'a3_AZ.KOI8-C', |
| 536 | 'af': 'af_ZA.ISO8859-1', |
| 537 | 'af_za': 'af_ZA.ISO8859-1', |
| 538 | 'af_za.iso88591': 'af_ZA.ISO8859-1', |
| 539 | 'am': 'am_ET.UTF-8', |
| 540 | 'american': 'en_US.ISO8859-1', |
| 541 | 'american.iso88591': 'en_US.ISO8859-1', |
| 542 | 'ar': 'ar_AA.ISO8859-6', |
| 543 | 'ar_aa': 'ar_AA.ISO8859-6', |
| 544 | 'ar_aa.iso88596': 'ar_AA.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 545 | 'ar_ae': 'ar_AE.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 546 | 'ar_bh': 'ar_BH.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 547 | 'ar_dz': 'ar_DZ.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 548 | 'ar_eg': 'ar_EG.ISO8859-6', |
| 549 | 'ar_eg.iso88596': 'ar_EG.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 550 | 'ar_iq': 'ar_IQ.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 551 | 'ar_jo': 'ar_JO.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 552 | 'ar_kw': 'ar_KW.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 553 | 'ar_lb': 'ar_LB.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 554 | 'ar_ly': 'ar_LY.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 555 | 'ar_ma': 'ar_MA.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 556 | 'ar_om': 'ar_OM.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 557 | 'ar_qa': 'ar_QA.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 558 | 'ar_sa': 'ar_SA.ISO8859-6', |
| 559 | 'ar_sa.iso88596': 'ar_SA.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 560 | 'ar_sd': 'ar_SD.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 561 | 'ar_sy': 'ar_SY.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 562 | 'ar_tn': 'ar_TN.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 563 | 'ar_ye': 'ar_YE.ISO8859-6', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 564 | 'arabic': 'ar_AA.ISO8859-6', |
| 565 | 'arabic.iso88596': 'ar_AA.ISO8859-6', |
| 566 | 'az': 'az_AZ.ISO8859-9E', |
| 567 | 'az_az': 'az_AZ.ISO8859-9E', |
| 568 | 'az_az.iso88599e': 'az_AZ.ISO8859-9E', |
| 569 | 'be': 'be_BY.CP1251', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 570 | 'be_by': 'be_BY.CP1251', |
| 571 | 'be_by.cp1251': 'be_BY.CP1251', |
| 572 | 'be_by.microsoftcp1251': 'be_BY.CP1251', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 573 | 'bg': 'bg_BG.CP1251', |
| 574 | 'bg_bg': 'bg_BG.CP1251', |
| 575 | 'bg_bg.cp1251': 'bg_BG.CP1251', |
| 576 | 'bg_bg.iso88595': 'bg_BG.ISO8859-5', |
| 577 | 'bg_bg.koi8r': 'bg_BG.KOI8-R', |
| 578 | 'bg_bg.microsoftcp1251': 'bg_BG.CP1251', |
| 579 | 'bokmal': 'nb_NO.ISO8859-1', |
| 580 | 'bokm\xe5l': 'nb_NO.ISO8859-1', |
| 581 | 'br': 'br_FR.ISO8859-1', |
| 582 | 'br_fr': 'br_FR.ISO8859-1', |
| 583 | 'br_fr.iso88591': 'br_FR.ISO8859-1', |
| 584 | 'br_fr.iso885914': 'br_FR.ISO8859-14', |
| 585 | 'br_fr.iso885915': 'br_FR.ISO8859-15', |
| 586 | 'br_fr@euro': 'br_FR.ISO8859-15', |
| 587 | 'bulgarian': 'bg_BG.CP1251', |
| 588 | 'c': 'C', |
| 589 | 'c-french': 'fr_CA.ISO8859-1', |
| 590 | 'c-french.iso88591': 'fr_CA.ISO8859-1', |
| 591 | 'c.en': 'C', |
| 592 | 'c.iso88591': 'en_US.ISO8859-1', |
| 593 | 'c_c': 'C', |
| 594 | 'c_c.c': 'C', |
| 595 | 'ca': 'ca_ES.ISO8859-1', |
| 596 | 'ca_es': 'ca_ES.ISO8859-1', |
| 597 | 'ca_es.iso88591': 'ca_ES.ISO8859-1', |
| 598 | 'ca_es.iso885915': 'ca_ES.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 599 | 'ca_es@euro': 'ca_ES.ISO8859-15', |
| 600 | 'catalan': 'ca_ES.ISO8859-1', |
| 601 | 'cextend': 'en_US.ISO8859-1', |
| 602 | 'cextend.en': 'en_US.ISO8859-1', |
| 603 | 'chinese-s': 'zh_CN.eucCN', |
| 604 | 'chinese-t': 'zh_TW.eucTW', |
| 605 | 'croatian': 'hr_HR.ISO8859-2', |
| 606 | 'cs': 'cs_CZ.ISO8859-2', |
| 607 | 'cs_cs': 'cs_CZ.ISO8859-2', |
| 608 | 'cs_cs.iso88592': 'cs_CZ.ISO8859-2', |
| 609 | 'cs_cz': 'cs_CZ.ISO8859-2', |
| 610 | 'cs_cz.iso88592': 'cs_CZ.ISO8859-2', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 611 | 'cy': 'cy_GB.ISO8859-1', |
| 612 | 'cy_gb': 'cy_GB.ISO8859-1', |
| 613 | 'cy_gb.iso88591': 'cy_GB.ISO8859-1', |
| 614 | 'cy_gb.iso885914': 'cy_GB.ISO8859-14', |
| 615 | 'cy_gb.iso885915': 'cy_GB.ISO8859-15', |
| 616 | 'cy_gb@euro': 'cy_GB.ISO8859-15', |
| 617 | 'cz': 'cs_CZ.ISO8859-2', |
| 618 | 'cz_cz': 'cs_CZ.ISO8859-2', |
| 619 | 'czech': 'cs_CZ.ISO8859-2', |
| 620 | 'da': 'da_DK.ISO8859-1', |
| 621 | 'da_dk': 'da_DK.ISO8859-1', |
| 622 | 'da_dk.88591': 'da_DK.ISO8859-1', |
| 623 | 'da_dk.885915': 'da_DK.ISO8859-15', |
| 624 | 'da_dk.iso88591': 'da_DK.ISO8859-1', |
| 625 | 'da_dk.iso885915': 'da_DK.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 626 | 'da_dk@euro': 'da_DK.ISO8859-15', |
| 627 | 'danish': 'da_DK.ISO8859-1', |
| 628 | 'danish.iso88591': 'da_DK.ISO8859-1', |
| 629 | 'dansk': 'da_DK.ISO8859-1', |
| 630 | 'de': 'de_DE.ISO8859-1', |
| 631 | 'de_at': 'de_AT.ISO8859-1', |
| 632 | 'de_at.iso88591': 'de_AT.ISO8859-1', |
| 633 | 'de_at.iso885915': 'de_AT.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 634 | 'de_at@euro': 'de_AT.ISO8859-15', |
| 635 | 'de_be': 'de_BE.ISO8859-1', |
| 636 | 'de_be.iso88591': 'de_BE.ISO8859-1', |
| 637 | 'de_be.iso885915': 'de_BE.ISO8859-15', |
| 638 | 'de_be@euro': 'de_BE.ISO8859-15', |
| 639 | 'de_ch': 'de_CH.ISO8859-1', |
| 640 | 'de_ch.iso88591': 'de_CH.ISO8859-1', |
| 641 | 'de_ch.iso885915': 'de_CH.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 642 | 'de_ch@euro': 'de_CH.ISO8859-15', |
| 643 | 'de_de': 'de_DE.ISO8859-1', |
| 644 | 'de_de.88591': 'de_DE.ISO8859-1', |
| 645 | 'de_de.885915': 'de_DE.ISO8859-15', |
| 646 | 'de_de.885915@euro': 'de_DE.ISO8859-15', |
| 647 | 'de_de.iso88591': 'de_DE.ISO8859-1', |
| 648 | 'de_de.iso885915': 'de_DE.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 649 | 'de_de@euro': 'de_DE.ISO8859-15', |
| 650 | 'de_lu': 'de_LU.ISO8859-1', |
| 651 | 'de_lu.iso88591': 'de_LU.ISO8859-1', |
| 652 | 'de_lu.iso885915': 'de_LU.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 653 | 'de_lu@euro': 'de_LU.ISO8859-15', |
| 654 | 'deutsch': 'de_DE.ISO8859-1', |
| 655 | 'dutch': 'nl_NL.ISO8859-1', |
| 656 | 'dutch.iso88591': 'nl_BE.ISO8859-1', |
| 657 | 'ee': 'ee_EE.ISO8859-4', |
| 658 | 'ee_ee': 'ee_EE.ISO8859-4', |
| 659 | 'ee_ee.iso88594': 'ee_EE.ISO8859-4', |
| 660 | 'eesti': 'et_EE.ISO8859-1', |
| 661 | 'el': 'el_GR.ISO8859-7', |
| 662 | 'el_gr': 'el_GR.ISO8859-7', |
| 663 | 'el_gr.iso88597': 'el_GR.ISO8859-7', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 664 | 'el_gr@euro': 'el_GR.ISO8859-15', |
| 665 | 'en': 'en_US.ISO8859-1', |
| 666 | 'en.iso88591': 'en_US.ISO8859-1', |
| 667 | 'en_au': 'en_AU.ISO8859-1', |
| 668 | 'en_au.iso88591': 'en_AU.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 669 | 'en_be': 'en_BE.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 670 | 'en_be@euro': 'en_BE.ISO8859-15', |
| 671 | 'en_bw': 'en_BW.ISO8859-1', |
| 672 | 'en_ca': 'en_CA.ISO8859-1', |
| 673 | 'en_ca.iso88591': 'en_CA.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 674 | 'en_gb': 'en_GB.ISO8859-1', |
| 675 | 'en_gb.88591': 'en_GB.ISO8859-1', |
| 676 | 'en_gb.iso88591': 'en_GB.ISO8859-1', |
| 677 | 'en_gb.iso885915': 'en_GB.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 678 | 'en_gb@euro': 'en_GB.ISO8859-15', |
| 679 | 'en_hk': 'en_HK.ISO8859-1', |
| 680 | 'en_ie': 'en_IE.ISO8859-1', |
| 681 | 'en_ie.iso88591': 'en_IE.ISO8859-1', |
| 682 | 'en_ie.iso885915': 'en_IE.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 683 | 'en_ie@euro': 'en_IE.ISO8859-15', |
| 684 | 'en_in': 'en_IN.ISO8859-1', |
| 685 | 'en_nz': 'en_NZ.ISO8859-1', |
| 686 | 'en_nz.iso88591': 'en_NZ.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 687 | 'en_ph': 'en_PH.ISO8859-1', |
| 688 | 'en_sg': 'en_SG.ISO8859-1', |
| 689 | 'en_uk': 'en_GB.ISO8859-1', |
| 690 | 'en_us': 'en_US.ISO8859-1', |
| 691 | 'en_us.88591': 'en_US.ISO8859-1', |
| 692 | 'en_us.885915': 'en_US.ISO8859-15', |
| 693 | 'en_us.iso88591': 'en_US.ISO8859-1', |
| 694 | 'en_us.iso885915': 'en_US.ISO8859-15', |
| 695 | 'en_us.iso885915@euro': 'en_US.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 696 | 'en_us@euro': 'en_US.ISO8859-15', |
| 697 | 'en_us@euro@euro': 'en_US.ISO8859-15', |
| 698 | 'en_za': 'en_ZA.ISO8859-1', |
| 699 | 'en_za.88591': 'en_ZA.ISO8859-1', |
| 700 | 'en_za.iso88591': 'en_ZA.ISO8859-1', |
| 701 | 'en_za.iso885915': 'en_ZA.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 702 | 'en_za@euro': 'en_ZA.ISO8859-15', |
| 703 | 'en_zw': 'en_ZW.ISO8859-1', |
| 704 | 'eng_gb': 'en_GB.ISO8859-1', |
| 705 | 'eng_gb.8859': 'en_GB.ISO8859-1', |
| 706 | 'english': 'en_EN.ISO8859-1', |
| 707 | 'english.iso88591': 'en_EN.ISO8859-1', |
| 708 | 'english_uk': 'en_GB.ISO8859-1', |
| 709 | 'english_uk.8859': 'en_GB.ISO8859-1', |
| 710 | 'english_united-states': 'en_US.ISO8859-1', |
| 711 | 'english_united-states.437': 'C', |
| 712 | 'english_us': 'en_US.ISO8859-1', |
| 713 | 'english_us.8859': 'en_US.ISO8859-1', |
| 714 | 'english_us.ascii': 'en_US.ISO8859-1', |
| 715 | 'eo': 'eo_XX.ISO8859-3', |
| 716 | 'eo_eo': 'eo_EO.ISO8859-3', |
| 717 | 'eo_eo.iso88593': 'eo_EO.ISO8859-3', |
| 718 | 'eo_xx': 'eo_XX.ISO8859-3', |
| 719 | 'eo_xx.iso88593': 'eo_XX.ISO8859-3', |
| 720 | 'es': 'es_ES.ISO8859-1', |
| 721 | 'es_ar': 'es_AR.ISO8859-1', |
| 722 | 'es_ar.iso88591': 'es_AR.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 723 | 'es_bo': 'es_BO.ISO8859-1', |
| 724 | 'es_bo.iso88591': 'es_BO.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 725 | 'es_cl': 'es_CL.ISO8859-1', |
| 726 | 'es_cl.iso88591': 'es_CL.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 727 | 'es_co': 'es_CO.ISO8859-1', |
| 728 | 'es_co.iso88591': 'es_CO.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 729 | 'es_cr': 'es_CR.ISO8859-1', |
| 730 | 'es_cr.iso88591': 'es_CR.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 731 | 'es_do': 'es_DO.ISO8859-1', |
| 732 | 'es_do.iso88591': 'es_DO.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 733 | 'es_ec': 'es_EC.ISO8859-1', |
| 734 | 'es_ec.iso88591': 'es_EC.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 735 | 'es_es': 'es_ES.ISO8859-1', |
| 736 | 'es_es.88591': 'es_ES.ISO8859-1', |
| 737 | 'es_es.iso88591': 'es_ES.ISO8859-1', |
| 738 | 'es_es.iso885915': 'es_ES.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 739 | 'es_es@euro': 'es_ES.ISO8859-15', |
| 740 | 'es_gt': 'es_GT.ISO8859-1', |
| 741 | 'es_gt.iso88591': 'es_GT.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 742 | 'es_hn': 'es_HN.ISO8859-1', |
| 743 | 'es_hn.iso88591': 'es_HN.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 744 | 'es_mx': 'es_MX.ISO8859-1', |
| 745 | 'es_mx.iso88591': 'es_MX.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 746 | 'es_ni': 'es_NI.ISO8859-1', |
| 747 | 'es_ni.iso88591': 'es_NI.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 748 | 'es_pa': 'es_PA.ISO8859-1', |
| 749 | 'es_pa.iso88591': 'es_PA.ISO8859-1', |
| 750 | 'es_pa.iso885915': 'es_PA.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 751 | 'es_pa@euro': 'es_PA.ISO8859-15', |
| 752 | 'es_pe': 'es_PE.ISO8859-1', |
| 753 | 'es_pe.iso88591': 'es_PE.ISO8859-1', |
| 754 | 'es_pe.iso885915': 'es_PE.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 755 | 'es_pe@euro': 'es_PE.ISO8859-15', |
| 756 | 'es_pr': 'es_PR.ISO8859-1', |
| 757 | 'es_pr.iso88591': 'es_PR.ISO8859-1', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 758 | 'es_py': 'es_PY.ISO8859-1', |
| 759 | 'es_py.iso88591': 'es_PY.ISO8859-1', |
| 760 | 'es_py.iso885915': 'es_PY.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 761 | 'es_py@euro': 'es_PY.ISO8859-15', |
| 762 | 'es_sv': 'es_SV.ISO8859-1', |
| 763 | 'es_sv.iso88591': 'es_SV.ISO8859-1', |
| 764 | 'es_sv.iso885915': 'es_SV.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 765 | 'es_sv@euro': 'es_SV.ISO8859-15', |
| 766 | 'es_us': 'es_US.ISO8859-1', |
| 767 | 'es_uy': 'es_UY.ISO8859-1', |
| 768 | 'es_uy.iso88591': 'es_UY.ISO8859-1', |
| 769 | 'es_uy.iso885915': 'es_UY.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 770 | 'es_uy@euro': 'es_UY.ISO8859-15', |
| 771 | 'es_ve': 'es_VE.ISO8859-1', |
| 772 | 'es_ve.iso88591': 'es_VE.ISO8859-1', |
| 773 | 'es_ve.iso885915': 'es_VE.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 774 | 'es_ve@euro': 'es_VE.ISO8859-15', |
| 775 | 'estonian': 'et_EE.ISO8859-1', |
| 776 | 'et': 'et_EE.ISO8859-15', |
| 777 | 'et_ee': 'et_EE.ISO8859-15', |
| 778 | 'et_ee.iso88591': 'et_EE.ISO8859-1', |
| 779 | 'et_ee.iso885913': 'et_EE.ISO8859-13', |
| 780 | 'et_ee.iso885915': 'et_EE.ISO8859-15', |
| 781 | 'et_ee.iso88594': 'et_EE.ISO8859-4', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 782 | 'et_ee@euro': 'et_EE.ISO8859-15', |
| 783 | 'eu': 'eu_ES.ISO8859-1', |
| 784 | 'eu_es': 'eu_ES.ISO8859-1', |
| 785 | 'eu_es.iso88591': 'eu_ES.ISO8859-1', |
| 786 | 'eu_es.iso885915': 'eu_ES.ISO8859-15', |
| 787 | 'eu_es@euro': 'eu_ES.ISO8859-15', |
| 788 | 'fa': 'fa_IR.UTF-8', |
| 789 | 'fa_ir': 'fa_IR.UTF-8', |
| 790 | 'fa_ir.isiri3342': 'fa_IR.ISIRI-3342', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 791 | 'fi': 'fi_FI.ISO8859-15', |
| 792 | 'fi_fi': 'fi_FI.ISO8859-15', |
| 793 | 'fi_fi.88591': 'fi_FI.ISO8859-1', |
| 794 | 'fi_fi.iso88591': 'fi_FI.ISO8859-1', |
| 795 | 'fi_fi.iso885915': 'fi_FI.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 796 | 'fi_fi.utf8@euro': 'fi_FI.UTF-8', |
| 797 | 'fi_fi@euro': 'fi_FI.ISO8859-15', |
| 798 | 'finnish': 'fi_FI.ISO8859-1', |
| 799 | 'finnish.iso88591': 'fi_FI.ISO8859-1', |
| 800 | 'fo': 'fo_FO.ISO8859-1', |
| 801 | 'fo_fo': 'fo_FO.ISO8859-1', |
| 802 | 'fo_fo.iso88591': 'fo_FO.ISO8859-1', |
| 803 | 'fo_fo.iso885915': 'fo_FO.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 804 | 'fo_fo@euro': 'fo_FO.ISO8859-15', |
| 805 | 'fr': 'fr_FR.ISO8859-1', |
| 806 | 'fr_be': 'fr_BE.ISO8859-1', |
| 807 | 'fr_be.88591': 'fr_BE.ISO8859-1', |
| 808 | 'fr_be.iso88591': 'fr_BE.ISO8859-1', |
| 809 | 'fr_be.iso885915': 'fr_BE.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 810 | 'fr_be@euro': 'fr_BE.ISO8859-15', |
| 811 | 'fr_ca': 'fr_CA.ISO8859-1', |
| 812 | 'fr_ca.88591': 'fr_CA.ISO8859-1', |
| 813 | 'fr_ca.iso88591': 'fr_CA.ISO8859-1', |
| 814 | 'fr_ca.iso885915': 'fr_CA.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 815 | 'fr_ca@euro': 'fr_CA.ISO8859-15', |
| 816 | 'fr_ch': 'fr_CH.ISO8859-1', |
| 817 | 'fr_ch.88591': 'fr_CH.ISO8859-1', |
| 818 | 'fr_ch.iso88591': 'fr_CH.ISO8859-1', |
| 819 | 'fr_ch.iso885915': 'fr_CH.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 820 | 'fr_ch@euro': 'fr_CH.ISO8859-15', |
| 821 | 'fr_fr': 'fr_FR.ISO8859-1', |
| 822 | 'fr_fr.88591': 'fr_FR.ISO8859-1', |
| 823 | 'fr_fr.iso88591': 'fr_FR.ISO8859-1', |
| 824 | 'fr_fr.iso885915': 'fr_FR.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 825 | 'fr_fr@euro': 'fr_FR.ISO8859-15', |
| 826 | 'fr_lu': 'fr_LU.ISO8859-1', |
| 827 | 'fr_lu.88591': 'fr_LU.ISO8859-1', |
| 828 | 'fr_lu.iso88591': 'fr_LU.ISO8859-1', |
| 829 | 'fr_lu.iso885915': 'fr_LU.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 830 | 'fr_lu@euro': 'fr_LU.ISO8859-15', |
| 831 | 'fran\xe7ais': 'fr_FR.ISO8859-1', |
| 832 | 'fre_fr': 'fr_FR.ISO8859-1', |
| 833 | 'fre_fr.8859': 'fr_FR.ISO8859-1', |
| 834 | 'french': 'fr_FR.ISO8859-1', |
| 835 | 'french.iso88591': 'fr_CH.ISO8859-1', |
| 836 | 'french_france': 'fr_FR.ISO8859-1', |
| 837 | 'french_france.8859': 'fr_FR.ISO8859-1', |
| 838 | 'ga': 'ga_IE.ISO8859-1', |
| 839 | 'ga_ie': 'ga_IE.ISO8859-1', |
| 840 | 'ga_ie.iso88591': 'ga_IE.ISO8859-1', |
| 841 | 'ga_ie.iso885914': 'ga_IE.ISO8859-14', |
| 842 | 'ga_ie.iso885915': 'ga_IE.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 843 | 'ga_ie@euro': 'ga_IE.ISO8859-15', |
| 844 | 'galego': 'gl_ES.ISO8859-1', |
| 845 | 'galician': 'gl_ES.ISO8859-1', |
| 846 | 'gd': 'gd_GB.ISO8859-1', |
| 847 | 'gd_gb': 'gd_GB.ISO8859-1', |
| 848 | 'gd_gb.iso88591': 'gd_GB.ISO8859-1', |
| 849 | 'gd_gb.iso885914': 'gd_GB.ISO8859-14', |
| 850 | 'gd_gb.iso885915': 'gd_GB.ISO8859-15', |
| 851 | 'gd_gb@euro': 'gd_GB.ISO8859-15', |
| 852 | 'ger_de': 'de_DE.ISO8859-1', |
| 853 | 'ger_de.8859': 'de_DE.ISO8859-1', |
| 854 | 'german': 'de_DE.ISO8859-1', |
| 855 | 'german.iso88591': 'de_CH.ISO8859-1', |
| 856 | 'german_germany': 'de_DE.ISO8859-1', |
| 857 | 'german_germany.8859': 'de_DE.ISO8859-1', |
| 858 | 'gl': 'gl_ES.ISO8859-1', |
| 859 | 'gl_es': 'gl_ES.ISO8859-1', |
| 860 | 'gl_es.iso88591': 'gl_ES.ISO8859-1', |
| 861 | 'gl_es.iso885915': 'gl_ES.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 862 | 'gl_es@euro': 'gl_ES.ISO8859-15', |
| 863 | 'greek': 'el_GR.ISO8859-7', |
| 864 | 'greek.iso88597': 'el_GR.ISO8859-7', |
| 865 | 'gv': 'gv_GB.ISO8859-1', |
| 866 | 'gv_gb': 'gv_GB.ISO8859-1', |
| 867 | 'gv_gb.iso88591': 'gv_GB.ISO8859-1', |
| 868 | 'gv_gb.iso885914': 'gv_GB.ISO8859-14', |
| 869 | 'gv_gb.iso885915': 'gv_GB.ISO8859-15', |
| 870 | 'gv_gb@euro': 'gv_GB.ISO8859-15', |
| 871 | 'he': 'he_IL.ISO8859-8', |
| 872 | 'he_il': 'he_IL.ISO8859-8', |
| 873 | 'he_il.cp1255': 'he_IL.CP1255', |
| 874 | 'he_il.iso88598': 'he_IL.ISO8859-8', |
| 875 | 'he_il.microsoftcp1255': 'he_IL.CP1255', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 876 | 'hebrew': 'iw_IL.ISO8859-8', |
| 877 | 'hebrew.iso88598': 'iw_IL.ISO8859-8', |
| 878 | 'hi': 'hi_IN.ISCII-DEV', |
| 879 | 'hi_in': 'hi_IN.ISCII-DEV', |
| 880 | 'hi_in.isciidev': 'hi_IN.ISCII-DEV', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 881 | 'hr': 'hr_HR.ISO8859-2', |
| 882 | 'hr_hr': 'hr_HR.ISO8859-2', |
| 883 | 'hr_hr.iso88592': 'hr_HR.ISO8859-2', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 884 | 'hrvatski': 'hr_HR.ISO8859-2', |
| 885 | 'hu': 'hu_HU.ISO8859-2', |
| 886 | 'hu_hu': 'hu_HU.ISO8859-2', |
| 887 | 'hu_hu.iso88592': 'hu_HU.ISO8859-2', |
| 888 | 'hungarian': 'hu_HU.ISO8859-2', |
| 889 | 'icelandic': 'is_IS.ISO8859-1', |
| 890 | 'icelandic.iso88591': 'is_IS.ISO8859-1', |
| 891 | 'id': 'id_ID.ISO8859-1', |
| 892 | 'id_id': 'id_ID.ISO8859-1', |
| 893 | 'in': 'id_ID.ISO8859-1', |
| 894 | 'in_id': 'id_ID.ISO8859-1', |
| 895 | 'is': 'is_IS.ISO8859-1', |
| 896 | 'is_is': 'is_IS.ISO8859-1', |
| 897 | 'is_is.iso88591': 'is_IS.ISO8859-1', |
| 898 | 'is_is.iso885915': 'is_IS.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 899 | 'is_is@euro': 'is_IS.ISO8859-15', |
| 900 | 'iso-8859-1': 'en_US.ISO8859-1', |
| 901 | 'iso-8859-15': 'en_US.ISO8859-15', |
| 902 | 'iso8859-1': 'en_US.ISO8859-1', |
| 903 | 'iso8859-15': 'en_US.ISO8859-15', |
| 904 | 'iso_8859_1': 'en_US.ISO8859-1', |
| 905 | 'iso_8859_15': 'en_US.ISO8859-15', |
| 906 | 'it': 'it_IT.ISO8859-1', |
| 907 | 'it_ch': 'it_CH.ISO8859-1', |
| 908 | 'it_ch.iso88591': 'it_CH.ISO8859-1', |
| 909 | 'it_ch.iso885915': 'it_CH.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 910 | 'it_ch@euro': 'it_CH.ISO8859-15', |
| 911 | 'it_it': 'it_IT.ISO8859-1', |
| 912 | 'it_it.88591': 'it_IT.ISO8859-1', |
| 913 | 'it_it.iso88591': 'it_IT.ISO8859-1', |
| 914 | 'it_it.iso885915': 'it_IT.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 915 | 'it_it@euro': 'it_IT.ISO8859-15', |
| 916 | 'italian': 'it_IT.ISO8859-1', |
| 917 | 'italian.iso88591': 'it_IT.ISO8859-1', |
| 918 | 'iu': 'iu_CA.NUNACOM-8', |
| 919 | 'iu_ca': 'iu_CA.NUNACOM-8', |
| 920 | 'iu_ca.nunacom8': 'iu_CA.NUNACOM-8', |
| 921 | 'iw': 'he_IL.ISO8859-8', |
| 922 | 'iw_il': 'he_IL.ISO8859-8', |
| 923 | 'iw_il.iso88598': 'he_IL.ISO8859-8', |
| 924 | 'ja': 'ja_JP.eucJP', |
| 925 | 'ja.jis': 'ja_JP.JIS7', |
| 926 | 'ja.sjis': 'ja_JP.SJIS', |
| 927 | 'ja_jp': 'ja_JP.eucJP', |
| 928 | 'ja_jp.ajec': 'ja_JP.eucJP', |
| 929 | 'ja_jp.euc': 'ja_JP.eucJP', |
| 930 | 'ja_jp.eucjp': 'ja_JP.eucJP', |
| 931 | 'ja_jp.iso-2022-jp': 'ja_JP.JIS7', |
| 932 | 'ja_jp.iso2022jp': 'ja_JP.JIS7', |
| 933 | 'ja_jp.jis': 'ja_JP.JIS7', |
| 934 | 'ja_jp.jis7': 'ja_JP.JIS7', |
| 935 | 'ja_jp.mscode': 'ja_JP.SJIS', |
| 936 | 'ja_jp.sjis': 'ja_JP.SJIS', |
| 937 | 'ja_jp.ujis': 'ja_JP.eucJP', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 938 | 'japan': 'ja_JP.eucJP', |
| 939 | 'japanese': 'ja_JP.eucJP', |
| 940 | 'japanese-euc': 'ja_JP.eucJP', |
| 941 | 'japanese.euc': 'ja_JP.eucJP', |
| 942 | 'japanese.sjis': 'ja_JP.SJIS', |
| 943 | 'jp_jp': 'ja_JP.eucJP', |
| 944 | 'ka': 'ka_GE.GEORGIAN-ACADEMY', |
| 945 | 'ka_ge': 'ka_GE.GEORGIAN-ACADEMY', |
| 946 | 'ka_ge.georgianacademy': 'ka_GE.GEORGIAN-ACADEMY', |
| 947 | 'ka_ge.georgianps': 'ka_GE.GEORGIAN-PS', |
| 948 | 'ka_ge.georgianrs': 'ka_GE.GEORGIAN-ACADEMY', |
| 949 | 'kl': 'kl_GL.ISO8859-1', |
| 950 | 'kl_gl': 'kl_GL.ISO8859-1', |
| 951 | 'kl_gl.iso88591': 'kl_GL.ISO8859-1', |
| 952 | 'kl_gl.iso885915': 'kl_GL.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 953 | 'kl_gl@euro': 'kl_GL.ISO8859-15', |
| 954 | 'ko': 'ko_KR.eucKR', |
| 955 | 'ko_kr': 'ko_KR.eucKR', |
| 956 | 'ko_kr.euc': 'ko_KR.eucKR', |
| 957 | 'ko_kr.euckr': 'ko_KR.eucKR', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 958 | 'korean': 'ko_KR.eucKR', |
| 959 | 'korean.euc': 'ko_KR.eucKR', |
| 960 | 'kw': 'kw_GB.ISO8859-1', |
| 961 | 'kw_gb': 'kw_GB.ISO8859-1', |
| 962 | 'kw_gb.iso88591': 'kw_GB.ISO8859-1', |
| 963 | 'kw_gb.iso885914': 'kw_GB.ISO8859-14', |
| 964 | 'kw_gb.iso885915': 'kw_GB.ISO8859-15', |
| 965 | 'kw_gb@euro': 'kw_GB.ISO8859-15', |
| 966 | 'lithuanian': 'lt_LT.ISO8859-13', |
| 967 | 'lo': 'lo_LA.MULELAO-1', |
| 968 | 'lo_la': 'lo_LA.MULELAO-1', |
| 969 | 'lo_la.cp1133': 'lo_LA.IBM-CP1133', |
| 970 | 'lo_la.ibmcp1133': 'lo_LA.IBM-CP1133', |
| 971 | 'lo_la.mulelao1': 'lo_LA.MULELAO-1', |
| 972 | 'lt': 'lt_LT.ISO8859-13', |
| 973 | 'lt_lt': 'lt_LT.ISO8859-13', |
| 974 | 'lt_lt.iso885913': 'lt_LT.ISO8859-13', |
| 975 | 'lt_lt.iso88594': 'lt_LT.ISO8859-4', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 976 | 'lv': 'lv_LV.ISO8859-13', |
| 977 | 'lv_lv': 'lv_LV.ISO8859-13', |
| 978 | 'lv_lv.iso885913': 'lv_LV.ISO8859-13', |
| 979 | 'lv_lv.iso88594': 'lv_LV.ISO8859-4', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 980 | 'mi': 'mi_NZ.ISO8859-1', |
| 981 | 'mi_nz': 'mi_NZ.ISO8859-1', |
| 982 | 'mi_nz.iso88591': 'mi_NZ.ISO8859-1', |
| 983 | 'mk': 'mk_MK.ISO8859-5', |
| 984 | 'mk_mk': 'mk_MK.ISO8859-5', |
| 985 | 'mk_mk.cp1251': 'mk_MK.CP1251', |
| 986 | 'mk_mk.iso88595': 'mk_MK.ISO8859-5', |
| 987 | 'mk_mk.microsoftcp1251': 'mk_MK.CP1251', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 988 | 'ms': 'ms_MY.ISO8859-1', |
| 989 | 'ms_my': 'ms_MY.ISO8859-1', |
| 990 | 'ms_my.iso88591': 'ms_MY.ISO8859-1', |
| 991 | 'mt': 'mt_MT.ISO8859-3', |
| 992 | 'mt_mt': 'mt_MT.ISO8859-3', |
| 993 | 'mt_mt.iso88593': 'mt_MT.ISO8859-3', |
| 994 | 'nb': 'nb_NO.ISO8859-1', |
| 995 | 'nb_no': 'nb_NO.ISO8859-1', |
| 996 | 'nb_no.88591': 'nb_NO.ISO8859-1', |
| 997 | 'nb_no.iso88591': 'nb_NO.ISO8859-1', |
| 998 | 'nb_no.iso885915': 'nb_NO.ISO8859-15', |
| 999 | 'nb_no@euro': 'nb_NO.ISO8859-15', |
| 1000 | 'nl': 'nl_NL.ISO8859-1', |
| 1001 | 'nl_be': 'nl_BE.ISO8859-1', |
| 1002 | 'nl_be.88591': 'nl_BE.ISO8859-1', |
| 1003 | 'nl_be.iso88591': 'nl_BE.ISO8859-1', |
| 1004 | 'nl_be.iso885915': 'nl_BE.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1005 | 'nl_be@euro': 'nl_BE.ISO8859-15', |
| 1006 | 'nl_nl': 'nl_NL.ISO8859-1', |
| 1007 | 'nl_nl.88591': 'nl_NL.ISO8859-1', |
| 1008 | 'nl_nl.iso88591': 'nl_NL.ISO8859-1', |
| 1009 | 'nl_nl.iso885915': 'nl_NL.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1010 | 'nl_nl@euro': 'nl_NL.ISO8859-15', |
| 1011 | 'nn': 'nn_NO.ISO8859-1', |
| 1012 | 'nn_no': 'nn_NO.ISO8859-1', |
| 1013 | 'nn_no.88591': 'nn_NO.ISO8859-1', |
| 1014 | 'nn_no.iso88591': 'nn_NO.ISO8859-1', |
| 1015 | 'nn_no.iso885915': 'nn_NO.ISO8859-15', |
| 1016 | 'nn_no@euro': 'nn_NO.ISO8859-15', |
| 1017 | 'no': 'no_NO.ISO8859-1', |
| 1018 | 'no@nynorsk': 'ny_NO.ISO8859-1', |
| 1019 | 'no_no': 'no_NO.ISO8859-1', |
| 1020 | 'no_no.88591': 'no_NO.ISO8859-1', |
| 1021 | 'no_no.iso88591': 'no_NO.ISO8859-1', |
| 1022 | 'no_no.iso885915': 'no_NO.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1023 | 'no_no@euro': 'no_NO.ISO8859-15', |
| 1024 | 'norwegian': 'no_NO.ISO8859-1', |
| 1025 | 'norwegian.iso88591': 'no_NO.ISO8859-1', |
| 1026 | 'ny': 'ny_NO.ISO8859-1', |
| 1027 | 'ny_no': 'ny_NO.ISO8859-1', |
| 1028 | 'ny_no.88591': 'ny_NO.ISO8859-1', |
| 1029 | 'ny_no.iso88591': 'ny_NO.ISO8859-1', |
| 1030 | 'ny_no.iso885915': 'ny_NO.ISO8859-15', |
| 1031 | 'ny_no@euro': 'ny_NO.ISO8859-15', |
| 1032 | 'nynorsk': 'nn_NO.ISO8859-1', |
| 1033 | 'oc': 'oc_FR.ISO8859-1', |
| 1034 | 'oc_fr': 'oc_FR.ISO8859-1', |
| 1035 | 'oc_fr.iso88591': 'oc_FR.ISO8859-1', |
| 1036 | 'oc_fr.iso885915': 'oc_FR.ISO8859-15', |
| 1037 | 'oc_fr@euro': 'oc_FR.ISO8859-15', |
| 1038 | 'pd': 'pd_US.ISO8859-1', |
| 1039 | 'pd_de': 'pd_DE.ISO8859-1', |
| 1040 | 'pd_de.iso88591': 'pd_DE.ISO8859-1', |
| 1041 | 'pd_de.iso885915': 'pd_DE.ISO8859-15', |
| 1042 | 'pd_de@euro': 'pd_DE.ISO8859-15', |
| 1043 | 'pd_us': 'pd_US.ISO8859-1', |
| 1044 | 'pd_us.iso88591': 'pd_US.ISO8859-1', |
| 1045 | 'pd_us.iso885915': 'pd_US.ISO8859-15', |
| 1046 | 'pd_us@euro': 'pd_US.ISO8859-15', |
| 1047 | 'ph': 'ph_PH.ISO8859-1', |
| 1048 | 'ph_ph': 'ph_PH.ISO8859-1', |
| 1049 | 'ph_ph.iso88591': 'ph_PH.ISO8859-1', |
| 1050 | 'pl': 'pl_PL.ISO8859-2', |
| 1051 | 'pl_pl': 'pl_PL.ISO8859-2', |
| 1052 | 'pl_pl.iso88592': 'pl_PL.ISO8859-2', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1053 | 'polish': 'pl_PL.ISO8859-2', |
| 1054 | 'portuguese': 'pt_PT.ISO8859-1', |
| 1055 | 'portuguese.iso88591': 'pt_PT.ISO8859-1', |
| 1056 | 'portuguese_brazil': 'pt_BR.ISO8859-1', |
| 1057 | 'portuguese_brazil.8859': 'pt_BR.ISO8859-1', |
| 1058 | 'posix': 'C', |
| 1059 | 'posix-utf2': 'C', |
| 1060 | 'pp': 'pp_AN.ISO8859-1', |
| 1061 | 'pp_an': 'pp_AN.ISO8859-1', |
| 1062 | 'pp_an.iso88591': 'pp_AN.ISO8859-1', |
| 1063 | 'pt': 'pt_PT.ISO8859-1', |
| 1064 | 'pt_br': 'pt_BR.ISO8859-1', |
| 1065 | 'pt_br.88591': 'pt_BR.ISO8859-1', |
| 1066 | 'pt_br.iso88591': 'pt_BR.ISO8859-1', |
| 1067 | 'pt_br.iso885915': 'pt_BR.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1068 | 'pt_br@euro': 'pt_BR.ISO8859-15', |
| 1069 | 'pt_pt': 'pt_PT.ISO8859-1', |
| 1070 | 'pt_pt.88591': 'pt_PT.ISO8859-1', |
| 1071 | 'pt_pt.iso88591': 'pt_PT.ISO8859-1', |
| 1072 | 'pt_pt.iso885915': 'pt_PT.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1073 | 'pt_pt.utf8@euro': 'pt_PT.UTF-8', |
| 1074 | 'pt_pt@euro': 'pt_PT.ISO8859-15', |
| 1075 | 'ro': 'ro_RO.ISO8859-2', |
| 1076 | 'ro_ro': 'ro_RO.ISO8859-2', |
| 1077 | 'ro_ro.iso88592': 'ro_RO.ISO8859-2', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1078 | 'romanian': 'ro_RO.ISO8859-2', |
| 1079 | 'ru': 'ru_RU.ISO8859-5', |
| 1080 | 'ru_ru': 'ru_RU.ISO8859-5', |
| 1081 | 'ru_ru.cp1251': 'ru_RU.CP1251', |
| 1082 | 'ru_ru.iso88595': 'ru_RU.ISO8859-5', |
| 1083 | 'ru_ru.koi8r': 'ru_RU.KOI8-R', |
| 1084 | 'ru_ru.microsoftcp1251': 'ru_RU.CP1251', |
| 1085 | 'ru_ua': 'ru_UA.KOI8-U', |
| 1086 | 'ru_ua.cp1251': 'ru_UA.CP1251', |
| 1087 | 'ru_ua.koi8u': 'ru_UA.KOI8-U', |
| 1088 | 'ru_ua.microsoftcp1251': 'ru_UA.CP1251', |
| 1089 | 'rumanian': 'ro_RO.ISO8859-2', |
| 1090 | 'russian': 'ru_RU.ISO8859-5', |
| 1091 | 'se_no': 'se_NO.UTF-8', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1092 | 'serbocroatian': 'sh_YU.ISO8859-2', |
| 1093 | 'sh': 'sh_YU.ISO8859-2', |
| 1094 | 'sh_hr': 'sh_HR.ISO8859-2', |
| 1095 | 'sh_hr.iso88592': 'sh_HR.ISO8859-2', |
| 1096 | 'sh_sp': 'sh_YU.ISO8859-2', |
| 1097 | 'sh_yu': 'sh_YU.ISO8859-2', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1098 | 'sk': 'sk_SK.ISO8859-2', |
| 1099 | 'sk_sk': 'sk_SK.ISO8859-2', |
| 1100 | 'sk_sk.iso88592': 'sk_SK.ISO8859-2', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1101 | 'sl': 'sl_SI.ISO8859-2', |
| 1102 | 'sl_cs': 'sl_CS.ISO8859-2', |
| 1103 | 'sl_si': 'sl_SI.ISO8859-2', |
| 1104 | 'sl_si.iso88592': 'sl_SI.ISO8859-2', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1105 | 'slovak': 'sk_SK.ISO8859-2', |
| 1106 | 'slovene': 'sl_SI.ISO8859-2', |
| 1107 | 'slovenian': 'sl_SI.ISO8859-2', |
| 1108 | 'sp': 'sp_YU.ISO8859-5', |
| 1109 | 'sp_yu': 'sp_YU.ISO8859-5', |
| 1110 | 'spanish': 'es_ES.ISO8859-1', |
| 1111 | 'spanish.iso88591': 'es_ES.ISO8859-1', |
| 1112 | 'spanish_spain': 'es_ES.ISO8859-1', |
| 1113 | 'spanish_spain.8859': 'es_ES.ISO8859-1', |
| 1114 | 'sq': 'sq_AL.ISO8859-2', |
| 1115 | 'sq_al': 'sq_AL.ISO8859-2', |
| 1116 | 'sq_al.iso88592': 'sq_AL.ISO8859-2', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1117 | 'sr': 'sr_YU.ISO8859-5', |
| 1118 | 'sr@cyrillic': 'sr_YU.ISO8859-5', |
| 1119 | 'sr_sp': 'sr_SP.ISO8859-2', |
| 1120 | 'sr_yu': 'sr_YU.ISO8859-5', |
| 1121 | 'sr_yu.cp1251@cyrillic': 'sr_YU.CP1251', |
| 1122 | 'sr_yu.iso88592': 'sr_YU.ISO8859-2', |
| 1123 | 'sr_yu.iso88595': 'sr_YU.ISO8859-5', |
| 1124 | 'sr_yu.iso88595@cyrillic': 'sr_YU.ISO8859-5', |
| 1125 | 'sr_yu.microsoftcp1251@cyrillic': 'sr_YU.CP1251', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1126 | 'sr_yu.utf8@cyrillic': 'sr_YU.UTF-8', |
| 1127 | 'sr_yu@cyrillic': 'sr_YU.ISO8859-5', |
| 1128 | 'sv': 'sv_SE.ISO8859-1', |
| 1129 | 'sv_fi': 'sv_FI.ISO8859-1', |
| 1130 | 'sv_fi.iso88591': 'sv_FI.ISO8859-1', |
| 1131 | 'sv_fi.iso885915': 'sv_FI.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1132 | 'sv_fi@euro': 'sv_FI.ISO8859-15', |
| 1133 | 'sv_se': 'sv_SE.ISO8859-1', |
| 1134 | 'sv_se.88591': 'sv_SE.ISO8859-1', |
| 1135 | 'sv_se.iso88591': 'sv_SE.ISO8859-1', |
| 1136 | 'sv_se.iso885915': 'sv_SE.ISO8859-15', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1137 | 'sv_se@euro': 'sv_SE.ISO8859-15', |
| 1138 | 'swedish': 'sv_SE.ISO8859-1', |
| 1139 | 'swedish.iso88591': 'sv_SE.ISO8859-1', |
| 1140 | 'ta': 'ta_IN.TSCII-0', |
| 1141 | 'ta_in': 'ta_IN.TSCII-0', |
| 1142 | 'ta_in.tscii': 'ta_IN.TSCII-0', |
| 1143 | 'ta_in.tscii0': 'ta_IN.TSCII-0', |
| 1144 | 'tg': 'tg_TJ.KOI8-C', |
| 1145 | 'tg_tj': 'tg_TJ.KOI8-C', |
| 1146 | 'tg_tj.koi8c': 'tg_TJ.KOI8-C', |
| 1147 | 'th': 'th_TH.ISO8859-11', |
| 1148 | 'th_th': 'th_TH.ISO8859-11', |
| 1149 | 'th_th.iso885911': 'th_TH.ISO8859-11', |
| 1150 | 'th_th.tactis': 'th_TH.TIS620', |
| 1151 | 'th_th.tis620': 'th_TH.TIS620', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1152 | 'thai': 'th_TH.ISO8859-11', |
| 1153 | 'tl': 'tl_PH.ISO8859-1', |
| 1154 | 'tl_ph': 'tl_PH.ISO8859-1', |
| 1155 | 'tl_ph.iso88591': 'tl_PH.ISO8859-1', |
| 1156 | 'tr': 'tr_TR.ISO8859-9', |
| 1157 | 'tr_tr': 'tr_TR.ISO8859-9', |
| 1158 | 'tr_tr.iso88599': 'tr_TR.ISO8859-9', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1159 | 'tt': 'tt_RU.TATAR-CYR', |
| 1160 | 'tt_ru': 'tt_RU.TATAR-CYR', |
| 1161 | 'tt_ru.koi8c': 'tt_RU.KOI8-C', |
| 1162 | 'tt_ru.tatarcyr': 'tt_RU.TATAR-CYR', |
| 1163 | 'turkish': 'tr_TR.ISO8859-9', |
| 1164 | 'turkish.iso88599': 'tr_TR.ISO8859-9', |
| 1165 | 'uk': 'uk_UA.KOI8-U', |
| 1166 | 'uk_ua': 'uk_UA.KOI8-U', |
| 1167 | 'uk_ua.cp1251': 'uk_UA.CP1251', |
| 1168 | 'uk_ua.iso88595': 'uk_UA.ISO8859-5', |
| 1169 | 'uk_ua.koi8u': 'uk_UA.KOI8-U', |
| 1170 | 'uk_ua.microsoftcp1251': 'uk_UA.CP1251', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1171 | 'univ': 'en_US.utf', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1172 | 'universal': 'en_US.utf', |
| 1173 | 'universal.utf8@ucs4': 'en_US.UTF-8', |
| 1174 | 'ur': 'ur_PK.CP1256', |
| 1175 | 'ur_pk': 'ur_PK.CP1256', |
| 1176 | 'ur_pk.cp1256': 'ur_PK.CP1256', |
| 1177 | 'ur_pk.microsoftcp1256': 'ur_PK.CP1256', |
| 1178 | 'uz': 'uz_UZ.UTF-8', |
| 1179 | 'uz_uz': 'uz_UZ.UTF-8', |
| 1180 | 'vi': 'vi_VN.TCVN', |
| 1181 | 'vi_vn': 'vi_VN.TCVN', |
| 1182 | 'vi_vn.tcvn': 'vi_VN.TCVN', |
| 1183 | 'vi_vn.tcvn5712': 'vi_VN.TCVN', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1184 | 'vi_vn.viscii': 'vi_VN.VISCII', |
| 1185 | 'vi_vn.viscii111': 'vi_VN.VISCII', |
| 1186 | 'wa': 'wa_BE.ISO8859-1', |
| 1187 | 'wa_be': 'wa_BE.ISO8859-1', |
| 1188 | 'wa_be.iso88591': 'wa_BE.ISO8859-1', |
| 1189 | 'wa_be.iso885915': 'wa_BE.ISO8859-15', |
| 1190 | 'wa_be@euro': 'wa_BE.ISO8859-15', |
| 1191 | 'yi': 'yi_US.CP1255', |
| 1192 | 'yi_us': 'yi_US.CP1255', |
| 1193 | 'yi_us.cp1255': 'yi_US.CP1255', |
| 1194 | 'yi_us.microsoftcp1255': 'yi_US.CP1255', |
| 1195 | 'zh': 'zh_CN.eucCN', |
| 1196 | 'zh_cn': 'zh_CN.gb2312', |
| 1197 | 'zh_cn.big5': 'zh_TW.big5', |
| 1198 | 'zh_cn.euc': 'zh_CN.eucCN', |
| 1199 | 'zh_cn.gb18030': 'zh_CN.gb18030', |
| 1200 | 'zh_cn.gb2312': 'zh_CN.gb2312', |
| 1201 | 'zh_cn.gbk': 'zh_CN.gbk', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1202 | 'zh_hk': 'zh_HK.big5hkscs', |
| 1203 | 'zh_hk.big5': 'zh_HK.big5', |
| 1204 | 'zh_hk.big5hkscs': 'zh_HK.big5hkscs', |
Marc-André Lemburg | bb4f1bd | 2004-12-10 21:58:14 +0000 | [diff] [blame] | 1205 | 'zh_tw': 'zh_TW.big5', |
| 1206 | 'zh_tw.big5': 'zh_TW.big5', |
| 1207 | 'zh_tw.euc': 'zh_TW.eucTW', |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1208 | } |
| 1209 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1210 | # |
| 1211 | # this maps windows language identifiers (as used on Windows 95 and |
| 1212 | # earlier) to locale strings. |
| 1213 | # |
Fredrik Lundh | 37a0982 | 2002-10-19 20:19:10 +0000 | [diff] [blame] | 1214 | # NOTE: this mapping is incomplete. If your language is missing, please |
| 1215 | # submit a bug report to Python bug manager, which you can find via: |
| 1216 | # http://www.python.org/dev/ |
| 1217 | # Make sure you include the missing language identifier and the suggested |
| 1218 | # locale code. |
| 1219 | # |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1220 | |
| 1221 | windows_locale = { |
| 1222 | 0x0404: "zh_TW", # Chinese (Taiwan) |
| 1223 | 0x0804: "zh_CN", # Chinese (PRC) |
| 1224 | 0x0406: "da_DK", # Danish |
| 1225 | 0x0413: "nl_NL", # Dutch (Netherlands) |
| 1226 | 0x0409: "en_US", # English (United States) |
| 1227 | 0x0809: "en_UK", # English (United Kingdom) |
| 1228 | 0x0c09: "en_AU", # English (Australian) |
| 1229 | 0x1009: "en_CA", # English (Canadian) |
| 1230 | 0x1409: "en_NZ", # English (New Zealand) |
| 1231 | 0x1809: "en_IE", # English (Ireland) |
| 1232 | 0x1c09: "en_ZA", # English (South Africa) |
| 1233 | 0x040b: "fi_FI", # Finnish |
| 1234 | 0x040c: "fr_FR", # French (Standard) |
| 1235 | 0x080c: "fr_BE", # French (Belgian) |
| 1236 | 0x0c0c: "fr_CA", # French (Canadian) |
| 1237 | 0x100c: "fr_CH", # French (Switzerland) |
| 1238 | 0x0407: "de_DE", # German (Standard) |
| 1239 | 0x0408: "el_GR", # Greek |
| 1240 | 0x040d: "iw_IL", # Hebrew |
| 1241 | 0x040f: "is_IS", # Icelandic |
| 1242 | 0x0410: "it_IT", # Italian (Standard) |
| 1243 | 0x0411: "ja_JA", # Japanese |
| 1244 | 0x0414: "no_NO", # Norwegian (Bokmal) |
| 1245 | 0x0816: "pt_PT", # Portuguese (Standard) |
| 1246 | 0x0c0a: "es_ES", # Spanish (Modern Sort) |
| 1247 | 0x0441: "sw_KE", # Swahili (Kenya) |
| 1248 | 0x041d: "sv_SE", # Swedish |
| 1249 | 0x081d: "sv_FI", # Swedish (Finland) |
| 1250 | 0x041f: "tr_TR", # Turkish |
| 1251 | } |
| 1252 | |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1253 | def _print_locale(): |
| 1254 | |
| 1255 | """ Test function. |
| 1256 | """ |
| 1257 | categories = {} |
| 1258 | def _init_categories(categories=categories): |
| 1259 | for k,v in globals().items(): |
| 1260 | if k[:3] == 'LC_': |
| 1261 | categories[k] = v |
| 1262 | _init_categories() |
| 1263 | del categories['LC_ALL'] |
| 1264 | |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1265 | print 'Locale defaults as determined by getdefaultlocale():' |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1266 | print '-'*72 |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1267 | lang, enc = getdefaultlocale() |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1268 | print 'Language: ', lang or '(undefined)' |
| 1269 | print 'Encoding: ', enc or '(undefined)' |
| 1270 | print |
| 1271 | |
| 1272 | print 'Locale settings on startup:' |
| 1273 | print '-'*72 |
| 1274 | for name,category in categories.items(): |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1275 | print name, '...' |
| 1276 | lang, enc = getlocale(category) |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1277 | print ' Language: ', lang or '(undefined)' |
| 1278 | print ' Encoding: ', enc or '(undefined)' |
| 1279 | print |
| 1280 | |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1281 | print |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1282 | print 'Locale settings after calling resetlocale():' |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1283 | print '-'*72 |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1284 | resetlocale() |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1285 | for name,category in categories.items(): |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1286 | print name, '...' |
| 1287 | lang, enc = getlocale(category) |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1288 | print ' Language: ', lang or '(undefined)' |
| 1289 | print ' Encoding: ', enc or '(undefined)' |
| 1290 | print |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1291 | |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1292 | try: |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1293 | setlocale(LC_ALL, "") |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1294 | except: |
| 1295 | print 'NOTE:' |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1296 | print 'setlocale(LC_ALL, "") does not support the default locale' |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1297 | print 'given in the OS environment variables.' |
| 1298 | else: |
| 1299 | print |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1300 | print 'Locale settings after calling setlocale(LC_ALL, ""):' |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1301 | print '-'*72 |
| 1302 | for name,category in categories.items(): |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1303 | print name, '...' |
| 1304 | lang, enc = getlocale(category) |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1305 | print ' Language: ', lang or '(undefined)' |
| 1306 | print ' Encoding: ', enc or '(undefined)' |
| 1307 | print |
Fredrik Lundh | 6c86b99 | 2000-07-09 17:12:58 +0000 | [diff] [blame] | 1308 | |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1309 | ### |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 1310 | |
Tim Peters | 1baf829 | 2001-01-24 10:13:46 +0000 | [diff] [blame] | 1311 | try: |
| 1312 | LC_MESSAGES |
Skip Montanaro | 0897f0c | 2002-03-25 21:40:36 +0000 | [diff] [blame] | 1313 | except NameError: |
Tim Peters | 1baf829 | 2001-01-24 10:13:46 +0000 | [diff] [blame] | 1314 | pass |
| 1315 | else: |
| 1316 | __all__.append("LC_MESSAGES") |
| 1317 | |
Guido van Rossum | eef1d4e | 1997-11-19 19:01:43 +0000 | [diff] [blame] | 1318 | if __name__=='__main__': |
Marc-André Lemburg | 5431bc3 | 2000-06-07 09:11:40 +0000 | [diff] [blame] | 1319 | print 'Locale aliasing:' |
| 1320 | print |
| 1321 | _print_locale() |
| 1322 | print |
| 1323 | print 'Number formatting:' |
| 1324 | print |
| 1325 | _test() |