某些语言的国家/地区名称无效

问题描述

我正在尝试打印不同语言的 iso 国家/地区名称。我得到了某些语言的正确名称,但对于某些语言,我得到了无效的国家/地区名称 (???????)

 import java.util.*;
public class LocaleGetdisplayCountryExample2 {
public static void main(String[] args) {
    
// Creating a new Locale
       Locale locale1 = new Locale("sr","NL");
// Creating another Locale
       Locale locale2 = new Locale("de","NL");

// Creating another Locale
       Locale locale3 = new Locale("da","NL");

// display locale
System.out.println("Locale1 name: "+ locale1);
System.out.println("Locale2 name: "+ locale2);
System.out.println("Locale3 name: "+ locale3);

// Use of getdisplayCountry() :
System.out.println("Country Name Locale1: "
                           + locale1.getdisplayCountry(locale1));
System.out.println("Country Name Locale2: "
               + locale2.getdisplayCountry(locale2));

System.out.println("Country Name Locale3: "
               + locale3.getdisplayCountry(locale3));
   }
}

输出

Locale1 name: sr_NL
Locale2 name: de_NL
Locale3 name: da_NL
Country Name Locale1: ?????????
Country Name Locale2: Niederlande
Country Name Locale3: Netherlands

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)