Previous | Next | Trail Map | Writing Global Programs | Internationalization? Localization? Arg!


The Global Features of the JDK

As you saw on the previous page, even a small applet such as the WordMatch applet poses many problems to the global programmer. Fortunately, JDK 1.1 contains many features to help you combate these problems and create global programs with little effort.

The following list describes the features in the JDK 1.1 that help you solve the problems listed on the previous page.

Solution to Problem One: The Locale Class

To identify the user's language and country, JDK 1.1 provides the new Locale class.

In Java, locales are not a global attribute of the whole program. Rather, each locale-sensitive object maintains its own locale-specific information. Locale-sensitive operations require a Locale object as an argument. This design is quite flexible and, in addition to other nifty things, allows a program to use and display multiple Locales at the same time. What Are Locales and How Do I Use Them? later in this lesson covers the Locale class and its use.

In addition, the JDK itself supports many of the more common locales, such as France, Germany, the various regions of Canada and so on.

Solution to Problem Two: ResourceBundles

Java provides several classes that help you bundle resources, such as strings and other language-dependent objects, within your global programs. Managing Locale-Sensitive Data covers managing strings and other objects in a language-independent manner.

Solution to Problem Three: The Format Classes

As with the WordMatch program, formatting messages is another locale-sensitive feature of many programs. Other data types, such as numbers and dates, must also be formatted in a locale-sensitive way. For example, what date does the following represent: 12/1/97? Your answer depends on where you live. In some locales, the date is December 1, 1997, in others, January 12, 1997. A significant difference if you're talking about deadlines or a child's birthday.

The JDK 1.1 provides several classes that allow a program to display dates, numbers, and messages in a locale-sensitive way. These features of the JDK are covered thorougly in How to Format Numbers, Dates and Times, and Messages.

Solution to Problem Four: The Collation Class

The Collation class is new for 1.1 and provides the ability to compare strings in a language-sensitive manner. This capability allows programs to sort text and perform language-sensitive searching.

The Collation and Text Boundaries lesson is under construction. Currently, it contains two demo programs by Taligent that show off the JDK's collation and text boundary features.

Solution to Problem Five: Unicode

As always, you write Java programs in Unicode--a 16-bit international character encoding standard. Unicode has the capacity to represent over 65,000 characters--ample enough to include characters for most of today's spoken languages.

However, previous releases of the JDK could only display characters in the Latin-1 subset of Unicode. Now, with JDK 1.1, your Java programs can display any Unicode character that can be rendered with a host font.

[PENDING: link to lesson covering Unicode and other character-encoding issues]

The above list describes the JDK 1.1 features that solve the most common problems programmers will encounter when writing a global program. In addition to these, programmers writing longer, more complex programs may have even more issues to consider: Character handling, text boundaries, other character encodings, and so on. The JDK 1.1 includes other enhancements that authors of larger more complex programs may need to help them write global programs:


Previous | Next | Trail Map | Writing Global Programs | Internationalization? Localization? Arg!