Package com.ibm.icu.impl
Class LocaleDisplayNamesImpl
- java.lang.Object
-
- com.ibm.icu.text.LocaleDisplayNames
-
- com.ibm.icu.impl.LocaleDisplayNamesImpl
-
public class LocaleDisplayNamesImpl extends LocaleDisplayNames
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
LocaleDisplayNamesImpl.Cache
private class
LocaleDisplayNamesImpl.CapitalizationContextSink
private static class
LocaleDisplayNamesImpl.CapitalizationContextUsage
Capitalization context usage types for locale display namesstatic class
LocaleDisplayNamesImpl.DataTable
(package private) static class
LocaleDisplayNamesImpl.DataTables
static class
LocaleDisplayNamesImpl.DataTableType
(package private) static class
LocaleDisplayNamesImpl.ICUDataTable
(package private) static class
LocaleDisplayNamesImpl.ICUDataTables
(package private) static class
LocaleDisplayNamesImpl.LangDataTables
(package private) static class
LocaleDisplayNamesImpl.RegionDataTables
-
Nested classes/interfaces inherited from class com.ibm.icu.text.LocaleDisplayNames
LocaleDisplayNames.DialectHandling, LocaleDisplayNames.UiListItem
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description LocaleDisplayNamesImpl(ULocale locale, DisplayContext... contexts)
LocaleDisplayNamesImpl(ULocale locale, LocaleDisplayNames.DialectHandling dialectHandling)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String
adjustForUsageAndContext(LocaleDisplayNamesImpl.CapitalizationContextUsage usage, java.lang.String name)
private java.lang.StringBuilder
appendWithSep(java.lang.String s, java.lang.StringBuilder b)
DisplayContext
getContext(DisplayContext.Type type)
Returns the current value for a specified DisplayContext.Type.LocaleDisplayNames.DialectHandling
getDialectHandling()
Returns the dialect handling used in the display names.static LocaleDisplayNames
getInstance(ULocale locale, DisplayContext... contexts)
static LocaleDisplayNames
getInstance(ULocale locale, LocaleDisplayNames.DialectHandling dialectHandling)
ULocale
getLocale()
Returns the locale used to determine the display names.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.static boolean
haveData(LocaleDisplayNamesImpl.DataTableType type)
java.lang.String
keyDisplayName(java.lang.String key)
Returns the display name of the provided locale key.private java.lang.String
keyDisplayName(java.lang.String key, boolean skipAdjust)
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).private java.lang.String
keyValueDisplayName(java.lang.String key, java.lang.String value, boolean skipAdjust)
java.lang.String
languageDisplayName(java.lang.String lang)
Returns the display name of the provided language code.java.lang.String
localeDisplayName(ULocale locale)
Returns the display name of the provided ulocale.java.lang.String
localeDisplayName(java.lang.String localeId)
Returns the display name of the provided locale id.java.lang.String
localeDisplayName(java.util.Locale locale)
Returns the display name of the provided locale.private java.lang.String
localeDisplayNameInternal(ULocale locale)
private java.lang.String
localeIdName(java.lang.String localeId)
private LocaleDisplayNames.UiListItem
newRow(ULocale modified, DisplayContext capContext)
java.lang.String
regionDisplayName(java.lang.String region)
Returns the display name of the provided region code.private java.lang.String
regionDisplayName(java.lang.String region, boolean skipAdjust)
java.lang.String
scriptDisplayName(int scriptCode)
Returns the display name of the provided script code.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)
Returns the display name of the provided script code when used in the context of a full locale name.private java.lang.String
scriptDisplayNameInContext(java.lang.String script, boolean skipAdjust)
private static java.lang.String
toTitleWholeStringNoLowercase(ULocale locale, java.lang.String s)
java.lang.String
variantDisplayName(java.lang.String variant)
Returns the display name of the provided variant.private java.lang.String
variantDisplayName(java.lang.String variant, boolean skipAdjust)
-
Methods inherited from class com.ibm.icu.text.LocaleDisplayNames
getInstance, getInstance, getInstance, getUiList
-
-
-
-
Field Detail
-
locale
private final ULocale locale
-
dialectHandling
private final LocaleDisplayNames.DialectHandling dialectHandling
-
capitalization
private final DisplayContext capitalization
-
nameLength
private final DisplayContext nameLength
-
substituteHandling
private final DisplayContext substituteHandling
-
langData
private final LocaleDisplayNamesImpl.DataTable langData
-
regionData
private final LocaleDisplayNamesImpl.DataTable regionData
-
separatorFormat
private final java.lang.String separatorFormat
-
format
private final java.lang.String format
-
keyTypeFormat
private final java.lang.String keyTypeFormat
-
formatOpenParen
private final char formatOpenParen
-
formatReplaceOpenParen
private final char formatReplaceOpenParen
-
formatCloseParen
private final char formatCloseParen
-
formatReplaceCloseParen
private final char formatReplaceCloseParen
-
currencyDisplayInfo
private final CurrencyData.CurrencyDisplayInfo currencyDisplayInfo
-
cache
private static final LocaleDisplayNamesImpl.Cache cache
-
capitalizationUsage
private boolean[] capitalizationUsage
Capitalization transforms. For each usage type, indicates whether to titlecase for the context specified in capitalization (which we know at construction time).
-
contextUsageTypeMap
private static final java.util.Map<java.lang.String,LocaleDisplayNamesImpl.CapitalizationContextUsage> contextUsageTypeMap
Map from resource key to CapitalizationContextUsage value
-
capitalizationBrkIter
private transient BreakIterator capitalizationBrkIter
BreakIterator to use for capitalization
-
TO_TITLE_WHOLE_STRING_NO_LOWERCASE
private static final CaseMap.Title TO_TITLE_WHOLE_STRING_NO_LOWERCASE
-
-
Constructor Detail
-
LocaleDisplayNamesImpl
public LocaleDisplayNamesImpl(ULocale locale, LocaleDisplayNames.DialectHandling dialectHandling)
-
LocaleDisplayNamesImpl
public LocaleDisplayNamesImpl(ULocale locale, DisplayContext... contexts)
-
-
Method Detail
-
toTitleWholeStringNoLowercase
private static java.lang.String toTitleWholeStringNoLowercase(ULocale locale, java.lang.String s)
-
getInstance
public static LocaleDisplayNames getInstance(ULocale locale, LocaleDisplayNames.DialectHandling dialectHandling)
-
getInstance
public static LocaleDisplayNames getInstance(ULocale locale, DisplayContext... contexts)
-
getLocale
public ULocale getLocale()
Description copied from class:LocaleDisplayNames
Returns the locale used to determine the display names. This is not necessarily the same locale passed toLocaleDisplayNames.getInstance(com.ibm.icu.util.ULocale)
.- Specified by:
getLocale
in classLocaleDisplayNames
- Returns:
- the display locale
-
getDialectHandling
public LocaleDisplayNames.DialectHandling getDialectHandling()
Description copied from class:LocaleDisplayNames
Returns the dialect handling used in the display names.- Specified by:
getDialectHandling
in classLocaleDisplayNames
- Returns:
- the dialect handling enum
-
getContext
public DisplayContext getContext(DisplayContext.Type type)
Description copied from class:LocaleDisplayNames
Returns the current value for a specified DisplayContext.Type.- Specified by:
getContext
in classLocaleDisplayNames
- Parameters:
type
- the DisplayContext.Type whose value to return- Returns:
- the current DisplayContext setting for the specified type
-
adjustForUsageAndContext
private java.lang.String adjustForUsageAndContext(LocaleDisplayNamesImpl.CapitalizationContextUsage usage, java.lang.String name)
-
localeDisplayName
public java.lang.String localeDisplayName(ULocale locale)
Description copied from class:LocaleDisplayNames
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.- Specified by:
localeDisplayName
in classLocaleDisplayNames
- Parameters:
locale
- the locale whose display name to return- Returns:
- the display name of the provided locale
-
localeDisplayName
public java.lang.String localeDisplayName(java.util.Locale locale)
Description copied from class:LocaleDisplayNames
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.- Specified by:
localeDisplayName
in classLocaleDisplayNames
- Parameters:
locale
- the locale whose display name to return- Returns:
- the display name of the provided locale
-
localeDisplayName
public java.lang.String localeDisplayName(java.lang.String localeId)
Description copied from class:LocaleDisplayNames
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.- Specified by:
localeDisplayName
in classLocaleDisplayNames
- Parameters:
localeId
- the id of the locale whose display name to return- Returns:
- the display name of the provided locale
-
localeDisplayNameInternal
private java.lang.String localeDisplayNameInternal(ULocale locale)
-
localeIdName
private java.lang.String localeIdName(java.lang.String localeId)
-
languageDisplayName
public java.lang.String languageDisplayName(java.lang.String lang)
Description copied from class:LocaleDisplayNames
Returns the display name of the provided language code.- Specified by:
languageDisplayName
in classLocaleDisplayNames
- Parameters:
lang
- the language code- Returns:
- the display name of the provided language code
-
scriptDisplayName
public java.lang.String scriptDisplayName(java.lang.String script)
Description copied from class:LocaleDisplayNames
Returns the display name of the provided script code.- Specified by:
scriptDisplayName
in classLocaleDisplayNames
- Parameters:
script
- the script code- Returns:
- the display name of the provided script code
-
scriptDisplayNameInContext
private java.lang.String scriptDisplayNameInContext(java.lang.String script, boolean skipAdjust)
-
scriptDisplayNameInContext
public java.lang.String scriptDisplayNameInContext(java.lang.String script)
Description copied from class:LocaleDisplayNames
Returns the display name of the provided script code when used in the context of a full locale name.- Overrides:
scriptDisplayNameInContext
in classLocaleDisplayNames
- Parameters:
script
- the script code- Returns:
- the display name of the provided script code
-
scriptDisplayName
public java.lang.String scriptDisplayName(int scriptCode)
Description copied from class:LocaleDisplayNames
Returns the display name of the provided script code. SeeUScript
for recognized script codes.- Specified by:
scriptDisplayName
in classLocaleDisplayNames
- Parameters:
scriptCode
- the script code number- Returns:
- the display name of the provided script code
-
regionDisplayName
private java.lang.String regionDisplayName(java.lang.String region, boolean skipAdjust)
-
regionDisplayName
public java.lang.String regionDisplayName(java.lang.String region)
Description copied from class:LocaleDisplayNames
Returns the display name of the provided region code.- Specified by:
regionDisplayName
in classLocaleDisplayNames
- Parameters:
region
- the region code- Returns:
- the display name of the provided region code
-
variantDisplayName
private java.lang.String variantDisplayName(java.lang.String variant, boolean skipAdjust)
-
variantDisplayName
public java.lang.String variantDisplayName(java.lang.String variant)
Description copied from class:LocaleDisplayNames
Returns the display name of the provided variant.- Specified by:
variantDisplayName
in classLocaleDisplayNames
- Parameters:
variant
- the variant string- Returns:
- the display name of the provided variant
-
keyDisplayName
private java.lang.String keyDisplayName(java.lang.String key, boolean skipAdjust)
-
keyDisplayName
public java.lang.String keyDisplayName(java.lang.String key)
Description copied from class:LocaleDisplayNames
Returns the display name of the provided locale key.- Specified by:
keyDisplayName
in classLocaleDisplayNames
- Parameters:
key
- the locale key name- Returns:
- the display name of the provided locale key
-
keyValueDisplayName
private java.lang.String keyValueDisplayName(java.lang.String key, java.lang.String value, boolean skipAdjust)
-
keyValueDisplayName
public java.lang.String keyValueDisplayName(java.lang.String key, java.lang.String value)
Description copied from class:LocaleDisplayNames
Returns the display name of the provided value (used with the provided key).- Specified by:
keyValueDisplayName
in classLocaleDisplayNames
- Parameters:
key
- the locale key namevalue
- the locale key's value- Returns:
- the display name of the provided value
-
getUiListCompareWholeItems
public java.util.List<LocaleDisplayNames.UiListItem> getUiListCompareWholeItems(java.util.Set<ULocale> localeSet, java.util.Comparator<LocaleDisplayNames.UiListItem> comparator)
Description copied from class:LocaleDisplayNames
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.- Specified by:
getUiListCompareWholeItems
in classLocaleDisplayNames
- 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.
-
newRow
private LocaleDisplayNames.UiListItem newRow(ULocale modified, DisplayContext capContext)
-
haveData
public static boolean haveData(LocaleDisplayNamesImpl.DataTableType type)
-
appendWithSep
private java.lang.StringBuilder appendWithSep(java.lang.String s, java.lang.StringBuilder b)
-
-