Previous | Next | Trail Map | Writing Global Programs | Locale-Sensitive Data


Exploring AroundTheWorld

When you first invoke AroundTheWorld you see a window that looks like this:

You use the flag symbols at the top of the window to choose a new locale. The currently selected locale is indicated by a thick border around the flag. When you select a new locale, the window changes to display useful tidbits of information about that locale: the name of the locale, today's date, the current time in a city representative of the locale, the per capita GDP, the population, the literacy rate, and a brief paragraph describing the region. (These tidbits were retrieved from the CIA's 1994 World Fact book on the Internet).

In addition to the facts displayed about each locale, AroundTheWorld lets you to play the words book, car, dog, and apple in the language that is dominant in the selected locale. Note: this works only if you are running AroundTheWorld as an applet. Sounds aren't available to stand-alone programs. (Our thanks to Patrick Chan for writing the WordMatch applet from which we swiped these images and sounds.)

AroundTheWorld is a global program--it's completely internationalized and it's been localized for three locales: the United States, France, and the United Kingdom.

The Classes

The IntlWindow class implements the main window of the program. This window is divided into two functional areas. The first area, shown below, is the control area. The objects in the control area (panels, canvases, and images) are shared by all locales.

The rest of the window is the display area.

The display area is laid out by a CardLayout object which helps you manage two or more components that share the same display space. In the AroundTheWorld applet, the CardLayout manages three LinguaPanels, one for each supported locale. Each LinguaPanel contains the GUI elements for displaying the information for that locale. When the user chooses a new locale, the CardLayout object shows the appropriate LinguaPanel. Thus the bulk of the globalized code is in the LinguaPanel class. (For complete information about CardLayout and for another example that uses one, see How to Use CardLayout.)

The data that you see and hear in the display area is locale-sensitive and is contained in ResourceBundles.

AroundTheWorld defines four different ResourceBundle ancestors:

When a LinguaPanel needs to display information, it retrieves the information from the resource bundle that contains the appropriate data. Thus, all the locale-specific data for the program is isolated in resource bundles and is not intermingled with other, locale-independent code.

AroundTheWorld uses several of the internationalization features of the JDK 1.1, including locales, resource bundles, calendar (and time zone) support, and formatting of date, currency, percent, and number data.

Future Improvements to AroundTheWorld


Previous | Next | Trail Map | Writing Global Programs | Locale-Sensitive Data