Name
Locale
Synopsis
The Locale
class
represents a locale: a political, geographical, or cultural region
that typically has a distinct language and distinct customs and
conventions for such things as formatting dates, times, and numbers.
The Locale
class defines a number of constants
that represent commonly used locales. Locale
also
defines a static getDefault( )
method that returns
the default Locale
object, which represents a
locale value inherited from the host system.
getAvailableLocales( )
returns the list of all
locales supported by the underlying system. If none of these methods
for obtaining a Locale
object are suitable, you
can explicitly create your own Locale
object. To
do this, you must specify a language code and optionally a country
code and variant string. getISOCountries( )
and
getISOLanguages( )
return the list of supported
country codes and language codes.
The Locale
class does not implement any
internationalization behavior itself; it merely serves as a locale
identifier for those classes that can localize their behavior. Given
a Locale
object, you can invoke the various
getDisplay
methods to obtain a description of the
locale suitable for display to a user. These methods may themselves
take a Locale
argument, so the names of languages
and countries can be localized as appropriate.
Figure 16-42. java.util.Locale
public final class Locale implements Cloneable, Serializable ...
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.