Java.util.Locale making Country LowerCase

I install

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

But when I return its value, it returns to me "fr_fr"(lowercase country), and this leads to the failure of my messages. I want him to keep the country's business as it is.

+1
source share
1 answer

A constructor with one argument for Localeaccepts the ISO language as a parameter; you convey the language and option. Use instead new Locale("fr", "FR").

If for some reason this is hardcoded, you can just use Locale.FRANCE.

+2
source

Source: https://habr.com/ru/post/1679593/


All Articles