@@ -570,11 +570,7 @@ def _getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
570570 except (ImportError , AttributeError ):
571571 pass
572572 else :
573- # make sure the code/encoding values are valid
574- if sys .platform == "win32" and code and code [:2 ] == "0x" :
575- # map windows language identifier to language name
576- code = windows_locale .get (int (code , 0 ))
577- # ...add other platform-specific processing here, if
573+ # add other platform-specific processing here, if
578574 # necessary...
579575 return code , encoding
580576
@@ -1505,232 +1501,6 @@ def getpreferredencoding(do_setlocale=True):
15051501 'zu_za' : 'zu_ZA.ISO8859-1' ,
15061502}
15071503
1508- #
1509- # This maps Windows language identifiers to locale strings.
1510- #
1511- # This list has been updated from
1512- # http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp
1513- # to include every locale up to Windows Vista.
1514- #
1515- # NOTE: this mapping is incomplete. If your language is missing, please
1516- # submit a bug report as detailed in the Python devguide at:
1517- # https://devguide.python.org/triage/issue-tracker/
1518- # Make sure you include the missing language identifier and the suggested
1519- # locale code.
1520- #
1521-
1522- windows_locale = {
1523- 0x0436 : "af_ZA" , # Afrikaans
1524- 0x041c : "sq_AL" , # Albanian
1525- 0x0484 : "gsw_FR" ,# Alsatian - France
1526- 0x045e : "am_ET" , # Amharic - Ethiopia
1527- 0x0401 : "ar_SA" , # Arabic - Saudi Arabia
1528- 0x0801 : "ar_IQ" , # Arabic - Iraq
1529- 0x0c01 : "ar_EG" , # Arabic - Egypt
1530- 0x1001 : "ar_LY" , # Arabic - Libya
1531- 0x1401 : "ar_DZ" , # Arabic - Algeria
1532- 0x1801 : "ar_MA" , # Arabic - Morocco
1533- 0x1c01 : "ar_TN" , # Arabic - Tunisia
1534- 0x2001 : "ar_OM" , # Arabic - Oman
1535- 0x2401 : "ar_YE" , # Arabic - Yemen
1536- 0x2801 : "ar_SY" , # Arabic - Syria
1537- 0x2c01 : "ar_JO" , # Arabic - Jordan
1538- 0x3001 : "ar_LB" , # Arabic - Lebanon
1539- 0x3401 : "ar_KW" , # Arabic - Kuwait
1540- 0x3801 : "ar_AE" , # Arabic - United Arab Emirates
1541- 0x3c01 : "ar_BH" , # Arabic - Bahrain
1542- 0x4001 : "ar_QA" , # Arabic - Qatar
1543- 0x042b : "hy_AM" , # Armenian
1544- 0x044d : "as_IN" , # Assamese - India
1545- 0x042c : "az_AZ" , # Azeri - Latin
1546- 0x082c : "az_AZ" , # Azeri - Cyrillic
1547- 0x046d : "ba_RU" , # Bashkir
1548- 0x042d : "eu_ES" , # Basque - Russia
1549- 0x0423 : "be_BY" , # Belarusian
1550- 0x0445 : "bn_IN" , # Begali
1551- 0x201a : "bs_BA" , # Bosnian - Cyrillic
1552- 0x141a : "bs_BA" , # Bosnian - Latin
1553- 0x047e : "br_FR" , # Breton - France
1554- 0x0402 : "bg_BG" , # Bulgarian
1555- # 0x0455: "my_MM", # Burmese - Not supported
1556- 0x0403 : "ca_ES" , # Catalan
1557- 0x0004 : "zh_CHS" ,# Chinese - Simplified
1558- 0x0404 : "zh_TW" , # Chinese - Taiwan
1559- 0x0804 : "zh_CN" , # Chinese - PRC
1560- 0x0c04 : "zh_HK" , # Chinese - Hong Kong S.A.R.
1561- 0x1004 : "zh_SG" , # Chinese - Singapore
1562- 0x1404 : "zh_MO" , # Chinese - Macao S.A.R.
1563- 0x7c04 : "zh_CHT" ,# Chinese - Traditional
1564- 0x0483 : "co_FR" , # Corsican - France
1565- 0x041a : "hr_HR" , # Croatian
1566- 0x101a : "hr_BA" , # Croatian - Bosnia
1567- 0x0405 : "cs_CZ" , # Czech
1568- 0x0406 : "da_DK" , # Danish
1569- 0x048c : "gbz_AF" ,# Dari - Afghanistan
1570- 0x0465 : "div_MV" ,# Divehi - Maldives
1571- 0x0413 : "nl_NL" , # Dutch - The Netherlands
1572- 0x0813 : "nl_BE" , # Dutch - Belgium
1573- 0x0409 : "en_US" , # English - United States
1574- 0x0809 : "en_GB" , # English - United Kingdom
1575- 0x0c09 : "en_AU" , # English - Australia
1576- 0x1009 : "en_CA" , # English - Canada
1577- 0x1409 : "en_NZ" , # English - New Zealand
1578- 0x1809 : "en_IE" , # English - Ireland
1579- 0x1c09 : "en_ZA" , # English - South Africa
1580- 0x2009 : "en_JA" , # English - Jamaica
1581- 0x2409 : "en_CB" , # English - Caribbean
1582- 0x2809 : "en_BZ" , # English - Belize
1583- 0x2c09 : "en_TT" , # English - Trinidad
1584- 0x3009 : "en_ZW" , # English - Zimbabwe
1585- 0x3409 : "en_PH" , # English - Philippines
1586- 0x4009 : "en_IN" , # English - India
1587- 0x4409 : "en_MY" , # English - Malaysia
1588- 0x4809 : "en_IN" , # English - Singapore
1589- 0x0425 : "et_EE" , # Estonian
1590- 0x0438 : "fo_FO" , # Faroese
1591- 0x0464 : "fil_PH" ,# Filipino
1592- 0x040b : "fi_FI" , # Finnish
1593- 0x040c : "fr_FR" , # French - France
1594- 0x080c : "fr_BE" , # French - Belgium
1595- 0x0c0c : "fr_CA" , # French - Canada
1596- 0x100c : "fr_CH" , # French - Switzerland
1597- 0x140c : "fr_LU" , # French - Luxembourg
1598- 0x180c : "fr_MC" , # French - Monaco
1599- 0x0462 : "fy_NL" , # Frisian - Netherlands
1600- 0x0456 : "gl_ES" , # Galician
1601- 0x0437 : "ka_GE" , # Georgian
1602- 0x0407 : "de_DE" , # German - Germany
1603- 0x0807 : "de_CH" , # German - Switzerland
1604- 0x0c07 : "de_AT" , # German - Austria
1605- 0x1007 : "de_LU" , # German - Luxembourg
1606- 0x1407 : "de_LI" , # German - Liechtenstein
1607- 0x0408 : "el_GR" , # Greek
1608- 0x046f : "kl_GL" , # Greenlandic - Greenland
1609- 0x0447 : "gu_IN" , # Gujarati
1610- 0x0468 : "ha_NG" , # Hausa - Latin
1611- 0x040d : "he_IL" , # Hebrew
1612- 0x0439 : "hi_IN" , # Hindi
1613- 0x040e : "hu_HU" , # Hungarian
1614- 0x040f : "is_IS" , # Icelandic
1615- 0x0421 : "id_ID" , # Indonesian
1616- 0x045d : "iu_CA" , # Inuktitut - Syllabics
1617- 0x085d : "iu_CA" , # Inuktitut - Latin
1618- 0x083c : "ga_IE" , # Irish - Ireland
1619- 0x0410 : "it_IT" , # Italian - Italy
1620- 0x0810 : "it_CH" , # Italian - Switzerland
1621- 0x0411 : "ja_JP" , # Japanese
1622- 0x044b : "kn_IN" , # Kannada - India
1623- 0x043f : "kk_KZ" , # Kazakh
1624- 0x0453 : "kh_KH" , # Khmer - Cambodia
1625- 0x0486 : "qut_GT" ,# K'iche - Guatemala
1626- 0x0487 : "rw_RW" , # Kinyarwanda - Rwanda
1627- 0x0457 : "kok_IN" ,# Konkani
1628- 0x0412 : "ko_KR" , # Korean
1629- 0x0440 : "ky_KG" , # Kyrgyz
1630- 0x0454 : "lo_LA" , # Lao - Lao PDR
1631- 0x0426 : "lv_LV" , # Latvian
1632- 0x0427 : "lt_LT" , # Lithuanian
1633- 0x082e : "dsb_DE" ,# Lower Sorbian - Germany
1634- 0x046e : "lb_LU" , # Luxembourgish
1635- 0x042f : "mk_MK" , # FYROM Macedonian
1636- 0x043e : "ms_MY" , # Malay - Malaysia
1637- 0x083e : "ms_BN" , # Malay - Brunei Darussalam
1638- 0x044c : "ml_IN" , # Malayalam - India
1639- 0x043a : "mt_MT" , # Maltese
1640- 0x0481 : "mi_NZ" , # Maori
1641- 0x047a : "arn_CL" ,# Mapudungun
1642- 0x044e : "mr_IN" , # Marathi
1643- 0x047c : "moh_CA" ,# Mohawk - Canada
1644- 0x0450 : "mn_MN" , # Mongolian - Cyrillic
1645- 0x0850 : "mn_CN" , # Mongolian - PRC
1646- 0x0461 : "ne_NP" , # Nepali
1647- 0x0414 : "nb_NO" , # Norwegian - Bokmal
1648- 0x0814 : "nn_NO" , # Norwegian - Nynorsk
1649- 0x0482 : "oc_FR" , # Occitan - France
1650- 0x0448 : "or_IN" , # Oriya - India
1651- 0x0463 : "ps_AF" , # Pashto - Afghanistan
1652- 0x0429 : "fa_IR" , # Persian
1653- 0x0415 : "pl_PL" , # Polish
1654- 0x0416 : "pt_BR" , # Portuguese - Brazil
1655- 0x0816 : "pt_PT" , # Portuguese - Portugal
1656- 0x0446 : "pa_IN" , # Punjabi
1657- 0x046b : "quz_BO" ,# Quechua (Bolivia)
1658- 0x086b : "quz_EC" ,# Quechua (Ecuador)
1659- 0x0c6b : "quz_PE" ,# Quechua (Peru)
1660- 0x0418 : "ro_RO" , # Romanian - Romania
1661- 0x0417 : "rm_CH" , # Romansh
1662- 0x0419 : "ru_RU" , # Russian
1663- 0x243b : "smn_FI" ,# Sami Finland
1664- 0x103b : "smj_NO" ,# Sami Norway
1665- 0x143b : "smj_SE" ,# Sami Sweden
1666- 0x043b : "se_NO" , # Sami Northern Norway
1667- 0x083b : "se_SE" , # Sami Northern Sweden
1668- 0x0c3b : "se_FI" , # Sami Northern Finland
1669- 0x203b : "sms_FI" ,# Sami Skolt
1670- 0x183b : "sma_NO" ,# Sami Southern Norway
1671- 0x1c3b : "sma_SE" ,# Sami Southern Sweden
1672- 0x044f : "sa_IN" , # Sanskrit
1673- 0x0c1a : "sr_SP" , # Serbian - Cyrillic
1674- 0x1c1a : "sr_BA" , # Serbian - Bosnia Cyrillic
1675- 0x081a : "sr_SP" , # Serbian - Latin
1676- 0x181a : "sr_BA" , # Serbian - Bosnia Latin
1677- 0x045b : "si_LK" , # Sinhala - Sri Lanka
1678- 0x046c : "ns_ZA" , # Northern Sotho
1679- 0x0432 : "tn_ZA" , # Setswana - Southern Africa
1680- 0x041b : "sk_SK" , # Slovak
1681- 0x0424 : "sl_SI" , # Slovenian
1682- 0x040a : "es_ES" , # Spanish - Spain
1683- 0x080a : "es_MX" , # Spanish - Mexico
1684- 0x0c0a : "es_ES" , # Spanish - Spain (Modern)
1685- 0x100a : "es_GT" , # Spanish - Guatemala
1686- 0x140a : "es_CR" , # Spanish - Costa Rica
1687- 0x180a : "es_PA" , # Spanish - Panama
1688- 0x1c0a : "es_DO" , # Spanish - Dominican Republic
1689- 0x200a : "es_VE" , # Spanish - Venezuela
1690- 0x240a : "es_CO" , # Spanish - Colombia
1691- 0x280a : "es_PE" , # Spanish - Peru
1692- 0x2c0a : "es_AR" , # Spanish - Argentina
1693- 0x300a : "es_EC" , # Spanish - Ecuador
1694- 0x340a : "es_CL" , # Spanish - Chile
1695- 0x380a : "es_UR" , # Spanish - Uruguay
1696- 0x3c0a : "es_PY" , # Spanish - Paraguay
1697- 0x400a : "es_BO" , # Spanish - Bolivia
1698- 0x440a : "es_SV" , # Spanish - El Salvador
1699- 0x480a : "es_HN" , # Spanish - Honduras
1700- 0x4c0a : "es_NI" , # Spanish - Nicaragua
1701- 0x500a : "es_PR" , # Spanish - Puerto Rico
1702- 0x540a : "es_US" , # Spanish - United States
1703- # 0x0430: "", # Sutu - Not supported
1704- 0x0441 : "sw_KE" , # Swahili
1705- 0x041d : "sv_SE" , # Swedish - Sweden
1706- 0x081d : "sv_FI" , # Swedish - Finland
1707- 0x045a : "syr_SY" ,# Syriac
1708- 0x0428 : "tg_TJ" , # Tajik - Cyrillic
1709- 0x085f : "tmz_DZ" ,# Tamazight - Latin
1710- 0x0449 : "ta_IN" , # Tamil
1711- 0x0444 : "tt_RU" , # Tatar
1712- 0x044a : "te_IN" , # Telugu
1713- 0x041e : "th_TH" , # Thai
1714- 0x0851 : "bo_BT" , # Tibetan - Bhutan
1715- 0x0451 : "bo_CN" , # Tibetan - PRC
1716- 0x041f : "tr_TR" , # Turkish
1717- 0x0442 : "tk_TM" , # Turkmen - Cyrillic
1718- 0x0480 : "ug_CN" , # Uighur - Arabic
1719- 0x0422 : "uk_UA" , # Ukrainian
1720- 0x042e : "wen_DE" ,# Upper Sorbian - Germany
1721- 0x0420 : "ur_PK" , # Urdu
1722- 0x0820 : "ur_IN" , # Urdu - India
1723- 0x0443 : "uz_UZ" , # Uzbek - Latin
1724- 0x0843 : "uz_UZ" , # Uzbek - Cyrillic
1725- 0x042a : "vi_VN" , # Vietnamese
1726- 0x0452 : "cy_GB" , # Welsh
1727- 0x0488 : "wo_SN" , # Wolof - Senegal
1728- 0x0434 : "xh_ZA" , # Xhosa - South Africa
1729- 0x0485 : "sah_RU" ,# Yakut - Cyrillic
1730- 0x0478 : "ii_CN" , # Yi - PRC
1731- 0x046a : "yo_NG" , # Yoruba - Nigeria
1732- 0x0435 : "zu_ZA" , # Zulu
1733- }
17341504
17351505def _print_locale ():
17361506
0 commit comments