public final class ULocale extends Object implements Serializable
Locale that provides additional
support for ICU protocol. In ICU 3.0 this class is enhanced to support RFC
3066 language identifiers.
Many classes and services in ICU follow a factory idiom, in which a factory method or object responds to a client request with an object. The request includes a locale (the requested locale), and the returned object is constructed using data for that locale. The system may lack data for the requested locale, in which case the locale fallback mechanism will be invoked until a populated locale is found (the valid locale). Furthermore, even when a populated locale is found (the valid locale), further fallback may be required to reach a locale containing the specific data required by the service (the actual locale).
ULocale performs 'normalization' and 'canonicalization' of locale ids. Normalization 'cleans up' ICU locale ids as follows:
canonicalize can be called to convert the id to
canonical form, or the canonicalInstance factory method can be
called.
This class provides selectors #VALID_LOCALE and
#ACTUAL_LOCALE intended for use in methods named getLocale()
. These methods exist in several ICU classes, including
com.adobe.agl.util.Calendar, Currency,
UFormat, BreakIterator,
Collator,
com.adobe.agl.text.DateFormatSymbols, and
DecimalFormatSymbols and their subclasses, if any.
Once an object of one of these classes has been created, getLocale()
may be called on it to determine the valid and actual locale arrived at
during the object's construction.
Note: The getLocale() method will be implemented in ICU 3.0; ICU 2.8 contains a partial preview implementation. The actual locale is returned correctly, but the valid locale is not, in most cases.
Locale,
Serialized Form| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Equals based on locale.
|
static ULocale |
forLocale(Locale loc)
Return a ULocale object for a
Locale. |
String |
getCountry() |
static ULocale |
getDefault() |
ULocale |
getFallback() |
String |
getLanguage() |
String |
getScript() |
int |
hashCode()
Return hashcode based on locale
|
Locale |
toLocale() |
public static final ULocale ROOT
public ULocale(String localeID)
public static ULocale forLocale(Locale loc)
Locale. The ULocale is
canonicalized.loc - a JDK localepublic String getLanguage()
public String getCountry()
public String getScript()
public static ULocale getDefault()
public Locale toLocale()
public ULocale getFallback()
Copyright © 2010 - 2020 Adobe. All Rights Reserved