|
|
Start of Tutorial > Start of Trail |
Search
Feedback Form |
An internationalized program can display information differently throughout the world. For example, the program will display different messages in Paris, Tokyo, and New York. If the localization process has been fine-tuned, the program will display different messages in New York and London to account for the differences between American and British English. How does an internationalized program identify the appropriate language and region of its end users? Easy. It references aLocaleobject.A
Localeobject is an identifier for a particular combination of language and region. If a class varies its behavior according toLocale, it is said to be locale-sensitive. For example, theNumberFormatclass is locale-sensitive; the format of the number it returns depends on theLocale. ThusNumberFormatmay return a number as 902 300 (France), or 902.300 (Germany), or 902,300 (United States).Localeobjects are only identifiers. The real work, such as formatting and detecting word boundaries, is performed by the methods of the locale-sensitive classes.The following sections explain how to work with
Localeobjects:
When creating a Locale object, you usually specify a
language code and a country code. A third parameter, the variant, is
optional.
Locale-sensitive classes support only certainLocaledefinitions. This section shows you how to determine whichLocaledefinitions are supported.
On the Java platform you do not specify a globalLocaleby setting an environment variable before running the application. Instead you either rely on the default Locale or assign aLocaleto each locale-sensitive object.
|
|
Start of Tutorial > Start of Trail |
Search
Feedback Form |
Copyright 1995-2004 Sun Microsystems, Inc. All rights reserved.