Locale
object.
A Locale
object is an identifier for a particular
combination of language and region. If a class varies its behavior
according to Locale
, it is said to be
locale-sensitive. For example, the NumberFormat
class is locale-sensitive; the format of the number it returns depends
on the Locale
. Thus NumberFormat
may return a
number as 902 300 (France), or 902.300 (Germany), or 902,300 (United
States). Locale
objects 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 Locale
objects:
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 certainLocale
definitions. This section shows you how to determine whichLocale
definitions are supported.
On the Java platform you do not specify a globalLocale
by setting an environment variable before running the application. Instead you either rely on the default Locale or assign aLocale
to each locale-sensitive object.
This section explains how to enable plug-in of locale-dependent data and services. These SPIs provides support of more locales in addition to the currently available locales.