Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Locale doesn't exists in Java

Tags:

java

locale

I am from Turkmenistan and I used JDatePicker to get a date. Is it possible to use the Turkmen locale in Java?

like image 826
serdar Avatar asked Jan 31 '12 12:01

serdar


People also ask

How do I get the 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.

What is locale in Java?

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.

What is locale root Java?

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.


2 Answers

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.

like image 135
Thilo Avatar answered Oct 19 '22 12:10

Thilo


Take a look to this answer Missing Locales in Java?, that give you a clue to your problem.

like image 42
jenaiz Avatar answered Oct 19 '22 12:10

jenaiz