PageRenderTime 63ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/Lib/locale.py

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