Class GeneralImpl
- java.lang.Object
-
- com.squarespace.cldrengine.general.GeneralImpl
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.List<java.util.function.Function<LanguageTag,LanguageIdType>>
LANGUAGE_FUNCS
-
Constructor Summary
Constructors Constructor Description GeneralImpl(Bundle bundle, CLocale locale, Internals internals, PrivateApi privateApi)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
_getLanguageDisplayName(Vector2Arrow<AltType,LanguageIdType> arrow, LanguageTag tag, AltType type)
protected java.lang.String
_getRegionDisplayName(Vector2Arrow<AltType,RegionIdType> arrow, LanguageTag tag, AltType type)
protected java.lang.String
_getScriptDisplayName(Vector2Arrow<AltType,ScriptIdType> arrow, LanguageTag tag, AltType type)
protected static LanguageIdType
_languageRegion(LanguageTag tag)
protected static LanguageIdType
_languageScript(LanguageTag tag)
Bundle
bundle()
The current language bundle.CharacterOrderType
characterOrder()
Returns the character order for the current locale, e.g.java.lang.String
formatList(java.util.List<java.lang.String> items, ListPatternType type)
Format a list of items with the given type.java.util.List<Part>
formatListToParts(java.util.List<java.lang.String> items, ListPatternType type)
Format a list of items with the given type to an array of parts.java.lang.String
getLanguageDisplayName(LanguageTag tag, DisplayNameOptions options)
Returns the display name for the given language code.java.lang.String
getLanguageDisplayName(java.lang.String code, DisplayNameOptions options)
Returns the display name for the given language code.java.lang.String
getRegionDisplayName(LanguageTag tag, DisplayNameOptions options)
Returns the display name for the given region code.java.lang.String
getRegionDisplayName(java.lang.String code, DisplayNameOptions options)
Returns the display name for the given region code.java.lang.String
getScriptDisplayName(LanguageTag tag, DisplayNameOptions options)
Returns the display name for the given script code.java.lang.String
getScriptDisplayName(java.lang.String code, DisplayNameOptions options)
Returns the display name for the given script code.protected <T> java.lang.String
getVectorAlt(Vector2Arrow<AltType,T> arrow, T code, AltType type)
LineOrderType
lineOrder()
Returns the line order for the current locale, e.g.CLocale
locale()
The current locale.MeasurementSystem
measurementSystem()
Returns the measurement system in use for the current locale generally.MeasurementSystem
measurementSystem(MeasurementCategory category)
Returns the measurement system in use for the current locale generally, or for a specific measurement category.LanguageTag
parseLanguageTag(java.lang.String tag)
Parses a language tag and canonicalizes its fields.CLocale
resolveLocale(java.lang.String tag)
Resolve a language tag to a Locale.
-
-
-
Field Detail
-
LANGUAGE_FUNCS
protected static java.util.List<java.util.function.Function<LanguageTag,LanguageIdType>> LANGUAGE_FUNCS
-
-
Constructor Detail
-
GeneralImpl
public GeneralImpl(Bundle bundle, CLocale locale, Internals internals, PrivateApi privateApi)
-
-
Method Detail
-
characterOrder
public CharacterOrderType characterOrder()
Description copied from interface:General
Returns the character order for the current locale, e.g. "ltr" for left-to-right or "rtl" for right-to-left.- Specified by:
characterOrder
in interfaceGeneral
-
lineOrder
public LineOrderType lineOrder()
Description copied from interface:General
Returns the line order for the current locale, e.g. "ttb" for top-to-bottom or "btt" for bottom-to-top.
-
bundle
public Bundle bundle()
Description copied from interface:General
The current language bundle.
-
resolveLocale
public CLocale resolveLocale(java.lang.String tag)
Description copied from interface:General
Resolve a language tag to a Locale.- Specified by:
resolveLocale
in interfaceGeneral
-
parseLanguageTag
public LanguageTag parseLanguageTag(java.lang.String tag)
Description copied from interface:General
Parses a language tag and canonicalizes its fields.- Specified by:
parseLanguageTag
in interfaceGeneral
-
measurementSystem
public MeasurementSystem measurementSystem()
Description copied from interface:General
Returns the measurement system in use for the current locale generally.- Specified by:
measurementSystem
in interfaceGeneral
-
measurementSystem
public MeasurementSystem measurementSystem(MeasurementCategory category)
Description copied from interface:General
Returns the measurement system in use for the current locale generally, or for a specific measurement category. For example, to get the correct measurement system for temperature you must pass in the category 'temperature'.- Specified by:
measurementSystem
in interfaceGeneral
-
formatList
public java.lang.String formatList(java.util.List<java.lang.String> items, ListPatternType type)
Description copied from interface:General
Format a list of items with the given type.- Specified by:
formatList
in interfaceGeneral
-
formatListToParts
public java.util.List<Part> formatListToParts(java.util.List<java.lang.String> items, ListPatternType type)
Description copied from interface:General
Format a list of items with the given type to an array of parts.- Specified by:
formatListToParts
in interfaceGeneral
-
getLanguageDisplayName
public java.lang.String getLanguageDisplayName(java.lang.String code, DisplayNameOptions options)
Description copied from interface:General
Returns the display name for the given language code.- Specified by:
getLanguageDisplayName
in interfaceGeneral
-
getLanguageDisplayName
public java.lang.String getLanguageDisplayName(LanguageTag tag, DisplayNameOptions options)
Description copied from interface:General
Returns the display name for the given language code.- Specified by:
getLanguageDisplayName
in interfaceGeneral
-
_getLanguageDisplayName
protected java.lang.String _getLanguageDisplayName(Vector2Arrow<AltType,LanguageIdType> arrow, LanguageTag tag, AltType type)
-
_languageRegion
protected static LanguageIdType _languageRegion(LanguageTag tag)
-
_languageScript
protected static LanguageIdType _languageScript(LanguageTag tag)
-
getScriptDisplayName
public java.lang.String getScriptDisplayName(java.lang.String code, DisplayNameOptions options)
Description copied from interface:General
Returns the display name for the given script code.- Specified by:
getScriptDisplayName
in interfaceGeneral
-
getScriptDisplayName
public java.lang.String getScriptDisplayName(LanguageTag tag, DisplayNameOptions options)
Description copied from interface:General
Returns the display name for the given script code.- Specified by:
getScriptDisplayName
in interfaceGeneral
-
_getScriptDisplayName
protected java.lang.String _getScriptDisplayName(Vector2Arrow<AltType,ScriptIdType> arrow, LanguageTag tag, AltType type)
-
getRegionDisplayName
public java.lang.String getRegionDisplayName(java.lang.String code, DisplayNameOptions options)
Description copied from interface:General
Returns the display name for the given region code.- Specified by:
getRegionDisplayName
in interfaceGeneral
-
getRegionDisplayName
public java.lang.String getRegionDisplayName(LanguageTag tag, DisplayNameOptions options)
Description copied from interface:General
Returns the display name for the given region code.- Specified by:
getRegionDisplayName
in interfaceGeneral
-
_getRegionDisplayName
protected java.lang.String _getRegionDisplayName(Vector2Arrow<AltType,RegionIdType> arrow, LanguageTag tag, AltType type)
-
getVectorAlt
protected <T> java.lang.String getVectorAlt(Vector2Arrow<AltType,T> arrow, T code, AltType type)
-
-