Read the javadoc for java.util Locale .
It says: "Create a Locale object using the constructors in this class:"
It also says: "Because the Locale object is just an identifier for a region, validation fails when you build the locale."
It also says: "Locale is a mechanism for identifying the type of object (NumberFormat) you want to get. A locale is just a mechanism for identifying objects, not a container for the objects themselves."
And finally, javadoc for the getAvailableLocales () method says: "The returned array represents the union of the locales supported by the Java runtime and the installed LocaleServiceProvider implementations"
So, you just need to come up with a language code that is not on the standard list, and use it as an identifier for your locale.
Jb nizet
source share