public abstract class LocaleDisplayNames
extends java.lang.Object
ULocale
.Modifier and Type | Class and Description |
---|---|
static class |
LocaleDisplayNames.DialectHandling
Enum used in
getInstance(ULocale, DialectHandling) . |
static class |
LocaleDisplayNames.UiListItem
Struct-like class used to return information for constructing a UI list, each corresponding to a locale.
|
Modifier | Constructor and Description |
---|---|
protected |
LocaleDisplayNames()
Deprecated.
This API is ICU internal only.
|
Modifier and Type | Method and Description |
---|---|
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(java.util.Locale locale)
Convenience overload of
getInstance(Locale, DisplayContext...) that specifies
DisplayContext.STANDARD_NAMES . |
static LocaleDisplayNames |
getInstance(java.util.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(ULocale, DialectHandling) that specifies
STANDARD dialect handling. |
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
|
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.
|
abstract ULocale |
getLocale()
Returns the locale used to determine the display names.
|
java.util.List<LocaleDisplayNames.UiListItem> |
getUiList(java.util.Set<ULocale> localeSet,
boolean inSelf,
java.util.Comparator<java.lang.Object> collator)
Return a list of information used to construct a UI list of locale names.
|
abstract java.util.List<LocaleDisplayNames.UiListItem> |
getUiListCompareWholeItems(java.util.Set<ULocale> localeSet,
java.util.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 java.lang.String |
keyDisplayName(java.lang.String key)
Returns the display name of the provided locale key.
|
abstract java.lang.String |
keyValueDisplayName(java.lang.String key,
java.lang.String value)
Returns the display name of the provided value (used with the provided key).
|
abstract java.lang.String |
languageDisplayName(java.lang.String lang)
Returns the display name of the provided language code.
|
abstract java.lang.String |
localeDisplayName(java.util.Locale locale)
Returns the display name of the provided locale.
|
abstract java.lang.String |
localeDisplayName(java.lang.String localeId)
Returns the display name of the provided locale id.
|
abstract java.lang.String |
localeDisplayName(ULocale locale)
Returns the display name of the provided ulocale.
|
abstract java.lang.String |
regionDisplayName(java.lang.String region)
Returns the display name of the provided region code.
|
abstract java.lang.String |
scriptDisplayName(int scriptCode)
Returns the display name of the provided script code.
|
abstract java.lang.String |
scriptDisplayName(java.lang.String script)
Returns the display name of the provided script code.
|
java.lang.String |
scriptDisplayNameInContext(java.lang.String script)
Deprecated.
This API is ICU internal only.
|
abstract java.lang.String |
variantDisplayName(java.lang.String variant)
Returns the display name of the provided variant.
|
@Deprecated protected LocaleDisplayNames()
public static LocaleDisplayNames getInstance(ULocale locale)
getInstance(ULocale, DialectHandling)
that specifies
STANDARD dialect handling.locale
- the display localepublic static LocaleDisplayNames getInstance(java.util.Locale locale)
getInstance(Locale, DisplayContext...)
that specifies
DisplayContext.STANDARD_NAMES
.locale
- the display Locale
public static LocaleDisplayNames getInstance(ULocale locale, LocaleDisplayNames.DialectHandling dialectHandling)
locale
- the display localedialectHandling
- how to select names for localespublic static LocaleDisplayNames getInstance(ULocale locale, DisplayContext... contexts)
locale
- the display localecontexts
- one or more context settings (e.g. for dialect
handling, capitalization, etc.public static LocaleDisplayNames getInstance(java.util.Locale locale, DisplayContext... contexts)
Locale
, using the provided DisplayContext settingslocale
- the display Locale
contexts
- one or more context settings (e.g. for dialect
handling, capitalization, etc.public abstract ULocale getLocale()
getInstance(com.ibm.icu.util.ULocale)
.public abstract LocaleDisplayNames.DialectHandling getDialectHandling()
public abstract DisplayContext getContext(DisplayContext.Type type)
type
- the DisplayContext.Type whose value to returnpublic abstract java.lang.String localeDisplayName(ULocale locale)
locale
- the locale whose display name to returnpublic abstract java.lang.String localeDisplayName(java.util.Locale locale)
locale
- the locale whose display name to returnpublic abstract java.lang.String localeDisplayName(java.lang.String localeId)
localeId
- the id of the locale whose display name to returnpublic abstract java.lang.String languageDisplayName(java.lang.String lang)
lang
- the language codepublic abstract java.lang.String scriptDisplayName(java.lang.String script)
script
- the script code@Deprecated public java.lang.String scriptDisplayNameInContext(java.lang.String script)
script
- the script codepublic abstract java.lang.String scriptDisplayName(int scriptCode)
UScript
for recognized script codes.scriptCode
- the script code numberpublic abstract java.lang.String regionDisplayName(java.lang.String region)
region
- the region codepublic abstract java.lang.String variantDisplayName(java.lang.String variant)
variant
- the variant stringpublic abstract java.lang.String keyDisplayName(java.lang.String key)
key
- the locale key namepublic abstract java.lang.String keyValueDisplayName(java.lang.String key, java.lang.String value)
key
- the locale key namevalue
- the locale key's valuepublic java.util.List<LocaleDisplayNames.UiListItem> getUiList(java.util.Set<ULocale> localeSet, boolean inSelf, java.util.Comparator<java.lang.Object> collator)
collator
- how to collate—should normally be Collator.getInstance(getDisplayLocale())inSelf
- 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.localeSet
- a list of locales to present in a UI list. The casing uses the settings in the LocaleDisplayNames instance.IllformedLocaleException
- if any of the locales in localeSet are malformed.public abstract java.util.List<LocaleDisplayNames.UiListItem> getUiListCompareWholeItems(java.util.Set<ULocale> localeSet, java.util.Comparator<LocaleDisplayNames.UiListItem> comparator)
comparator
- how to sort the UiListItems in the result.localeSet
- a list of locales to present in a UI list. The casing uses the settings in the LocaleDisplayNames instance.IllformedLocaleException
- if any of the locales in localeSet are malformed.Copyright ? 2016 Unicode, Inc. and others.