Previous | Next | Trail Map | Writing Global Programs | Table of Contents


Locale-Sensitive Data

As you saw in the previous lesson, the 1.1 release of the JDK has several new features to help you write global programs. That is, programs that tailor themselves to the user's customs and language. The applet running below, called AroundTheWorld, uses these new features of the JDK to display information about various places in the world in a way that is appropriate for users in that area.


Note: The internationalization features documented in this lesson were added to the JDK for its 1.1 release. Thus the AroundTheWorld applet will work only in browsers or viewers that support JDK 1.1. If your browser does not support JDK 1.1 applets, you can use the appletviewer program that ships with JDK 1.1 to run the program. Or you can run it as a stand-alone program using the 1.1 java interpreter.

Since you can't run the applet, here's a picture of it:

Through the AroundTheWorld applet, this lesson shows you how to organize and manage locale-sensitive data in your Java programs and how to format dates, numbers, and messages.

Exploring AroundTheWorld

First, you should get familiar with the source code to the AroundTheWorld applet. Later, we'll walk through the source code looking at how it manages and formats its data with new JDK 1.1 features.

What Are Locales and How Do I Use Them?

The JDK 1.1 provides a Locale class that represents a specific geographic or political region. A Locale object is just an identifier--it contains information about the locale (such as its language and country) but does not contain any data for the locale.

Managing Locale-Sensitive Data

A global program isolates locale-sensitive data and localizes them. That is, a global program isolates locale-sensitive data into localized ResourceBundles.

Representing Dates and Times

[PENDING]

How to Format Numbers, Dates and Times, and Messages

Dates and numbers are locale-sensitive--different people format dates and numbers differently whether it's the order in which the date elements are listed or the symbol used as the decimal point. In addition, instructions, errors, and other messages that the user sees need to be formatted in a flexible and global manner. The JDK 1.1 provides a set of date, number, and message formatters.


Previous | Next | Trail Map | Writing Global Programs | Table of Contents