Package com.ibm.icu.impl
Class ICULocaleService.LocaleKey
java.lang.Object
com.ibm.icu.impl.ICUService.Key
com.ibm.icu.impl.ICULocaleService.LocaleKey
- Enclosing class:
- ICULocaleService
A subclass of Key that implements a locale fallback mechanism.
The first locale to search for is the locale provided by the
client, and the fallback locale to search for is the current
default locale. If a prefix is present, the currentDescriptor
includes it before the locale proper, separated by "/". This
is the default key instantiated by ICULocaleService.
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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
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. -
Method Summary
Modifier and TypeMethodDescriptionReturn the (canonical) original ID.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.Return the (canonical) current descriptor, or null if no current id.Return the (canonical) current ID, or null if no current id.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.prefix()
Return the prefix associated with the kind, or null if the kind is KIND_ANY.Methods inherited from class com.ibm.icu.impl.ICUService.Key
id
-
Field Details
-
kind
private int kind -
varstart
private int varstart -
-
fallbackID
-
currentID
-
KIND_ANY
public static final int KIND_ANY- See Also:
-
-
Constructor Details
-
Method Details
-
createWithCanonicalFallback
public static ICULocaleService.LocaleKey createWithCanonicalFallback(String primaryID, String canonicalFallbackID) Create a LocaleKey with canonical primary and fallback IDs. -
createWithCanonicalFallback
public static ICULocaleService.LocaleKey createWithCanonicalFallback(String primaryID, String canonicalFallbackID, int kind) Create a LocaleKey with canonical primary and fallback IDs. -
createWithCanonical
public static ICULocaleService.LocaleKey createWithCanonical(ULocale locale, String canonicalFallbackID, int kind) Create a LocaleKey with canonical primary and fallback IDs. -
prefix
Return the prefix associated with the kind, or null if the kind is KIND_ANY. -
kind
public int kind()Return the kind code associated with this key. -
canonicalID
Return the (canonical) original ID.- Overrides:
canonicalID
in classICUService.Key
-
currentID
Return the (canonical) current ID, or null if no current id.- Overrides:
currentID
in classICUService.Key
-
currentDescriptor
Return the (canonical) current descriptor, or null if no current id. Includes the keywords, whereas the ID does not include keywords.- Overrides:
currentDescriptor
in classICUService.Key
-
canonicalLocale
Convenience method to return the locale corresponding to the (canonical) original ID. -
currentLocale
Convenience method to return the ulocale corresponding to the (canonical) currentID. -
fallback
public boolean fallback()If the key has a fallback, modify the key and return true, otherwise return false.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.
- Overrides:
fallback
in classICUService.Key
-
isFallbackOf
If a key created from id would eventually fallback to match the canonical ID of this key, return true.- Overrides:
isFallbackOf
in classICUService.Key
-