PageRenderTime 28ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/lib-python/2.7/locale.py

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