需要确定Austria
的区域设置ID。我已经尝试了de_AT
/ at
/ at_at
,如上所述here
但是看起来Locale API并没有认识到这些语言环境,任何指针......?
使用de_AT
尝试时出现异常:
java.util.MissingResourceException: Couldn't find 3-letter language code for de_at
at java.util.Locale.getISO3Language(Unknown Source)
at com.test.rupesh.CQInstanceHelper.language(Main.java:74)
at com.test.rupesh.Main.main(Main.java:20)
答案 0 :(得分:3)
你准备用de_AT做什么?
Locale austria = new Locale("de", "AT");
System.out.println("Locale=" + austria);
System.out.println("ISO3 language=" + austria.getISO3Language());
打印出来:
Locale=de_AT
ISO3 language=deu
编辑:不要以这种方式实例化语言环境:
Locale austria = new Locale("de_AT");
System.out.println("Locale=" + austria);
System.out.println("ISO3 language=" + austria.getISO3Language());
打印出来:
Locale=de_at
Exception in thread "main" java.util.MissingResourceException: Couldn't find 3-letter language code for de_at
at java.util.Locale.getISO3Language(Locale.java:568)
at Scribble.main(Test.java:10)
答案 1 :(得分:0)
使用此
检查可用位置System.out.println(Arrays.asList(Locale.getAvailableLocales()));