Internationalize your software, Part 3
Learn how to develop software for the global marketplace
By Jeff Friesen, JavaWorld.com, 02/01/99
- Digg
- Reddit
- SlashDot
- Stumble
- del.icio.us
- Technorati
- dzone
Last month, I presented the second part of a three-part series exploring the development of Java-based software for an international
audience.
Part 2 provided a complete list of Java's internationalization and localization classes -- as of JDK 1.1.6 -- and introduced the
concept of an "umbrella" class. We explored character properties, string comparisons, and character-, line-, sentence-, and
word-break detection. We saw how to set the default locale via the host computer's operating system (Windows 95 was used as
an example) and continued to explore resource bundles -- specifically, we learned how to store image data in a list resource
bundle.
Read the whole "Internationalize Your Software" series:
Part 3 closes the internationalization series with an expansion of the material presented in Part 2, including:
- Dates, time zones, and calendars
- Formatters
- International fonts and non-Unicode text
- Beyond JDK 1.1.6
In Part 1 of this series, I included calendars on a list of items requiring localization. In Part 3, we're going to examine calendars,
along with dates and time zones, from Java's perspective.
How do we display numbers, dates, and messages, according to the conventions of different locales, without writing lots of
code? We'll answer this question by examining Java's formatter classes. As we'll see, it's possible to use these same classes
to parse user input in a locale-sensitive manner.
So far, we haven't seen an applet that displays Chinese, Arabic, Hebrew, or Japanese characters. Why? We'll find out when
we explore international fonts and non-Unicode text.
And finally, although this series has been based on JDK 1.1.6, we'll move beyond JDK 1.1.6 and explore new internationalization
features that have been introduced in JDK 1.1.7 and what's now known as the Java 2 platform (previously JDK 1.2).
In this article, Java applets are used to illustrate Java's internationalization and localization features. These applets
were compiled with the JDK 1.1.6 compiler and tested with the JDK 1.1.6 appletviewer and Netscape Navigator 4.06 programs. Netscape was running version 1.1.5 of the Java runtime environment during testing.
Dates, time zones, and calendars
Many Java programs work with the concept of time. For example, one program might measure the interval between two events while
another is designed to calculate a person's age. Different cultures tend to measure time in standardized units such as minutes
and days. However, they don't all use the same calendar. For example, one culture might use the Gregorian calendar while another
uses the 13-month lunar calendar. And we need to make sure that our international software takes this varying calendar usage
into account, so that it exhibits consistent behavior for the particular locale in which it's used.
- Digg
- Reddit
- SlashDot
- Stumble
- del.icio.us
- Technorati
- dzone
Resources
- More information on calendars is available in The Calendar FAQ http://www.pip.dknet.dk/~pip10160/calendar.html
- An interesting overview article on internationalization is available at http://developer.java.sun.com/developer/technicalArticles/intl.html
- The official Unicode Web site contains a wealth of information on this character definition standard http://www.unicode.org
- IBM has a "cookbook" on creating global applications http://www.ibm.com/java/education/globalapps/index.html
- Sun offers a tutorial on Java, The Java Tutorial, that contains a really good section on internationalization http://java.sun.com/docs/books/tutorial/index.html
- A complete list of ISO-639 language codes is available at http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
- A complete list of ISO-3166 country codes is available at http://www.ics.uci.edu/pub/ietf/http/related/iso3166.txt
- An interesting article on localization with resource bundles is available at http://developer.java.sun.com/developer/technicalArticles/ResourceBundles.html
- You can translate text from one language to another from this site http://babelfish.altavista.com/cgi-bin/translate?
- Note: Two of the Resources links take you to Sun's Java Developer Connection site. You need to be a member of the Java Developer Connection in order
to view articles, and you will be prompted to enter a user ID and password the first time you access this site. There is no
charge to become a member. You can register when prompted to enter a user ID/password.