LocaleDisplayNames
public
abstract
class
LocaleDisplayNames
extends Object
Returns display names of ULocales and components of ULocales. For
more information on language, script, region, variant, key, and
values, see ULocale
.
Summary
Nested classes |
class |
LocaleDisplayNames.UiListItem
Struct-like class used to return information for constructing a UI list, each corresponding to a locale.
|
Public methods |
abstract
DisplayContext
|
getContext(DisplayContext.Type type)
Returns the current value for a specified DisplayContext.Type.
|
abstract
LocaleDisplayNames.DialectHandling
|
getDialectHandling()
Returns the dialect handling used in the display names.
|
static
LocaleDisplayNames
|
getInstance(Locale locale, DisplayContext... contexts)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided
Locale , using the provided DisplayContext settings
|
static
LocaleDisplayNames
|
getInstance(ULocale locale)
Convenience overload of getInstance(android.icu.util.ULocale, android.icu.text.LocaleDisplayNames.DialectHandling) that specifies
STANDARD dialect handling.
|
static
LocaleDisplayNames
|
getInstance(ULocale locale, LocaleDisplayNames.DialectHandling dialectHandling)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,
using the provided dialectHandling.
|
static
LocaleDisplayNames
|
getInstance(Locale locale)
Convenience overload of getInstance(java.util.Locale, android.icu.text.DisplayContext) that specifies
DisplayContext.STANDARD_NAMES .
|
static
LocaleDisplayNames
|
getInstance(ULocale locale, DisplayContext... contexts)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,
using the provided DisplayContext settings
|
abstract
ULocale
|
getLocale()
Returns the locale used to determine the display names.
|
List<LocaleDisplayNames.UiListItem>
|
getUiList(Set<ULocale> localeSet, boolean inSelf, Comparator<Object> collator)
Return a list of information used to construct a UI list of locale names.
|
abstract
List<LocaleDisplayNames.UiListItem>
|
getUiListCompareWholeItems(Set<ULocale> localeSet, Comparator<LocaleDisplayNames.UiListItem> comparator)
Return a list of information used to construct a UI list of locale names, providing more access to control the sorting.
|
abstract
String
|
keyDisplayName(String key)
Returns the display name of the provided locale key.
|
abstract
String
|
keyValueDisplayName(String key, String value)
Returns the display name of the provided value (used with the provided key).
|
abstract
String
|
languageDisplayName(String lang)
Returns the display name of the provided language code.
|
abstract
String
|
localeDisplayName(Locale locale)
Returns the display name of the provided locale.
|
abstract
String
|
localeDisplayName(String localeId)
Returns the display name of the provided locale id.
|
abstract
String
|
localeDisplayName(ULocale locale)
Returns the display name of the provided ulocale.
|
abstract
String
|
regionDisplayName(String region)
Returns the display name of the provided region code.
|
abstract
String
|
scriptDisplayName(String script)
Returns the display name of the provided script code.
|
abstract
String
|
scriptDisplayName(int scriptCode)
Returns the display name of the provided script code.
|
abstract
String
|
variantDisplayName(String variant)
Returns the display name of the provided variant.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Public methods
getContext
public abstract DisplayContext getContext (DisplayContext.Type type)
Returns the current value for a specified DisplayContext.Type.
Parameters |
type |
DisplayContext.Type : the DisplayContext.Type whose value to return |
Returns |
DisplayContext |
the current DisplayContext setting for the specified type |
getInstance
public static LocaleDisplayNames getInstance (Locale locale,
DisplayContext... contexts)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided
Locale
, using the provided DisplayContext settings
Parameters |
locale |
Locale : the display Locale |
contexts |
DisplayContext : one or more context settings (e.g. for dialect
handling, capitalization, etc. |
getInstance
public static LocaleDisplayNames getInstance (ULocale locale,
LocaleDisplayNames.DialectHandling dialectHandling)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,
using the provided dialectHandling.
Parameters |
locale |
ULocale : the display locale |
dialectHandling |
LocaleDisplayNames.DialectHandling : how to select names for locales |
getInstance
public static LocaleDisplayNames getInstance (ULocale locale,
DisplayContext... contexts)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,
using the provided DisplayContext settings
Parameters |
locale |
ULocale : the display locale |
contexts |
DisplayContext : one or more context settings (e.g. for dialect
handling, capitalization, etc. |
getLocale
public abstract ULocale getLocale ()
Returns the locale used to determine the display names. This is not necessarily the same
locale passed to getInstance(ULocale)
.
getUiList
public List<LocaleDisplayNames.UiListItem> getUiList (Set<ULocale> localeSet,
boolean inSelf,
Comparator<Object> collator)
Return a list of information used to construct a UI list of locale names.
Parameters |
localeSet |
Set : a list of locales to present in a UI list. The casing uses the settings in the LocaleDisplayNames instance. |
inSelf |
boolean : if true, compares the nameInSelf, otherwise the nameInDisplayLocale.
Set depending on which field (displayLocale vs self) is to show up in the UI.
If both are to show up in the UI, then it should be the one used for the primary sort order. |
collator |
Comparator : how to collate\u2014should normally be Collator.getInstance(getDisplayLocale()) |
getUiListCompareWholeItems
public abstract List<LocaleDisplayNames.UiListItem> getUiListCompareWholeItems (Set<ULocale> localeSet,
Comparator<LocaleDisplayNames.UiListItem> comparator)
Return a list of information used to construct a UI list of locale names, providing more access to control the sorting.
Normally use getUiList instead.
Parameters |
localeSet |
Set : a list of locales to present in a UI list. The casing uses the settings in the LocaleDisplayNames instance. |
comparator |
Comparator : how to sort the UiListItems in the result. |
keyDisplayName
public abstract String keyDisplayName (String key)
Returns the display name of the provided locale key.
Parameters |
key |
String : the locale key name |
Returns |
String |
the display name of the provided locale key |
keyValueDisplayName
public abstract String keyValueDisplayName (String key,
String value)
Returns the display name of the provided value (used with the provided key).
Parameters |
key |
String : the locale key name |
value |
String : the locale key's value |
Returns |
String |
the display name of the provided value |
languageDisplayName
public abstract String languageDisplayName (String lang)
Returns the display name of the provided language code.
Parameters |
lang |
String : the language code |
Returns |
String |
the display name of the provided language code |
localeDisplayName
public abstract String localeDisplayName (Locale locale)
Returns the display name of the provided locale.
When no display names are available for all or portions
of the original locale ID, those portions may be
used directly (possibly in a more canonical form) as
part of the returned display name.
Parameters |
locale |
Locale : the locale whose display name to return |
Returns |
String |
the display name of the provided locale |
localeDisplayName
public abstract String localeDisplayName (String localeId)
Returns the display name of the provided locale id.
When no display names are available for all or portions
of the original locale ID, those portions may be
used directly (possibly in a more canonical form) as
part of the returned display name.
Parameters |
localeId |
String : the id of the locale whose display name to return |
Returns |
String |
the display name of the provided locale |
localeDisplayName
public abstract String localeDisplayName (ULocale locale)
Returns the display name of the provided ulocale.
When no display names are available for all or portions
of the original locale ID, those portions may be
used directly (possibly in a more canonical form) as
part of the returned display name.
Parameters |
locale |
ULocale : the locale whose display name to return |
Returns |
String |
the display name of the provided locale |
regionDisplayName
public abstract String regionDisplayName (String region)
Returns the display name of the provided region code.
Parameters |
region |
String : the region code |
Returns |
String |
the display name of the provided region code |
scriptDisplayName
public abstract String scriptDisplayName (String script)
Returns the display name of the provided script code.
Parameters |
script |
String : the script code |
Returns |
String |
the display name of the provided script code |
scriptDisplayName
public abstract String scriptDisplayName (int scriptCode)
Returns the display name of the provided script code. See
UScript
for recognized script codes.
Parameters |
scriptCode |
int : the script code number |
Returns |
String |
the display name of the provided script code |
variantDisplayName
public abstract String variantDisplayName (String variant)
Returns the display name of the provided variant.
Parameters |
variant |
String : the variant string |
Returns |
String |
the display name of the provided variant |