java.util.Locale making Country LowerCase

梦想与她 提交于 2019-12-11 12:58:20

问题


I am setting

java.util.Locale localeWithoutCountryCode = new Locale("fr_FR");

But when I retrieve its value, it returns me "fr_fr" ( Lowercase country) and this is causing my message lookups to fail. I want it to keep the country case as is.


回答1:


The single-argument constructor for Locale takes exactly an ISO language as its parameter; you're passing in a language and variant. Use new Locale("fr", "FR") instead.

If this is hard-coded for some reason, you can just use Locale.FRANCE.



来源:https://stackoverflow.com/questions/20435143/java-util-locale-making-country-lowercase

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!