Overview of Mustang's internationalization features
Members of Sun's Java internationalization team were present at International Unicode Conference (IUC) 28 this past week. They described several of the new features in Mustang, Java SE 6.
- locale sensitive services spi
- normalizer api
- ResourceBundle enhancements
- Japanese calendar support
- New supported locales
- IDN support
Locale Sensitive Services SPI
Sun already provides date, time, and number formatting services for dozens of locales. However, if you need support for a unprovided locale, you can't do much about it now. Mustang will change that by providing a service provider interface (SPI) for locale sensitive services.
Before searching or sorting text, you must normalize the text to account for code points that should be considered as the same character. Normalization has always occured under the covers when you sort text, but the Normalizer will be available to everyone in Mustang. The Normalizer will support four different normalization forms: NFD, NFC, NFKD, NFKC.
ResourceBundles allow you to extract localizable text and other content from application business logic. Until Mustang, you had only two forms of bundles: ListResourceBundle or PropertyResourceBundle. These bundle types have specific loading mechanisms and resource search strategies. The Mustang enhancements will provide you with much more control over the file format of bundles. Also, you will be able to control how bundles are searched and loaded.
Japanese Calendar Support
Althought the Gregorian calendar is not the only calendar system in the world, it is arguably the most prominent calendar used around the globe...at least in Java applications. That's because the Java platform provides only a few alternative calendar systems. However, given the opportunity, users might use other calendar systems if they were available. For example, Japanese users may prefer their Imperial calendar. Islamic users may prefer a Hijri calendar. Mustang doesn't yet provide a Hijri calendar, but it will provide Japanese Imperial calendar support in Mustang. Over time, the number of calendars is expected to increase even more.
Although you'll be able to add your own locale data in Mustang, Java engineers have added support for a few new Locales:
- Simplified Chinese in Singapore
- English in Malta, Philippines, and Singapore
- Greek in Cyprus
- Maltese in Malta
- Indonesian in Indonesia
- Spanish in the U.S.
The Unicode Common Locale Data Repository provides the data for these additions.
Internationalized Domain Names (IDN)
Since the W3C's latest specs for domain names allow non-ASCII characters, a new class in the
java.net package will be available in Mustang to support those characters. The key RFCs that describe the required support are RFC 3490, 3491, 3454, and 3492. The
java.net.IDN uses the algorithms described in those RFCs to support domain names in various writing sytems.
SPIs are Excellent Answers
I was most impressed by the fact that the Java i18n team has found a way to provide new locale support indirectly. They've opened up the system to allow those demanding customers to add support themselves whenever the Sun engineers can't do it themselves. I think this is a great solution, and I'm anxious to see how the combination of the Locale Sensitive Services SPI and the Peabody initiative will affect the number of supported locales in Mustang and subsequent releases. Will the SPI and newly encouraged community combine to provide even more locale support after Mustang?