locale.py 102 KB

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