Class LocaleDisplayNames
java.lang.Object
org.graalvm.shadowed.com.ibm.icu.text.LocaleDisplayNames
- Direct Known Subclasses:
LocaleDisplayNamesImpl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum used ingetInstance(ULocale, DialectHandling).static classStruct-like class used to return information for constructing a UI list, each corresponding to a locale. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDeprecated.This API is ICU internal only. -
Method Summary
Modifier and TypeMethodDescriptionabstract DisplayContextReturns the current value for a specified DisplayContext.Type.abstract LocaleDisplayNames.DialectHandlingReturns the dialect handling used in the display names.static LocaleDisplayNamesgetInstance(Locale locale) Convenience overload ofgetInstance(Locale, DisplayContext...)that specifiesDisplayContext.STANDARD_NAMES.static LocaleDisplayNamesgetInstance(Locale locale, DisplayContext... contexts) Returns an instance of LocaleDisplayNames that returns names formatted for the providedLocale, using the provided DisplayContext settingsstatic LocaleDisplayNamesgetInstance(ULocale locale) Convenience overload ofgetInstance(ULocale, DialectHandling)that specifies STANDARD dialect handling.static LocaleDisplayNamesgetInstance(ULocale locale, DisplayContext... contexts) Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale, using the provided DisplayContext settingsstatic LocaleDisplayNamesgetInstance(ULocale locale, LocaleDisplayNames.DialectHandling dialectHandling) Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale, using the provided dialectHandling.abstract ULocaleReturns the locale used to determine the display names.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 StringkeyDisplayName(String key) Returns the display name of the provided locale key.abstract StringkeyValueDisplayName(String key, String value) Returns the display name of the provided value (used with the provided key).abstract StringlanguageDisplayName(String lang) Returns the display name of the provided language code.abstract StringlocaleDisplayName(String localeId) Returns the display name of the provided locale id.abstract StringlocaleDisplayName(Locale locale) Returns the display name of the provided locale.abstract StringlocaleDisplayName(ULocale locale) Returns the display name of the provided ulocale.abstract StringregionDisplayName(String region) Returns the display name of the provided region code.abstract StringscriptDisplayName(int scriptCode) Returns the display name of the provided script code.abstract StringscriptDisplayName(String script) Returns the display name of the provided script code.scriptDisplayNameInContext(String script) Deprecated.This API is ICU internal only.abstract StringvariantDisplayName(String variant) Returns the display name of the provided variant.
-
Constructor Details
-
LocaleDisplayNames
Deprecated.This API is ICU internal only.Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Details
-
getInstance
Convenience overload ofgetInstance(ULocale, DialectHandling)that specifies STANDARD dialect handling.- Parameters:
locale- the display locale- Returns:
- a LocaleDisplayNames instance
-
getInstance
Convenience overload ofgetInstance(Locale, DisplayContext...)that specifiesDisplayContext.STANDARD_NAMES.- Parameters:
locale- the displayLocale- Returns:
- a LocaleDisplayNames instance
-
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- the display localedialectHandling- how to select names for locales- Returns:
- a LocaleDisplayNames instance
-
getInstance
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale, using the provided DisplayContext settings- Parameters:
locale- the display localecontexts- one or more context settings (e.g. for dialect handling, capitalization, etc.- Returns:
- a LocaleDisplayNames instance
-
getInstance
Returns an instance of LocaleDisplayNames that returns names formatted for the providedLocale, using the provided DisplayContext settings- Parameters:
locale- the displayLocalecontexts- one or more context settings (e.g. for dialect handling, capitalization, etc.- Returns:
- a LocaleDisplayNames instance
-
getLocale
Returns the locale used to determine the display names. This is not necessarily the same locale passed togetInstance(ULocale).- Returns:
- the display locale
-
getDialectHandling
Returns the dialect handling used in the display names.- Returns:
- the dialect handling enum
-
getContext
Returns the current value for a specified DisplayContext.Type.- Parameters:
type- the DisplayContext.Type whose value to return- Returns:
- the current DisplayContext setting for the specified type
-
localeDisplayName
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- the locale whose display name to return- Returns:
- the display name of the provided locale
-
localeDisplayName
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- the locale whose display name to return- Returns:
- the display name of the provided locale
-
localeDisplayName
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- the id of the locale whose display name to return- Returns:
- the display name of the provided locale
-
languageDisplayName
-
scriptDisplayName
-
scriptDisplayNameInContext
Deprecated.This API is ICU internal only.Returns the display name of the provided script code when used in the context of a full locale name.- Parameters:
script- the script code- Returns:
- the display name of the provided script code
-
scriptDisplayName
-
regionDisplayName
-
variantDisplayName
-
keyDisplayName
-
keyValueDisplayName
-
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- a list of locales to present in a UI list. The casing uses the settings in the LocaleDisplayNames instance.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.collator- how to collate—should normally be Collator.getInstance(getDisplayLocale())- Returns:
- an ordered list of UiListItems.
- Throws:
IllformedLocaleException- if any of the locales in localeSet are malformed.
-
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- a list of locales to present in a UI list. The casing uses the settings in the LocaleDisplayNames instance.comparator- how to sort the UiListItems in the result.- Returns:
- an ordered list of UiListItems.
- Throws:
IllformedLocaleException- if any of the locales in localeSet are malformed.
-