java.lang.Object | |
↳ | java.util.Locale |
Locale
represents a language/country/variant combination. It is an identifier
which dictates particular conventions for the presentation of information.
The language codes are two letter lowercase codes as defined by ISO-639. The
country codes are three letter uppercase codes as defined by ISO-3166. The
variant codes are unspecified.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Locale | CANADA | Locale constant for en_CA. | |||||||||
Locale | CANADA_FRENCH | Locale constant for fr_CA. | |||||||||
Locale | CHINA | Locale constant for zh_CN. | |||||||||
Locale | CHINESE | Locale constant for zh. | |||||||||
Locale | ENGLISH | Locale constant for en. | |||||||||
Locale | FRANCE | Locale constant for fr_FR. | |||||||||
Locale | FRENCH | Locale constant for fr. | |||||||||
Locale | GERMAN | Locale constant for de. | |||||||||
Locale | GERMANY | Locale constant for de_DE. | |||||||||
Locale | ITALIAN | Locale constant for it. | |||||||||
Locale | ITALY | Locale constant for it_IT. | |||||||||
Locale | JAPAN | Locale constant for ja_JP. | |||||||||
Locale | JAPANESE | Locale constant for ja. | |||||||||
Locale | KOREA | Locale constant for ko_KR. | |||||||||
Locale | KOREAN | Locale constant for ko. | |||||||||
Locale | PRC | Locale constant for zh_CN. | |||||||||
Locale | SIMPLIFIED_CHINESE | Locale constant for zh_CN. | |||||||||
Locale | TAIWAN | Locale constant for zh_TW. | |||||||||
Locale | TRADITIONAL_CHINESE | Locale constant for zh_TW. | |||||||||
Locale | UK | Locale constant for en_GB. | |||||||||
Locale | US | Locale constant for en_US. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new
Locale using the specified language. | |||||||||||
Constructs a new
Locale using the specified language and country codes. | |||||||||||
Constructs a new
Locale using the specified language, country, and
variant codes. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a new
Locale with the same language, country and variant codes as
this Locale . | |||||||||||
Compares the specified object to this
Locale and returns whether they are
equal. | |||||||||||
Gets the list of installed
Locale . | |||||||||||
Gets the country code for this
Locale or an empty string of no country
was set. | |||||||||||
Gets the default
Locale . | |||||||||||
Gets the full country name in the specified
Locale for the country code
of this Locale . | |||||||||||
Gets the full country name in the default
Locale for the country code of
this Locale . | |||||||||||
Gets the full language name in the default
Locale for the language code
of this Locale . | |||||||||||
Gets the full language name in the specified
Locale for the language code
of this Locale . | |||||||||||
Gets the full language, country, and variant names in the default
Locale
for the codes of this Locale . | |||||||||||
Gets the full language, country, and variant names in the specified
Locale for the codes of this
Locale . | |||||||||||
Gets the full variant name in the specified
Locale for the variant code
of this Locale . | |||||||||||
Gets the full variant name in the default
Locale for the variant code of
this Locale . | |||||||||||
Gets the three letter ISO country code which corresponds to the country
code for this
Locale . | |||||||||||
Gets the three letter ISO language code which corresponds to the language
code for this
Locale . | |||||||||||
Gets the list of two letter ISO country codes which can be used as the
country code for a
Locale . | |||||||||||
Gets the list of two letter ISO language codes which can be used as the
language code for a
Locale . | |||||||||||
Gets the language code for this
Locale or the empty string of no language
was set. | |||||||||||
Gets the variant code for this
Locale or an empty String of no variant
was set. | |||||||||||
Returns an integer hash code for the receiver.
| |||||||||||
Sets the default
Locale to the specified Locale . | |||||||||||
Returns the string representation of this
Locale . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Constructs a new Locale
using the specified language.
language | the language this Locale represents.
|
---|
Constructs a new Locale
using the specified language and country codes.
language | the language this Locale represents. |
---|---|
country | the country this Locale represents.
|
Constructs a new Locale
using the specified language, country, and
variant codes.
language | the language this Locale represents. |
---|---|
country | the country this Locale represents. |
variant | the variant this Locale represents. |
NullPointerException | if language , country , or
variant is null .
|
---|
Returns a new Locale
with the same language, country and variant codes as
this Locale
.
Locale
.Compares the specified object to this Locale
and returns whether they are
equal. The object must be an instance of Locale
and have the same
language, country and variant.
object | the object to compare with this object. |
---|
true
if the specified object is equal to this Locale
,
false
otherwise.Gets the list of installed Locale
. At least a Locale
that is equal to
Locale.US
must be contained in this array.
Locale
s.
Gets the country code for this Locale
or an empty string of no country
was set.
Gets the default Locale
.
Locale
.
Gets the full country name in the specified Locale
for the country code
of this Locale
. If there is no matching country name, the country code is
returned.
locale | the Locale for which the display name is retrieved. |
---|
Gets the full country name in the default Locale
for the country code of
this Locale
. If there is no matching country name, the country code is
returned.
Gets the full language name in the default Locale
for the language code
of this Locale
. If there is no matching language name, the language code
is returned.
Gets the full language name in the specified Locale
for the language code
of this Locale
. If there is no matching language name, the language code
is returned.
locale | the Locale for which the display name is retrieved. |
---|
Gets the full language, country, and variant names in the default Locale
for the codes of this Locale
.
Locale
name.
Gets the full language, country, and variant names in the specified
Locale for the codes of this Locale
.
locale | the Locale for which the display name is retrieved. |
---|
Locale
name.
Gets the full variant name in the specified Locale
for the variant code
of this Locale
. If there is no matching variant name, the variant code is
returned.
locale | the Locale for which the display name is retrieved. |
---|
Gets the full variant name in the default Locale
for the variant code of
this Locale
. If there is no matching variant name, the variant code is
returned.
Gets the three letter ISO country code which corresponds to the country
code for this Locale
.
MissingResourceException | if there is no matching three letter ISO country code. |
---|
Gets the three letter ISO language code which corresponds to the language
code for this Locale
.
MissingResourceException | if there is no matching three letter ISO language code. |
---|
Gets the list of two letter ISO country codes which can be used as the
country code for a Locale
.
Gets the list of two letter ISO language codes which can be used as the
language code for a Locale
.
Gets the language code for this Locale
or the empty string of no language
was set.
Gets the variant code for this Locale
or an empty String
of no variant
was set.
Returns an integer hash code for the receiver. Objects which are equal return the same value for this method.
Sets the default Locale
to the specified Locale
.
locale | the new default Locale . |
---|
SecurityException | if there is a SecurityManager in place which does not allow this
operation.
|
---|
Returns the string representation of this Locale
. It consists of the
language followed by the country and at the end the variant. They are
separated by underscores. If the language is missing the string begins
with an underscore. If the country is missing there are 2 underscores
between the language and the variant. the variant alone canot be defined
without a language and/or a country (in this case this method would
return the empty string).
Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"
Locale
.