|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.icu.util.ULocale
public final class ULocale
A class analogous to 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 Calendar
, Currency
, UFormat
,
BreakIterator
, Collator
, 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 FormNested Class Summary | |
---|---|
static class |
ULocale.Type
Deprecated. This is a draft API and might change in a future release of ICU. |
Field Summary | |
---|---|
static ULocale.Type |
ACTUAL_LOCALE
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
CANADA
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
CANADA_FRENCH
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
CHINA
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
CHINESE
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
ENGLISH
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
FRANCE
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
FRENCH
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
GERMAN
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
GERMANY
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
ITALIAN
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
ITALY
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
JAPAN
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
JAPANESE
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
KOREA
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
KOREAN
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
PRC
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
ROOT
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
SIMPLIFIED_CHINESE
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
TAIWAN
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
TRADITIONAL_CHINESE
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
UK
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
US
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale.Type |
VALID_LOCALE
Deprecated. This is a draft API and might change in a future release of ICU. |
Constructor Summary | |
---|---|
ULocale(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
|
ULocale(String a,
String b,
String c)
Deprecated. This is a draft API and might change in a future release of ICU. |
Method Summary | |
---|---|
static String |
canonicalize(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
Object |
clone()
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
createCanonical(String nonCanonicalID)
Deprecated. This is a draft API and might change in a future release of ICU. |
boolean |
equals(Object obj)
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
forLocale(Locale loc)
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale[] |
getAvailableLocales()
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getBaseName()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getBaseName(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getCountry()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getCountry(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
static ULocale |
getDefault()
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayCountry()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayCountry(String localeID,
String displayLocaleID)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayCountry(String localeID,
ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayCountry(ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayKeyword(String keyword)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayKeyword(String keyword,
String displayLocaleID)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayKeyword(String keyword,
ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayKeywordValue(String keyword)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayKeywordValue(String localeID,
String keyword,
String displayLocaleID)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayKeywordValue(String localeID,
String keyword,
ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayKeywordValue(String keyword,
ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayLanguage()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayLanguage(String localeID,
String displayLocaleID)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayLanguage(String localeID,
ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayLanguage(ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayName()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayName(String localeID,
String displayLocaleID)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayName(String localeID,
ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayName(ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayScript()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayScript(String localeID,
String displayLocaleID)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayScript(String localeID,
ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayScript(ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayVariant()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayVariant(String localeID,
String displayLocaleID)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getDisplayVariant(String localeID,
ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getDisplayVariant(ULocale displayLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
ULocale |
getFallback()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getFallback(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getISO3Country()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getISO3Country(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getISO3Language()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getISO3Language(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String[] |
getISOCountries()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String[] |
getISOLanguages()
Deprecated. This is a draft API and might change in a future release of ICU. |
Iterator |
getKeywords()
Deprecated. This is a draft API and might change in a future release of ICU. |
static Iterator |
getKeywords(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getKeywordValue(String keywordName)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getKeywordValue(String localeID,
String keywordName)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getLanguage()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getLanguage(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getName()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getName(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getScript()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getScript(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getVariant()
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
getVariant(String localeID)
Deprecated. This is a draft API and might change in a future release of ICU. |
int |
hashCode()
Deprecated. This is a draft API and might change in a future release of ICU. |
static void |
setDefault(ULocale newLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
ULocale |
setKeywordValue(String keyword,
String value)
Deprecated. This is a draft API and might change in a future release of ICU. |
static String |
setKeywordValue(String localeID,
String keyword,
String value)
Deprecated. This is a draft API and might change in a future release of ICU. |
Locale |
toLocale()
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
toString()
Deprecated. This is a draft API and might change in a future release of ICU. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final ULocale ENGLISH
public static final ULocale FRENCH
public static final ULocale GERMAN
public static final ULocale ITALIAN
public static final ULocale JAPANESE
public static final ULocale KOREAN
public static final ULocale CHINESE
public static final ULocale SIMPLIFIED_CHINESE
public static final ULocale TRADITIONAL_CHINESE
public static final ULocale FRANCE
public static final ULocale GERMANY
public static final ULocale ITALY
public static final ULocale JAPAN
public static final ULocale KOREA
public static final ULocale CHINA
public static final ULocale PRC
public static final ULocale TAIWAN
public static final ULocale UK
public static final ULocale US
public static final ULocale CANADA
public static final ULocale CANADA_FRENCH
public static final ULocale ROOT
public static ULocale.Type ACTUAL_LOCALE
public static ULocale.Type VALID_LOCALE
Note: The valid locale will be returned correctly in ICU 3.0 or later. In ICU 2.8, it is not returned correctly.
Constructor Detail |
---|
public ULocale(String localeID)
This constructor not canonicalize the localeID.
localeID
- string representation of the locale, e.g:
"en_US", "sy_Cyrl_YU", "zh__pinyin", "es_ES@currency=EUR,collation=traditional"public ULocale(String a, String b, String c)
ULocale(String localeID)
.
Java locale strings consisting of language, country, and variant will be handled by this form, since the country code (being shorter than four letters long) will not be interpreted as a script code. If a script code is present, the final argument ('c') will be interpreted as the country code. It is recommended that this constructor only be used to ease porting, and that clients instead use the single-argument constructor when constructing a ULocale from a localeID.
a
- first component of the locale idb
- second component of the locale idc
- third component of the locale idULocale(String)
Method Detail |
---|
public static ULocale forLocale(Locale loc)
Locale
.
The ULocale is canonicalized.
loc
- a JDK localepublic static ULocale createCanonical(String nonCanonicalID)
nonCanonicalID
- the locale id to canonicalize
public Locale toLocale()
Locale
.
public static ULocale getDefault()
public static void setDefault(ULocale newLocale)
newLocale
- the new default locale
SecurityException
- if a security manager exists and its
checkPermission
method doesn't allow the operation.
NullPointerException
- if newLocale
is nullSecurityManager.checkPermission(java.security.Permission)
,
PropertyPermission
public Object clone()
clone
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public static ULocale[] getAvailableLocales()
public static String[] getISOCountries()
public static String[] getISOLanguages()
public String getLanguage()
getDisplayLanguage()
public static String getLanguage(String localeID)
getDisplayLanguage()
public String getScript()
getDisplayScript()
public static String getScript(String localeID)
getDisplayScript()
public String getCountry()
getDisplayCountry()
public static String getCountry(String localeID)
localeID
- getDisplayCountry()
public String getVariant()
getDisplayVariant()
public static String getVariant(String localeID)
getDisplayVariant()
public static String getFallback(String localeID)
public ULocale getFallback()
public String getBaseName()
public static String getBaseName(String localeID)
localeID
- the locale ID as a string
public String getName()
public static String getName(String localeID)
localeID
- the localeID as a string
public String toString()
toString
in class Object
public Iterator getKeywords()
public static Iterator getKeywords(String localeID)
public String getKeywordValue(String keywordName)
keywordName
- name of the keyword whose value is desired. Case insensitive.
public static String getKeywordValue(String localeID, String keywordName)
keywordName
- name of the keyword whose value is desired. Case insensitive.
public static String canonicalize(String localeID)
localeID
- the locale id
public ULocale setKeywordValue(String keyword, String value)
keyword
- the keyword to add/remove, or null to remove all keywords.value
- the value to add/set, or null to remove this particular keyword.
public static String setKeywordValue(String localeID, String keyword, String value)
localeID
- the locale id to modifykeyword
- the keyword to add/remove, or null to remove all keywords.value
- the value to add/set, or null to remove this particular keyword.
public String getISO3Language()
ftp://dkuug.dk/i18n/iso-639-2.txt
MissingResourceException
- Throws MissingResourceException if the
three-letter language abbreviation is not available for this locale.public static String getISO3Language(String localeID)
ftp://dkuug.dk/i18n/iso-639-2.txt
MissingResourceException
- Throws MissingResourceException if the
three-letter language abbreviation is not available for this locale.public String getISO3Country()
MissingResourceException
- Throws MissingResourceException if the
three-letter country abbreviation is not available for this locale.public static String getISO3Country(String localeID)
MissingResourceException
- Throws MissingResourceException if the
three-letter country abbreviation is not available for this locale.public String getDisplayLanguage()
public String getDisplayLanguage(ULocale displayLocale)
displayLocale
- the locale in which to display the name.
public static String getDisplayLanguage(String localeID, String displayLocaleID)
localeID
- the id of the locale whose language will be displayeddisplayLocaleID
- the id of the locale in which to display the name.
public static String getDisplayLanguage(String localeID, ULocale displayLocale)
localeID
- the id of the locale whose language will be displayed.displayLocale
- the locale in which to display the name.
public String getDisplayScript()
public String getDisplayScript(ULocale displayLocale)
displayLocale
- the locale in which to display the name.
public static String getDisplayScript(String localeID, String displayLocaleID)
localeID
- the id of the locale whose script will be displayeddisplayLocaleID
- the id of the locale in which to display the name.
public static String getDisplayScript(String localeID, ULocale displayLocale)
localeID
- the id of the locale whose script will be displayed.displayLocale
- the locale in which to display the name.
public String getDisplayCountry()
public String getDisplayCountry(ULocale displayLocale)
displayLocale
- the locale in which to display the name.
public static String getDisplayCountry(String localeID, String displayLocaleID)
localeID
- the id of the locale whose country will be displayeddisplayLocaleID
- the id of the locale in which to display the name.
public static String getDisplayCountry(String localeID, ULocale displayLocale)
localeID
- the id of the locale whose country will be displayed.displayLocale
- the locale in which to display the name.
public String getDisplayVariant()
public String getDisplayVariant(ULocale displayLocale)
displayLocale
- the locale in which to display the name.
public static String getDisplayVariant(String localeID, String displayLocaleID)
localeID
- the id of the locale whose variant will be displayeddisplayLocaleID
- the id of the locale in which to display the name.
public static String getDisplayVariant(String localeID, ULocale displayLocale)
localeID
- the id of the locale whose variant will be displayed.displayLocale
- the locale in which to display the name.
public static String getDisplayKeyword(String keyword)
keyword
- the keyword to be displayed.
getKeywords()
public static String getDisplayKeyword(String keyword, String displayLocaleID)
keyword
- the keyword to be displayed.displayLocaleID
- the id of the locale in which to display the keyword.
getKeywords()
public static String getDisplayKeyword(String keyword, ULocale displayLocale)
keyword
- the keyword to be displayed.displayLocale
- the locale in which to display the keyword.
getKeywords()
public String getDisplayKeywordValue(String keyword)
keyword
- the keyword whose value is to be displayed.
public String getDisplayKeywordValue(String keyword, ULocale displayLocale)
keyword
- the keyword whose value is to be displayed.displayLocale
- the locale in which to display the value.
public static String getDisplayKeywordValue(String localeID, String keyword, String displayLocaleID)
localeID
- the id of the locale whose keyword value is to be displayed.keyword
- the keyword whose value is to be displayed.displayLocaleID
- the id of the locale in which to display the value.
public static String getDisplayKeywordValue(String localeID, String keyword, ULocale displayLocale)
localeID
- the id of the locale whose keyword value is to be displayed.keyword
- the keyword whose value is to be displayed.displayLocale
- the id of the locale in which to display the value.
public String getDisplayName()
public String getDisplayName(ULocale displayLocale)
displayLocale
- the locale in which to display the locale name.
public static String getDisplayName(String localeID, String displayLocaleID)
localeID
- the locale whose name is to be displayed.displayLocaleID
- the id of the locale in which to display the locale name.
public static String getDisplayName(String localeID, ULocale displayLocale)
localeID
- the locale whose name is to be displayed.displayLocale
- the locale in which to display the locale name.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |