Closed fxleyu closed 7 years ago
public Locale(String language, String country)
根据语言和国家/地区构造一个语言环境。注:ISO 639 并非是一个不变的标准;它所定义的某些语言代码(特别是 iw、ji 和 in)已经发生了变化。此构造方法接受旧代码(iw、ji 和 in)和新代码(he、yi 和 id),但是 Locale 中的所有其他 API 将只返回旧代码。
参数: language - 小写的两字母 ISO-639 代码。 country - 大写的两字母 ISO-3166 代码。 抛出: NullPointerException - 如果任意参数为 null。
来源 Construct a locale from language and country. This constructor normalizes the language value to lowercase and the country value to uppercase.
Note:
Parameters:
Throws:
Table 20-2 ISO-639 Language Codes
Language | ISO-639 Language Code |
---|---|
Abkhazian | ab |
Afar | aa |
Afrikaans | af |
Albanian | sq |
Amharic | am |
Arabic | ar |
Armenian | hy |
Assamese | as |
Aymara | ay |
Azerbaijani | az |
Bashkir | ba |
Basque | eu |
Bengali (Bangla) | bn |
Bhutani | dz |
Bihari | bh |
Bislama | bi |
Breton | br |
Bulgarian | bg |
Burmese | my |
Byelorussian (Belarusian) | be |
Cambodian | km |
Catalan | ca |
Chinese (Simplified) | zh |
Chinese (Traditional) | zh |
Corsican | co |
Croatian | hr |
Czech | cs |
Danish | da |
Dutch | nl |
English | en |
Esperanto | eo |
Estonian | et |
Faeroese | fo |
Farsi | fa |
Fiji | fj |
Finnish | fi |
French | fr |
Frisian | fy |
Galician | gl |
Gaelic (Scottish) | gd |
Gaelic (Manx) | gv |
Georgian | ka |
German | de |
Greek | el |
Greenlandic | kl |
Guarani | gn |
Gujarati | gu |
Hausa | ha |
Hebrew | he |
Hindi | hi |
Hungarian | hu |
Icelandic | is |
Indonesian | id |
Interlingua | ia |
Interlingue | ie |
Inuktitut | iu |
Inupiak | ik |
Irish | ga |
Italian | it |
Japanese | ja |
Javanese | ja |
Kannada | kn |
Kashmiri | ks |
Kazakh | kk |
Kinyarwanda (Ruanda) | rw |
Kirghiz | ky |
Kirundi (Rundi) | rn |
Korean | ko |
Kurdish | ku |
Laothian | lo |
Latin | la |
Latvian (Lettish) | lv |
Limburgish ( Limburger) | li |
Lingala | ln |
Lithuanian | lt |
Macedonian | mk |
Malagasy | mg |
Malay | ms |
Malayalam | ml |
Maltese | mt |
Maori | mi |
Marathi | mr |
Moldavian | mo |
Mongolian | mn |
Nauru | na |
Nepali | ne |
Norwegian | no |
Occitan | oc |
Oriya | or |
Oromo (Afan, Galla) | om |
Pashto (Pushto) | ps |
Polish | pl |
Portuguese | pt |
Punjabi | pa |
Quechua | qu |
Rhaeto-Romance | rm |
Romanian | ro |
Russian | ru |
Samoan | sm |
Sangro | sg |
Sanskrit | sa |
Serbian | sr |
Serbo-Croatian | sh |
Sesotho | st |
Setswana | tn |
Shona | sn |
Sindhi | sd |
Sinhalese | si |
Siswati | ss |
Slovak | sk |
Slovenian | sl |
Somali | so |
Spanish | es |
Sundanese | su |
Swahili (Kiswahili) | sw |
Swedish | sv |
Tagalog | tl |
Tajik | tg |
Tamil | ta |
Tatar | tt |
Telugu | te |
Thai | th |
Tibetan | bo |
Tigrinya | ti |
Tonga | to |
Tsonga | ts |
Turkish | tr |
Turkmen | tk |
Twi | tw |
Uighur | ug |
Ukrainian | uk |
Urdu | ur |
Uzbek | uz |
Vietnamese | vi |
Volapük | vo |
Welsh | cy |
Wolof | wo |
Xhosa | xh |
Yiddish | yi |
Yoruba | yo |
Zulu | zu |
Table 20-1 ISO-3166 Country Codes
Country | ISO-3166 Country Code |
---|---|
AFGHANISTAN | AF |
ALBANIA | AL |
ALGERIA | DZ |
AMERICAN SAMOA | AS |
ANDORRA | AD |
ANGOLA | AO |
ANTARCTICA | AQ |
ANTIGUA AND BARBUDA | AG |
ARGENTINA | AR |
ARMENIA | AM |
ARUBA | AW |
AUSTRALIA | AU |
AUSTRIA | AT |
AZERBAIJAN | AZ |
BAHAMAS | BS |
BAHRAIN | BH |
BANGLADESH | BD |
BARBADOS | BB |
BELARUS | BY |
BELGIUM | BE |
BELIZE | BZ |
BENIN | BJ |
BERMUDA | BM |
BHUTAN | BT |
BOLIVIA | BO |
BOSNIA AND HERZEGOVINA | BA |
BOTSWANA | BW |
BOUVET ISLAND | BV |
BRAZIL | BR |
BRITISH INDIAN OCEAN TERRITORY | IO |
BRUNEI DARUSSALAM | BN |
BULGARIA | BG |
BURKINA FASO | BF |
BURUNDI | BI |
CAMBODIA | KH |
CAMEROON | CM |
CANADA | CA |
CAPE VERDE | CV |
CAYMAN ISLANDS | KY |
CENTRAL AFRICAN REPUBLIC | CF |
CHAD | TD |
CHILE | CL |
CHINA | CN |
CHRISTMAS ISLAND | CX |
COCOS (KEELING) ISLANDS | CC |
COLOMBIA | CO |
COMOROS | KM |
CONGO | CG |
CONGO, THE DEMOCRATIC REPUBLIC OF THE | CD |
COOK ISLANDS | CK |
COSTA RICA | CR |
CÔTE D'IVOIRE | CI |
CROATIA | HR |
CUBA | CU |
CYPRUS | CY |
CZECH REPUBLIC | CZ |
DENMARK | DK |
DJIBOUTI | DJ |
DOMINICA | DM |
DOMINICAN REPUBLIC | DO |
ECUADOR | EC |
EGYPT | EG |
EL SALVADOR | SV |
EQUATORIAL GUINEA | GQ |
ERITREA | ER |
ESTONIA | EE |
ETHIOPIA | ET |
FALKLAND ISLANDS (MALVINAS) | FK |
FAROE ISLANDS | FO |
FIJI | FJ |
FINLAND | FI |
FRANCE | FR |
FRENCH GUIANA | GF |
FRENCH POLYNESIA | PF |
FRENCH SOUTHERN TERRITORIES | TF |
GABON | GA |
GAMBIA | GM |
GEORGIA | GE |
GERMANY | DE |
GHANA | GH |
GIBRALTAR | GI |
GREECE | GR |
GREENLAND | GL |
GRENADA | GD |
GUADELOUPE | GP |
GUAM | GU |
GUATEMALA | GT |
GUINEA | GN |
GUINEA-BISSAU | GW |
GUYANA | GY |
HAITI | HT |
HEARD ISLAND AND MCDONALD ISLANDS | HM |
HONDURAS | HN |
HONG KONG | HK |
HUNGARY | HU |
ICELAND | IS |
INDIA | IN |
INDONESIA | ID |
IRAN, ISLAMIC REPUBLIC OF | IR |
IRAQ | IQ |
IRELAND | IE |
ISRAEL | IL |
ITALY | IT |
JAMAICA | JM |
JAPAN | JP |
JORDAN | JO |
KAZAKHSTAN | KZ |
KENYA | KE |
KIRIBATI | KI |
KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF | KP |
KOREA, REPUBLIC OF | KR |
KUWAIT | KW |
KYRGYZSTAN | KG |
LAO PEOPLE'S DEMOCRATIC REPUBLIC | LA |
LATVIA | LV |
LEBANON | LB |
LESOTHO | LS |
LIBERIA | LR |
LIBYAN ARAB JAMAHIRIYA | LY |
LIECHTENSTEIN | LI |
LITHUANIA | LT |
LUXEMBOURG | LU |
MACAO | MO |
MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF | MK |
MADAGASCAR | MG |
MALAWI | MW |
MALAYSIA | MY |
MALDIVES | MV |
MALI | ML |
MALTA | MT |
MARSHALL ISLANDS | MH |
MARTINIQUE | MQ |
MAURITANIA | MR |
MAURITIUS | MU |
MAYOTTE | YT |
MEXICO | MX |
MICRONESIA, FEDERATED STATES OF | FM |
MOLDOVA, REPUBLIC OF | MD |
MONACO | MD |
MONGOLIA | MN |
MONTSERRAT | MS |
MOROCCO | MA |
MOZAMBIQUE | MZ |
MYANMAR | MM |
NAMIBIA | NA |
NAURU | NR |
NEPAL | NP |
NETHERLANDS | NL |
NETHERLANDS ANTILLES | AN |
NEW CALEDONIA | NC |
NEW ZEALAND | NZ |
NICARAGUA | NI |
NIGER | NE |
NIGERIA | NG |
NIUE | NU |
NORFOLK ISLAND | NF |
NORTHERN MARIANA ISLANDS | MP |
NORWAY | NO |
OMAN | OM |
PAKISTAN | PK |
PALAU | PW |
PALESTINIAN TERRITORY, OCCUPIED | PS |
PANAMA | PA |
PAPUA NEW GUINEA | PG |
PARAGUAY | PY |
PERU | PE |
PHILIPPINES | PH |
PITCAIRN | PN |
POLAND | PL |
PUERTO RICO | PR |
QATAR | QA |
RÉUNION | RE |
ROMANIA | RO |
RUSSIAN FEDERATION | RU |
RWANDA | RW |
SAINT HELENA | SH |
SAINT KITTS AND NEVIS | KN |
SAINT LUCIA | LC |
SAINT PIERRE AND MIQUELON | PM |
SAINT VINCENT AND THE GRENADINES | VC |
SAMOA | WS |
SAN MARINO | SM |
SAO TOME AND PRINCIPE | ST |
SAUDI ARABIA | SA |
SENEGAL | SN |
SERBIA AND MONTENEGRO | CS |
SEYCHELLES | SC |
SIERRA LEONE | SL |
SINGAPORE | SG |
SLOVAKIA | SK |
SLOVENIA | SI |
SOLOMON ISLANDS | SB |
SOMALIA | SO |
SOUTH AFRICA | ZA |
SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS | GS |
SPAIN | ES |
SRI LANKA | LK |
SUDAN | SD |
SURINAME | SR |
SVALBARD AND JAN MAYEN | SJ |
SWAZILAND | SZ |
SWEDEN | SE |
SWITZERLAND | CH |
SYRIAN ARAB REPUBLIC | SY |
TAIWAN, PROVINCE OF CHINA | TW |
TAJIKISTAN | TJ |
TANZANIA, UNITED REPUBLIC OF | TZ |
THAILAND | TH |
TIMOR-LESTE | TL |
TOGO | TG |
TOKELAU | TK |
TONGA | TO |
TRINIDAD AND TOBAGO | TT |
TUNISIA | TN |
TURKEY | TR |
TURKMENISTAN | TM |
TURKS AND CAICOS ISLANDS | TC |
TUVALU | TV |
UGANDA | UG |
UKRAINE | UA |
UNITED ARAB EMIRATES | AE |
UNITED KINGDOM | GB |
UNITED STATES | US |
UNITED STATES MINOR OUTLYING ISLANDS | UM |
URUGUAY | UY |
UZBEKISTAN | UZ |
VANUATU | VU |
VENEZUELA | VE |
VIET NAM | VN |
VIRGIN ISLANDS, BRITISH | VG |
VIRGIN ISLANDS, U.S. | VI |
WALLIS AND FUTUNA | WF |
WESTERN SAHARA | EH |
YEMEN | YE |
ZAMBIA | ZM |
ZIMBABWE | ZW |
在处理多语言下的项目时(尤其是移动端),有时需要根据系统语言环境做特殊化定制。
所以,就需要使用到
java.util.Locale
类的实例对象。而该对象中主要使用其语言码和国家码。
但对于语言码和国家码集合不太了解,这里希望对其有一个深入的感官。