I am from Turkmenistan and I used JDatePicker to get a date. Is it possible to use the Turkmen locale in Java?
To get equivalent information in Java, use Locale. getDefault() to get the Locale that Java is using, and use methods on the Locale object such as getCountry() , getLanguage() to get details. The information is available using ISO codes and as human readable/displayable names.
A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user.
The root locale is the locale whose language, country, and variant are empty ("") strings. This is regarded as the base locale of all locales, and is used as the language/country neutral locale for the locale sensitive operations.
I don't know how to add a complete new Locale to the JRE (sounds like a lot of work), but you can localize the Swing components that you need with arbitrary message bundles. And I suppose you would need to also write a custom DateFormatter.
Take a look to this answer Missing Locales in Java?, that give you a clue to your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With