简体   繁体   中英

java.util.Locale making Country LowerCase

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM