Locale represents a specific geographical, political,
or cultural region. An API that requires a Locale to perform
its task is locale-sensitive and uses the Locale
to tailor information for the user. These locale-sensitive APIs
are principally in the java.text and java.util packages.
For example, displaying a number is a locale-sensitive operation—
the number should be formatted according to the customs and conventions of the
user's native country, region, or culture.
The Locale class implements
IETF BCP 47 which contains
RFC 4647 "Matching of Language
Tags" and RFC 5646 "Tags
for Identifying Languages" with support for the LDML (UTS#35, "Unicode
Locale Data Markup Language") BCP 47-compatible extensions for locale data
exchange. Each Locale is associated with locale data which is provided
by the Java runtime environment or any deployed LocaleServiceProvider implementations.
The locale data provided by the Java runtime environment may vary by release.
A Locale is composed of the bolded fields described below; note that a
Locale need not have all such fields. For example, Locale. is only comprised of the language field.
In contrast, a Locale such as the one returned by Locale.forLanguageTag("en-Latn-US-POSIX-u-nu-latn") would be comprised of all
the fields below. This particular Locale would represent English in
the United States using the Latin script and numerics for use in POSIX
environments.
Locale implements IETF BCP 47 and any deviations should be observed
by the comments prefixed by "BCP 47 deviation:".
RFC 5646
combines subtags from various ISO (639, 3166, 15924) standards which are also
included in the composition of Locale.
Additionally, the full list of valid codes for each field can be found in the
IANA Language Subtag Registry (e.g. search for "Type: region").
language is case insensitive, but
Locale always canonicalizes to lower case.language values have the form [a-zA-Z]{2,8}.Locale does not retain the
extlang
subtag. This is because three-letter language codes are preferred over extlang
subtags. When a Locale is created from a language tag containing an
extlang subtag, the first extlang subtag is interpreted as the language
field. The primary language subtag and any subsequent extlang subtags
are ignored.script is case insensitive, but
Locale always canonicalizes to title case (the first
letter is upper case and the rest of the letters are lower
case).script values have the form [a-zA-Z]{4}country (region) is case insensitive, but
Locale always canonicalizes to upper case.country (region) values have the form [a-zA-Z]{2} | [0-9]{3}Locale. When multiple variants exist, they should be separated by
('_'|'-'). Variants of higher importance should precede the others.Locale has
historically been used for any kind of variation, not just
language variations. For example, some supported variants
available in Java SE Runtime Environments indicate alternative
cultural behaviors such as calendar type or number script. In
BCP 47, this kind of information which does not identify the
language, is supported by extension subtags or private use
subtags.variant is case sensitive. BCP 47
deviation: BCP 47 treats the variant field as case insensitive.variant values have the form SUBTAG (('_'|'-') SUBTAG)* where SUBTAG =
[0-9][0-9a-zA-Z]{3} | [0-9a-zA-Z]{5,8}.Locale which accept
BCP 47 language tags expect as such. However, for backwards compatibility,
Locale.Builder#setVariant(String) also accepts underscore ('_').
Locale#of(String, String, String) accepts only underscore ('_').extensions in Locale implement the semantics and syntax of BCP 47
extension subtags and private use subtags. The extensions
field cannot have empty values. extensions are
case insensitive, but Locale canonicalizes all
extension keys and values to lower case.[0-9a-zA-Z]. Well-formed values have the form
SUBTAG ('-' SUBTAG)* where for the key 'x'
SUBTAG = [0-9a-zA-Z]{1,8} and for other keys
SUBTAG = [0-9a-zA-Z]{2,8} (that is, 'x' allows
single-character subtags).Locale
class does not enforce that subtags are registered in the Subtag Registry.
Builder only checks if an individual field satisfies the syntactic
requirement (is well-formed). When passed duplicate variants, Builder
accepts and includes them. When passed duplicate extension singletons, Builder accepts but ignores the duplicate key and its associated value.
Conversely, Locale::of and its
overloads do not check if the input is well-formed at all.
UTS#35, "Unicode Locale Data Markup Language" defines the Unicode BCP 47 U Extension, an extension based on RFC 6067, which describes optional attributes and keywords to override or refine the default behavior associated with a locale. A keyword is represented by a pair of key and type. For example, "nu-thai" indicates that Thai local digits (value:"thai") should be used for formatting numbers (key:"nu").
The keywords are mapped to a BCP 47 extension value using the
extension key 'u' (UNICODE_LOCALE_EXTENSION). The above
example, "nu-thai", becomes the extension "u-nu-thai".
Thus, when a Locale object contains Unicode locale
attributes and keywords,
getExtension(UNICODE_LOCALE_EXTENSION) will return a
String representing this information, for example, "nu-thai". The
Locale class also provides getUnicodeLocaleAttributes, getUnicodeLocaleKeys, and
getUnicodeLocaleType(String) which provides access to the Unicode
locale attributes and key/type pairs directly. When represented as
a string, the Unicode Locale Extension lists attributes
alphabetically, followed by key/type sequences with keys listed
alphabetically (the order of subtags comprising a key's type is
fixed when the type is defined)
A well-formed locale key has the form
[0-9a-zA-Z]{2}. A well-formed locale type has the
form "" | [0-9a-zA-Z]{3,8} ('-' [0-9a-zA-Z]{3,8})* (it
can be empty, or a series of subtags 3-8 alphanums in length). A
well-formed locale attribute has the form
[0-9a-zA-Z]{3,8} (it is a single subtag with the same
form as a locale type subtag). Duplicate locale attributes as well
as locale keys do not convey meaning. For methods in Locale and
Locale.Builder that accept extensions, occurrences of duplicate
locale attributes as well as locale keys and their associated type are accepted
but ignored.
The Unicode locale extension specifies optional behavior in locale-sensitive services. Although the LDML specification defines various keys and values, actual locale-sensitive service implementations in a Java Runtime Environment might not support any particular Unicode locale attributes or key/type pairs.
The default Locale is provided for any locale-sensitive methods if no
Locale is explicitly specified as an argument, such as
NumberFormat#getInstance(). The default Locale is determined at startup
of the Java runtime and established in the following three phases:
user.language) may
not have values from the host environment.
| Locale-related System Properties Key | Description |
|---|---|
user.language |
language for the default Locale,
such as "en" (English) |
user.script |
script for the default Locale,
such as "Latn" (Latin) |
user.country |
country for the default Locale,
such as "US" (United States) |
user.variant |
variant for the default Locale,
such as "POSIX" |
user.extensions |
extensions for the default Locale,
such as "u-ca-japanese" (Japanese Calendar) |
user.extensions property
is unparsable, it is ignored. The overriding values of other properties are not
checked for syntax or validity and are used directly in the default Locale.
(Typically, system property values can be provided using the -D command-line
option of a launcher. For example, specifying -Duser.extensions=foobarbaz
results in a default Locale with no extensions, while specifying
-Duser.language=foobarbaz results in a default Locale whose language is
"foobarbaz".)
Locale instance is constructed from the values of these
system properties.
Altering the system property values with System#setProperties(Properties)/
System#setProperty(String, String) has no effect on the default Locale.
Once the default Locale is established, applications can query the default
Locale with getDefault() and change it with setDefault(Locale).
If the default Locale is changed with setDefault(Locale), the corresponding
system properties are not altered. It is not recommended that applications read
these system properties and parse or interpret them as their values may be out of date.
There are finer-grained default Locales specific for each Locale..
These category specific default Locales can be queried by getDefault(Category),
and set by setDefault(Category, Locale). Construction of these category
specific default Locales are determined by the corresponding system properties,
which consist of the base system properties as listed above, suffixed by either
".display" or ".format" depending on the category. For example,
the value of the user.language.display system property will be used in the
language part of the default Locale for the Locale.
category. In the absence of category specific system properties, the "category-less"
system properties are used, such as user.language in the previous example.
There are several ways to obtain a Locale object.
It is advised against using the deprecated Locale constructors.
Locale
objects for commonly used locales. For example, Locale.US is the
Locale object for the United States.Locale::of and its overloads obtain a
Locale object from the given language, country,
and/or variant. forLanguageTag(String) obtains a Locale
object for a well-formed BCP 47 language tag.Builder is used to construct a Locale object that conforms
to BCP 47 syntax. Use a builder to enforce syntactic restrictions on the input.The following invocations produce Locale objects that are all equivalent:
Locale.US; Locale.of("en", "US"); Locale.forLanguageTag("en-US"); new Locale.Builder().setLanguage("en").setRegion("US").build();
Once a Locale is obtained,
it can be queried for information about itself. For example, use getCountry to get the country (or region) code and getLanguage to
get the language. getDisplayCountry can be used to get the
name of the country suitable for displaying to the user. Similarly,
use getDisplayLanguage() to get the name of
the language suitable for displaying to the user. The getDisplayXXX
methods are themselves locale-sensitive and have two variants; one with an explicit
locale parameter, and one without. The latter uses the default DISPLAY locale, so the following are equivalent :
Locale.getDefault().getDisplayCountry(); Locale.getDefault().getDisplayCountry(Locale.getDefault(Locale.Category.DISPLAY));
The Java Platform provides a number of classes that perform locale-sensitive
operations. For example, the NumberFormat class formats
numbers, currency, and percentages in a locale-sensitive manner. Classes such
as NumberFormat have several factory methods for creating a default object
of that type. These methods generally have two variants; one with an explicit
locale parameter, and one without. The latter uses the default FORMAT locale, so the following are equivalent :
NumberFormat.getCurrencyInstance(); NumberFormat.getCurrencyInstance(Locale.getDefault(Locale.Category.FORMAT));
The following example demonstrates locale-sensitive currency and date related operations under different locales :
var number = 1000; NumberFormat.getCurrencyInstance(Locale.US).format(number); // returns "$1,000.00" NumberFormat.getCurrencyInstance(Locale.JAPAN).format(number); // returns "¥1,000"" var date = LocalDate.of(2024, 1, 1); DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG).localizedBy(Locale.US).format(date); // returns "January 1, 2024" DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG).localizedBy(Locale.JAPAN).format(date); // returns "2024年1月1日"
If an application is internationalized and provides localized resources for multiple locales, it sometimes needs to find one or more locales (or language tags) which meet each user's specific preferences. Note that the term "language tag" is used interchangeably with "locale" in the following locale matching documentation.
In order to match a user's preferred locales to a set of language tags, RFC 4647 Matching of Language Tags defines two mechanisms: filtering and lookup. Filtering is used to get all matching locales, whereas lookup is to select the best matching locale. Matching is done case-insensitively. These matching mechanisms are described in the following sections.
A user's preference is called a Language Priority List and is
expressed as a list of language ranges. There are syntactically two types of
language ranges: basic and extended. See
Locale. for details.
The filtering operation returns all matching language tags. It is defined in RFC 4647 as follows: "In filtering, each language range represents the least specific language tag (that is, the language tag with the fewest number of subtags) that is an acceptable match. All the language tags in the matching set of tags will have an equal or greater number of subtags than the language range. Every non-wildcard subtag in the language range will appear in every one of the matching language tags."
There are two types of filtering: filtering for basic language ranges
(called "basic filtering") and filtering for extended language ranges
(called "extended filtering"). They may return different results by what
kind of language ranges are included in the given Language Priority List.
Locale. is a parameter to specify how filtering should
be done.
The lookup operation returns the best matching language tags. It is defined in RFC 4647 as follows: "By contrast with filtering, each language range represents the most specific tag that is an acceptable match. The first matching tag found, according to the user's priority, is considered the closest match and is the item returned."
For example, if a Language Priority List consists of two language ranges,
"zh-Hant-TW" and "en-US", in prioritized order, lookup
method progressively searches the language tags below in order to find the
best matching language tag.
If there is a language tag which matches completely to a language range above, the language tag is returned.1. zh-Hant-TW 2. zh-Hant 3. zh 4. en-US 5. en
"*" is the special language range, and it is ignored in lookup.
If multiple language tags match as a result of the subtag '*'
included in a language range, the first matching language tag returned by
an Iterator over a Collection of language tags is treated as
the best matching one.
During serialization, writeObject writes all fields to the output stream, including extensions.
During deserialization, readResolve adds extensions as described in Special Cases, only for the two cases th_TH_TH and ja_JP_JP.
The following commentary is provided for apps that want to ensure
interoperability with older releases of Locale provided by the
reference implementation.
of(String, String, String), and its overloads retain their behavior prior to the Java Runtime
Environment version 1.7. That is, a length constraint is not imposed on any of
the input parameters. Similarly, the same preservation of past behavior is largely true
for the toString() method.
Apps that previously parsed the output of toString() into language,
country, and variant fields can continue to do so (although this is strongly
discouraged). A caveat is that the variant field will have additional
information in it if script or extensions are present.
In addition, BCP 47 imposes syntax restrictions that are not
imposed by Locale's constructors. This means that conversions
between some Locales and BCP 47 language tags cannot be made without
losing information. Thus toLanguageTag cannot
represent the state of locales whose language, country, or variant
do not conform to BCP 47.
Because of these issues, it is recommended that apps migrate
away from constructing non-conforming locales and use the
forLanguageTag(String) and Locale. APIs instead.
Apps desiring a string representation of the complete locale can
then always rely on toLanguageTag for this purpose.
For compatibility reasons, two
non-conforming locales are treated as special cases. These are
ja_JP_JP and th_TH_TH. These are ill-formed
in BCP 47 since the variants are too short. To ease migration to BCP 47,
these are treated specially during construction. These two cases (and only
these) cause a constructor to generate an extension, all other values behave
exactly as they did prior to Java 7.
Java has used ja_JP_JP to represent Japanese as used in
Japan together with the Japanese Imperial calendar. This is now
representable using a Unicode locale extension, by specifying the
Unicode locale key ca (for "calendar") and type
japanese. When the Locale constructor is called with the
arguments "ja", "JP", "JP", the extension "u-ca-japanese" is
automatically added.
Java has used th_TH_TH to represent Thai as used in
Thailand together with Thai digits. This is also now representable using
a Unicode locale extension, by specifying the Unicode locale key
nu (for "number") and value thai. When the Locale
constructor is called with the arguments "th", "TH", "TH", the
extension "u-nu-thai" is automatically added.
For compatibility, a Locale created with one of the
three obsolete language codes, iw, ji, or in,
will map the language to its modern equivalent, he, yi,
or id, respectively.
The default resource bundle lookup mechanism also implements
this mapping, so that resources can be named using either convention,
see ResourceBundle..
Implementation Note
Builder, ResourceBundle, java.text.Format , java.text.NumberFormat , java.text.Collator
| Modifier and Type | Class and Description |
|---|---|
| public static class | Locale.
|
| public static enum | Locale.
Enum for locale categories. |
| public static enum | Locale.
This enum provides constants to select a filtering mode for locale matching. |
| public static enum | Locale.
Enum for specifying the type defined in ISO 3166. |
| public static class | Locale.
This class expresses a Language Range defined in RFC 4647 Matching of Language Tags. |
| private static class | |
| private static class | Locale.
Obtains a localized locale names from a LocaleNameProvider implementation. |
| Modifier and Type | Field and Description |
|---|---|
| private transient BaseLocale | |
| public static final Locale | CANADA
Useful constant for country. |
| public static final Locale | CANADA_FRENCH
Useful constant for country. |
| public static final Locale | CHINA
Useful constant for country. |
| public static final Locale | CHINESE
Useful constant for language. |
| private static final Map | |
| private static volatile Locale | |
| private static volatile Locale | |
| private static volatile Locale | |
| private static final int | |
| private static final int | DISPLAY_LANGUAGE
Display types for retrieving localized names from the name providers. |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| public static final Locale | ENGLISH
Useful constant for language. |
| public static final Locale | FRANCE
Useful constant for country. |
| public static final Locale | FRENCH
Useful constant for language. |
| public static final Locale | GERMAN
Useful constant for language. |
| public static final Locale | GERMANY
Useful constant for country. |
| private transient int | hashCodeValue
Calculated hashcode |
| public static final Locale | ITALIAN
Useful constant for language. |
| public static final Locale | ITALY
Useful constant for country. |
| public static final Locale | JAPAN
Useful constant for country. |
| public static final Locale | JAPANESE
Useful constant for language. |
| public static final Locale | KOREA
Useful constant for country. |
| public static final Locale | KOREAN
Useful constant for language. |
| private final transient LazyConstant | |
| private static final LazyConstant | |
| private static final Function | |
| private transient LocaleExtensions | |
| public static final Locale | PRC
Useful constant for country. |
| public static final char | PRIVATE_USE_EXTENSION
The key for the private use extension ('x'). |
| public static final Locale | ROOT
Useful constant for the root locale. |
| private static final ObjectStreamField[] | |
| pack-priv static final long | serialVersionUID
serialization ID |
| public static final Locale | SIMPLIFIED_CHINESE
Useful constant for language. |
| public static final Locale | TAIWAN
Useful constant for country. |
| public static final Locale | TRADITIONAL_CHINESE
Useful constant for language. |
| public static final Locale | UK
Useful constant for country. |
| public static final char | UNICODE_LOCALE_EXTENSION
The key for Unicode locale extension ('u'). |
| public static final Locale | US
Useful constant for country. |
| Access | Constructor and Description |
|---|---|
| private | Locale(BaseLocale baseLocale, LocaleExtensions extensions)
Private constructor used by getInstance method |
| public | Locale(String
An ISO 639 alpha-2 or alpha-3 language code, or a language subtag
up to 8 characters in length. See the language, String Locale class description about
valid language values.An ISO 3166 alpha-2 country code or a UN M.49 numeric-3 area code.
See the country, String Locale class description about valid country values.Any arbitrary value used to indicate a variation of a variant)Locale.
See the Locale class description for the details.
Deprecated
since 19. Locale constructors have been deprecated. See Obtaining a Locale for other options.
Construct a locale from language, country and variant. |
| public | Locale(String
An ISO 639 alpha-2 or alpha-3 language code, or a language subtag
up to 8 characters in length. See the language, String Locale class description about
valid language values.An ISO 3166 alpha-2 country code or a UN M.49 numeric-3 area code.
See the country)Locale class description about valid country values.
Deprecated
since 19. Locale constructors have been deprecated. See Obtaining a Locale for other options.
Construct a locale from language and country. |
| public | Locale(String
An ISO 639 alpha-2 or alpha-3 language code, or a language subtag
up to 8 characters in length. See the language)Locale class description about
valid language values.
Deprecated
since 19. Locale constructors have been deprecated. See Obtaining a Locale for other options.
Construct a locale from a language code. |
| Modifier and Type | Method and Description |
|---|---|
| public static Stream | |
| public static String | Returns: a case folded IETF BCP 47 language tagthe IETF BCP 47 language tag. languageTag)Returns a case folded IETF BCP 47 language tag. |
| public Object | |
| private String | |
| private static String | |
| private static Locale | createConstant(byte baseType)
This method must be called only for creating the Locale.* constants due to making shortcuts. |
| public boolean | Returns: true if this Locale is equal to the specified object.Overrides java. Returns true if this Locale is equal to another object. |
| public static List | Returns: a list ofLocale instances for matching language tags
sorted in descending order based on priority or weight, or an empty
list if nothing matches. The list is modifiable.user's Language Priority List in which each language
tag is sorted in descending order based on priority or weight priorityList,Locale instances used for matchingfiltering mode modeReturns a list of matching |
| public static List | Returns: a list ofLocale instances for matching language tags
sorted in descending order based on priority or weight, or an empty
list if nothing matches. The list is modifiable.user's Language Priority List in which each language
tag is sorted in descending order based on priority or weight priorityList,Locale instances used for matchingReturns a list of matching |
| public static List | Returns: a list of matching language tags sorted in descending order based on priority or weight, or an empty list if nothing matches. The list is modifiable.user's Language Priority List in which each language
tag is sorted in descending order based on priority or weight priorityList,language tags tags, Locale.filtering mode modeReturns a list of matching languages tags using the basic filtering mechanism defined in RFC 4647. |
| public static List | Returns: a list of matching language tags sorted in descending order based on priority or weight, or an empty list if nothing matches. The list is modifiable.user's Language Priority List in which each language
tag is sorted in descending order based on priority or weight priorityList,language tags tags)Returns a list of matching languages tags using the basic filtering mechanism defined in RFC 4647. |
| public static Locale | Returns: The locale that best represents the language tag.the language tag languageTag)Returns a locale for the specified IETF BCP 47 language tag string. |
| private static String | Returns: a string representing the list.the list of strings to be formatted.
and formatting them into a list. stringList, String should take 2 arguments for reduction pattern)Format a list using given pattern strings. |
| public static Locale[] | |
| pack-priv BaseLocale | Returns: base locale of this LocalePackage locale method returning the Locale's BaseLocale, used by ResourceBundle |
| private static LocaleExtensions | |
| public String | Returns: The country/region code, or the empty string if none is defined.Returns the country/region code for this locale, which should either be the empty string, an uppercase ISO 3166 2-letter code, or a UN M.49 3-digit code. |
| public static Locale | Returns: the default locale for this instance of the Java Virtual MachineGets the current value of the |
| public static Locale | Returns: the default locale for the specified Category for this instance of the Java Virtual Machinethe specified category to get the default locale categoryGets the current value of the |
| private static Optional | |
| public String | Returns: The name of the country appropriate to the defaultDISPLAY locale.Returns a name for |
| public String | Returns: The name of the country appropriate to the given locale.The locale in which to localize the display country. inLocale)Returns a name for |
| private String | |
| public String | Returns: The name of the display language appropriate to the defaultDISPLAY locale.Returns a name for |
| public String | Returns: The name of the display language appropriate to the given locale.The locale in which to localize the display language. inLocale)Returns a name for |
| private static synchronized Locale | |
| public String | Returns: The display name appropriate to the defaultDISPLAY locale.Returns a name for |
| public String | Returns: The display name appropriate to the given locale.The locale in which to localize the display name. inLocale)Returns a name for |
| public String | Returns: The display name of the script code appropriate to the defaultDISPLAY locale.Returns a name for |
| public String | Returns: The display name of the script code appropriate to the given locale.The locale in which to localize the display script. inLocale)Returns a name for |
| private String | |
| public String | Returns: The name of the display variant code appropriate to the defaultDISPLAY locale.Returns a name for |
| public String | Returns: The name of the display variant code appropriate to the given locale.The locale in which to localize the display variant code. inLocale)Returns a name for |
| private String[] | Returns: an array of display names, possible of zero length.The locale for which to retrieve the display variant. inLocale)Return an array of the display names of the variant. |
| public String | Returns: The extension, or null if this locale defines no extension for the specified key.the extension key key)Returns the extension (or private use) value associated with the specified key, or null if there is no extension associated with the key. |
| public Set | Returns: The set of extension keys, or the empty set if this locale has no extensions.Returns the set of extension keys associated with this locale, or the empty set if it has no extensions. |
| private static synchronized Locale | |
| pack-priv static Locale | Returns: theLocale instance requestedlowercase 2 to 8 language code. language, String uppercase two-letter ISO-3166 code and numeric-3 UN M.49 area code. country, String vendor and browser specific code. See class description. variant)Returns a |
| pack-priv static Locale | getInstance(String language, String script, String country, String variant, LocaleExtensions extensions)
|
| pack-priv static Locale | |
| public String | Returns: a three-letter abbreviation of this locale's countryReturns a three-letter abbreviation of this locale's country. |
| public String | Returns: a three-letter abbreviation of this locale's languageReturns a three-letter abbreviation of this locale's language. |
| public static String[] | Returns: An array of ISO 3166 two-letter country codes.Returns a list of all 2-letter country codes defined in ISO 3166. |
| public static Set | Returns: an unmodifiableSet of ISO3166 country codes for the specified typeLocale. specified ISO code type.Returns an unmodifiable |
| public static String[] | Returns: An array of ISO 639 two-letter language codes.Returns a list of all 2-letter language codes defined in ISO 639. |
| public String | Returns: The language code, or the empty string if none is defined.Returns the language code of this Locale. |
| pack-priv LocaleExtensions | Returns: locale extensions of this Locale, ornull if no extensions are definedPackage private method returning the Locale's LocaleExtensions, used by ResourceBundle. |
| public String | Returns: The script code, or the empty string if none is defined.Returns the script for this locale, which should either be the empty string or an ISO 15924 4-letter script code. |
| public Set | Returns: The set of attributes.Returns the set of unicode locale attributes associated with this locale, or the empty set if it has no attributes. |
| public Set | Returns: The set of Unicode locale keys, or the empty set if this locale has no Unicode locale keywords.Returns the set of Unicode locale keys defined by this locale, or the empty set if this locale has none. |
| public String | Returns: The Unicode locale type associated with the key, or null if the locale does not define the key.the Unicode locale key key)Returns the Unicode locale type associated with the specified Unicode locale key for this locale. |
| public String | Returns: The variant code, or the empty string if none is defined.Returns the variant code for this locale. |
| public boolean | Returns: true if this Locale has any extensionsReturns |
| public int | |
| private static Locale | |
| private static Locale | |
| private static boolean | |
| public static Locale | Returns: the best matchingLocale instance chosen based on
priority or weight, or null if nothing matches.user's Language Priority List in which each language
tag is sorted in descending order based on priority or weight priorityList,Locale instances used for matchingReturns a |
| public static String | Returns: the best matching language tag chosen based on priority or weight, ornull if nothing matches.user's Language Priority List in which each language
tag is sorted in descending order based on priority or weight priorityList,language tags used for matching tags)Returns the best-matching language tag using the lookup mechanism defined in RFC 4647. |
| public static Locale | Returns: ALocale objectA language code. See the language, String Locale class description of
language values.A country code. See the country, String Locale class description of
country values.Any arbitrary value used to indicate a variation of a variant)Locale.
See the Locale class description of variant values.Obtains a locale from language, country and variant. |
| public static Locale | |
| public static Locale | |
| private void | |
| private Object | Returns: an instance ofLocale equivalent to
the deserialized Locale.Returns a cached |
| public static synchronized void | setDefault(Locale
the new default locale newLocale)Sets the |
| public static synchronized void | setDefault(Locale.
the specified category to set the default locale category,the new default locale newLocale)Sets the |
| public Locale | Returns: a copy of thisLocale with no extensions, or this
if this has no extensionsReturns a copy of this |
| public String | Returns: a BCP47 language tag representing the localeReturns a well-formed IETF BCP 47 language tag representing this locale. |
| public final String | Returns: A string representation of the Locale, for debugging.Overrides java. Returns a string representation of this language + "_" + country + "_" + (variant + "_#" | "#") + script + "_" + extensions |
| private void | writeObject(ObjectOutputStream
the out)ObjectOutputStream to writeSerializes this |