有没有人知道包含java中所有本地化国家/地区名称的库?

时间:2012-10-19 12:29:14

标签: java

  

可能重复:
  Localized country names

是否有任何java lib包含以欧洲主要语言本地化的所有国家/地区?

我尝试过使用java.util.Locale,但它并不包含所有国家/地区(它缺少一些像圣马力诺,andorra,azerbeijan ......)


编辑

此:

for (Locale locale : Locale.getAvailableLocales())
    {
         System.out.println(locale.getCountry() + "  " + locale.getDisplayCountry());
    }

输出:(我的语言环境是英语)

AE  United Arab Emirates
AL  Albania
AR  Argentina
AT  Austria
AU  Australia
BA  Bosnia and Herzegovina
BE  Belgium
BG  Bulgaria
BH  Bahrain
BO  Bolivia
BR  Brazil
BY  Belarus
CA  Canada
CH  Switzerland
CL  Chile
CN  China
CO  Colombia
CR  Costa Rica
CS  Serbia and Montenegro
CY  Cyprus
CZ  Czech Republic
DE  Germany
DK  Denmark
DO  Dominican Republic
DZ  Algeria
EC  Ecuador
EE  Estonia
EG  Egypt
ES  Spain
FI  Finland
FR  France
GB  United Kingdom
GR  Greece
GT  Guatemala
HK  Hong Kong
HN  Honduras
HR  Croatia
HU  Hungary
ID  Indonesia
IE  Ireland
IL  Israel
IN  India
IQ  Iraq
IS  Iceland
IT  Italy
JO  Jordan
JP  Japan
KR  South Korea
KW  Kuwait
LB  Lebanon
LT  Lithuania
LU  Luxembourg
LV  Latvia
LY  Libya
MA  Morocco
ME  Montenegro
MK  Macedonia
MT  Malta
MX  Mexico
MY  Malaysia
NI  Nicaragua
NL  Netherlands
NO  Norway
NZ  New Zealand
OM  Oman
PA  Panama
PE  Peru
PH  Philippines
PL  Poland
PR  Puerto Rico
PT  Portugal
PY  Paraguay
QA  Qatar
RO  Romania
RS  Serbia
RU  Russia
SA  Saudi Arabia
SD  Sudan
SE  Sweden
SG  Singapore
SI  Slovenia
SK  Slovakia
SV  El Salvador
SY  Syria
TH  Thailand
TN  Tunisia
TR  Turkey
TW  Taiwan
UA  Ukraine
US  United States
UY  Uruguay
VE  Venezuela
VN  Vietnam
YE  Yemen
ZA  South Africa

在您点击“关闭”之前,请阅读以下问题:

这个问题不是候选人重复问题的愚蠢!另一个问题与java无关!它甚至还有客观的c代码!

1 个答案:

答案 0 :(得分:10)

您可以使用Locale.getISOCountries()。例如,以下代码打印ISO 3166中定义的所有国家/地区的德语名称。

Locale locale = Locale.GERMAN;      
for (String country : Locale.getISOCountries())
{
    System.out.println(new Locale("", country).getDisplayCountry(locale));
}