public static class ICULocaleService.LocaleKey extends ICUService.Key
Canonicalization adjusts the locale string so that the section before the first understore is in lower case, and the rest is in upper case, with no trailing underscores.
| Modifier and Type | Field and Description |
|---|---|
static int |
KIND_ANY |
| Modifier | Constructor and Description |
|---|---|
protected |
LocaleKey(String primaryID,
String canonicalPrimaryID,
String canonicalFallbackID,
int kind)
PrimaryID is the user's requested locale string,
canonicalPrimaryID is this string in canonical form,
fallbackID is the current default locale's string in
canonical form.
|
| Modifier and Type | Method and Description |
|---|---|
String |
canonicalID()
Return the (canonical) original ID.
|
ULocale |
canonicalLocale()
Convenience method to return the locale corresponding to the (canonical) original ID.
|
static ICULocaleService.LocaleKey |
createWithCanonical(ULocale locale,
String canonicalFallbackID,
int kind)
Create a LocaleKey with canonical primary and fallback IDs.
|
static ICULocaleService.LocaleKey |
createWithCanonicalFallback(String primaryID,
String canonicalFallbackID)
Create a LocaleKey with canonical primary and fallback IDs.
|
static ICULocaleService.LocaleKey |
createWithCanonicalFallback(String primaryID,
String canonicalFallbackID,
int kind)
Create a LocaleKey with canonical primary and fallback IDs.
|
String |
currentDescriptor()
Return the (canonical) current descriptor, or null if no current id.
|
String |
currentID()
Return the (canonical) current ID, or null if no current id.
|
ULocale |
currentLocale()
Convenience method to return the ulocale corresponding to the (canonical) currentID.
|
boolean |
fallback()
If the key has a fallback, modify the key and return true,
otherwise return false.
|
boolean |
isFallbackOf(String id)
If a key created from id would eventually fallback to match the
canonical ID of this key, return true.
|
int |
kind()
Return the kind code associated with this key.
|
String |
prefix()
Return the prefix associated with the kind, or null if the kind is KIND_ANY.
|
idpublic static final int KIND_ANY
public static ICULocaleService.LocaleKey createWithCanonicalFallback(String primaryID, String canonicalFallbackID)
public static ICULocaleService.LocaleKey createWithCanonicalFallback(String primaryID, String canonicalFallbackID, int kind)
public static ICULocaleService.LocaleKey createWithCanonical(ULocale locale, String canonicalFallbackID, int kind)
public String prefix()
public int kind()
public String canonicalID()
canonicalID in class ICUService.Keypublic String currentID()
currentID in class ICUService.Keypublic String currentDescriptor()
currentDescriptor in class ICUService.Keypublic ULocale canonicalLocale()
public ULocale currentLocale()
public boolean fallback()
First falls back through the primary ID, then through the fallbackID. The final fallback is "" (root) unless the primary id was "" (root), in which case there is no fallback.
fallback in class ICUService.Keypublic boolean isFallbackOf(String id)
isFallbackOf in class ICUService.Key