More than 300 locales in Java!

I am going to give a presentation at the upcoming Internationalization and Unicode Conference held in Washington D.C. next month. The main topic of the presentation is the new i18n features in the upcoming Java 6, and now I am preparing a demo to showcase the potential of the Locale Sensitive Services SPI feature (I know. Kinda long name), which I wrote in the previous entry (wow, it was 8 months ago :-)

The demo consists of two components. One is just a simple Swing application which displays a list of available locales in the platform (precisely, a list returned from Locale.getAvailableLocales()), and displays formatted dates, times, numbers, currencies, or language/country/timezone names in a particular locale which is selected in the locale list.

The other component is invisible, but more interesting one. That is, an adapter which reads the CLDR's locale data in XML format, then it transforms the locale data and plugs them into the Java runtime through the Locale Sensitive Services SPI. Although Java currently do not support three letter language codes defined in ISO 639-2 so some locales may not be plugged in, but still we have more than 300 locales available in the Java text processing classes with this CLDR adapter!

Here is a preview of the demo. This demonstrates the date and time formatting in the Tamil (India) locale, which the Java runtime does not yet support out of the box:

Click to enlarge

Note that since Java does not support Tamil, it does not contain the suitable font either. However, the OS I used for running this demo was Windows XP, which contains fonts that are capable for displaying Tamil such as "Latha" font. And with the "font fallback" mechanism we introduced in Java 5.0, the demo worked like a charm with the formatted date and time, which are derived from the CLDR data.

Here is another screen shot of the demo, which displays date and time in Amharic (Ethiopia) locale.

Click to enlarge

For this demo, since Windows XP does not support Amharic, I used an open source TrueType font for Amharic called "Jiret", which is available here.

If you are interested, and planning to be at the next Unicode conference, please come to our presentation. I am sure I can show you more interesting bits!

Comments:

Good to see Tamil on Java. But the line 'not supported out of box' is a disappointment. :-( Any one knows when Java can support Tamil (and other Indic languages) out of box? Siva

Posted by Sivakumar S on October 30, 2006 at 12:53 PM PST #

Hi,

Yes, the locale-sensitive date formatter in 1.5/6 does not seem to understand how to do proper 2006 <month> 10 <day> 31 formatting for ja/zh, where <month> and <day> are the approriate single (UNICODE) chars.

Rgds

Damon

Posted by Damon Hart-Davis on October 30, 2006 at 06:31 PM PST #

At the moment, Hindi is the only officially supported locales in Java, however, if we see a lot of demands/request for supporting other Indic languages, we are pretty much open to those requests. Also, It'd be great to see the community participation for supporting those languages when we opensource Java.

Posted by Naoto Sato on October 31, 2006 at 03:13 AM PST #

In the 'FULL' style of Japanese/Chinese date formatting, it is formatted by Java as "yyyy<year>M<month>d<day>", which seems the right formatting for those languages to me. Do you have any reference that demonstrates the pattern you provided is popularly used?

Posted by Naoto Sato on October 31, 2006 at 03:22 AM PST #

Hi,

(1) I will re-check my assertion since I am almost certainly wrong.

(2) Explicitly try FULL format (I usually use more compact formats), since this is how I may not have seen any of the expected characters.

The problem may well lie in my ignorance rather than in the JDK!

Rgds

Damon

Posted by Damon Hart-Davis on October 31, 2006 at 07:00 PM PST #

Post a Comment:
Comments are closed for this entry.
About

naotoj

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
News

No bookmarks in folder

Blogroll