I am from Turkmenistan and I used JDatePicker to get a date. Is it possible to use the Turkmen locale in Java?
Asked
Active
Viewed 1,006 times
14
-
Are you sure your locale isn't supported? - http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html – mre Jan 31 '12 at 12:54
-
What did you try? What was the result? What didn't work? – Jan 31 '12 at 12:54
-
4@mre: Cannot find "turkmen" (tk-TM) on that list, so I think it really does not ship with Java. – Thilo Jan 31 '12 at 12:57
-
4I tried setLocale(new Locale("tm")); but it shows in english – serdar Jan 31 '12 at 13:02
-
@serdar The language code is "tk" so it should be `new Locale("tk")` or `new Locale("tk", "TM")`. But it still doesn't exist. – Hauke Ingmar Schmidt Jan 31 '12 at 13:21
4 Answers
4
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.
1
Use java.util.TimeZone
.
Check your nearest country's timezone using the below code
for(String locale : java.util.TimeZone.getAvailableIDs())
{
System.out.println(locale);
}
convert your date picker time to this timezone.

undisputed
- 180
- 3
- 12
0
Locale is a final class, with a predefined list of Locales. I suggest you try finding a Locale which works for your situation.
The only other option is to modify a copy of the Locale class and add it to your bootclasspath or endorsed directory.

Peter Lawrey
- 525,659
- 79
- 751
- 1,130