class sap.ui.core.LocaleData

Control sample: sap.ui.core.LocaleData
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/core/LocaleData
Application Component: CA-UI5-COR

Provides access to locale-specific data, such as, date formats, number formats, and currencies.


Constructor

Creates an instance of LocaleData for the given locale.

new sap.ui.core.LocaleData(oLocale)
Param Type Default Value Description
oLocale sap.ui.core.Locale

the locale


Methods Overview

Method Description
_get
sap.ui.core.LocaleData.extend

Creates a new subclass of class sap.ui.core.LocaleData with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.Object.extend.

firstDayStartsFirstWeek

Whether 1 January is the first day of the first calendar week. This is the definition of the calendar week in the US.

getCalendarWeek

Returns the defined pattern for representing the calendar week number.

getCombinedDateTimePattern

Get combined datetime pattern with given date and and time style.

getCombinedIntervalPattern

Get combined interval pattern using a given pattern and the fallback interval pattern.

If a skeleton based pattern is not available or not wanted, this method can be used to create an interval pattern based on a given pattern, using the fallback interval pattern.

getCurrencyCodeBySymbol

Returns the currency code which is corresponded with the given currency symbol.

getCurrencyDigits

Returns the number of digits of the specified currency.

getCurrencyFormat

Returns the short currency formats (like 1K USD, 1M USD....).

getCurrencyPattern

Get currency format pattern.

CLDR format pattern:

References:

  • http://cldr.unicode.org/translation/numbers-currency/number-patterns

getCurrencySymbol

Returns the currency symbol for the specified currency, if no symbol is found the ISO 4217 currency code is returned.

getCurrencySymbols

Returns the currency symbols available for this locale. Currency symbols get accumulated by custom currency symbols.

getCurrentLanguageName

Get a display name for the language of the Locale of this LocaleData, using the CLDR display names for languages.

The lookup logic works as follows: 1. language code and region is checked (e.g. "en-GB") 2. If not found: language code and script is checked (e.g. "zh-Hant") 3. If not found language code is checked (e.g. "en") 4. If it is then still not found undefined is returned.

getCustomCurrencyCodes

Returns a map of custom currency codes, defined via global configuration.

getCustomDateTimePattern

Get custom datetime pattern for a given skeleton format.

The format string does contain pattern symbols (e.g. "yMMMd" or "Hms") and will be converted into the pattern in the used locale, which matches the wanted symbols best. The symbols must be in canonical order, that is: Era (G), Year (y/Y), Quarter (q/Q), Month (M/L), Week (w/W), Day-Of-Week (E/e/c), Day (d/D), Hour (h/H/k/K/), Minute (m), Second (s), Timezone (z/Z/v/V/O/X/x)

See http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems

getCustomIntervalPattern

Get interval pattern for a given skeleton format.

The format string does contain pattern symbols (e.g. "yMMMd" or "Hms") and will be converted into the pattern in the used locale, which matches the wanted symbols best. The symbols must be in canonical order, that is: Era (G), Year (y/Y), Quarter (q/Q), Month (M/L), Week (w/W), Day-Of-Week (E/e/c), Day (d/D), Hour (h/H/k/K/), Minute (m), Second (s), Timezone (z/Z/v/V/O/X/x)

See http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems

getDatePattern

Get date pattern in format "short", "medium", "long" or "full".

getDateTimePattern

Get datetime pattern in style "short", "medium", "long" or "full".

getDayPeriods

Get day periods in width "narrow", "abbreviated" or "wide".

getDayPeriodsStandAlone

Get standalone day periods in width "narrow", "abbreviated" or "wide".

getDays

Get day names in width "narrow", "abbreviated" or "wide".

getDaysStandAlone

Get stand alone day names in width "narrow", "abbreviated" or "wide".

getDecimalFormat

Returns the short decimal formats (like 1K, 1M....).

getDecimalPattern

Get decimal format pattern.

getDisplayName

Returns the display name for a time unit (second, minute, hour, day, week, month, year).

getEraDates

Returns the map of era IDs to era dates.

getEras

Returns array of eras.

getFirstDayOfWeek

Returns the day that usually is regarded as the first day of a week in the current locale.

Days are encoded as integer where Sunday=0, Monday=1 etc.

All week data information in the CLDR is provided for territories (countries). If the locale of this LocaleData doesn't contain country information (e.g. if it contains only a language), then the "likelySubtag" information of the CLDR is taken into account to guess the "most likely" territory for the locale.

getIntervalPattern

Returns the interval format with the given Id (see CLDR documentation for valid Ids) or the fallback format if no interval format with that Id is known.

The empty Id ("") might be used to retrieve the interval format fallback.

getLanguages

Get locale specific language names.

getLenientNumberSymbols

Get lenient number symbols for "plusSign" or "minusSign".

sap.ui.core.LocaleData.getMetadata

Returns a metadata object for class sap.ui.core.LocaleData.

getMinimalDaysInFirstWeek

Returns the required minimal number of days for the first week of a year.

This is the minimal number of days of the week which must be contained in the new year for the week to become the first week of the year. Depending on the country, this is just a single day (in the US) or at least 4 days (in most of Europe).

All week data information in the CLDR is provided for territories (countries). If the locale of this LocaleData doesn't contain country information (e.g. if it contains only a language), then the "likelySubtag" information of the CLDR is taken into account to guess the "most likely" territory for the locale.

getMiscPattern

Get miscellaneous pattern.

getMonths

Get month names in width "narrow", "abbreviated" or "wide".

getMonthsStandAlone

Get stand alone month names in width "narrow", "abbreviated" or "wide".

getNumberSymbol

Get number symbol "decimal", "group", "plusSign", "minusSign", "percentSign".

getOrientation

Get orientation (left-to-right or right-to-left).

getPercentPattern

Get percent format pattern.

getPluralCategories

Returns an array of all plural categories available in this language.

getPluralCategory

Returns the plural category (zero, one, two, few, many or other) for the given number value. The number should be passed as a string with dot as decimal separator and the number of decimal/fraction digits as used in the final output. This is needed in order to preserve trailing zeros which are relevant to determine the right plural category.

getPreferredCalendarType

Returns the preferred calendar type for the current locale which exists in sap.ui.core.CalendarType

getPreferredHourSymbol

Returns the preferred hour pattern symbol (h for 12, H for 24 hours) for the current locale.

getQuarters

Get quarter names in width "narrow", "abbreviated" or "wide".

getQuartersStandAlone

Get stand alone quarter names in width "narrow", "abbreviated" or "wide".

getRelativeDay

Returns the relative day resource pattern (like "Today", "Yesterday", "{0} days ago") based on the given difference of days (0 means today, 1 means tomorrow, -1 means yesterday, ...).

getRelativeHour

Returns the relative resource pattern with unit 'hour' (like "in {0} hour(s)", "{0} hour(s) ago" under locale 'en') based on the given difference value (positive value means in the future and negative value means in the past).

There's no pattern defined for 0 difference and the function returns null if 0 is given. In the 0 difference case, you can use the getRelativeMinute or getRelativeSecond function to format the difference using unit 'minute' or 'second'.

getRelativeMinute

Returns the relative resource pattern with unit 'minute' (like "in {0} minute(s)", "{0} minute(s) ago" under locale 'en') based on the given difference value (positive value means in the future and negative value means in the past).

There's no pattern defined for 0 difference and the function returns null if 0 is given. In the 0 difference case, you can use the getRelativeSecond function to format the difference using unit 'second'.

getRelativeMonth

Returns the relative month resource pattern (like "This month", "Last month", "{0} months ago") based on the given difference of months (0 means this month, 1 means next month, -1 means last month, ...).

getRelativePattern

Returns the relative format pattern with given scale (year, month, week, ...) and difference value.

getRelativePatterns

Returns relative time patterns for the given scales as an array of objects containing scale, value and pattern.

The array may contain the following values: "year", "month", "week", "day", "hour", "minute" and "second". If no scales are given, patterns for all available scales will be returned.

The return array will contain objects looking like:

{
    scale: "minute",
    sign: 1,
    pattern: "in {0} minutes"
}

getRelativeSecond

Returns the relative resource pattern with unit 'second' (like now, "in {0} seconds", "{0} seconds ago" under locale 'en') based on the given difference value (0 means now, positive value means in the future and negative value means in the past).

getRelativeWeek

Returns the relative week resource pattern (like "This week", "Last week", "{0} weeks ago") based on the given difference of weeks (0 means this week, 1 means next week, -1 means last week, ...).

getRelativeYear

Returns the relative year resource pattern (like "This year", "Last year", "{0} year ago") based on the given difference of years (0 means this year, 1 means next year, -1 means last year, ...).

getResolvedUnitFormat

Retrieves the unit format pattern for a specific unit name considering the unit mappings.

References:

  • sap.ui.core.LocaleData#getUnitFromMapping

getScripts

Get locale specific script names.

getTerritories

Get locale specific territory names.

getTimePattern

Get time pattern in style "short", "medium", "long" or "full".

getUnitDisplayName

Retrieves the localized display name of a unit by sUnit, e.g. "duration-hour".

getUnitFormat

Retrieves the unit format pattern for a specific unit name.

Note: Does not take unit mapping into consideration.

getUnitFormats

Retrieves all unit format patterns merged.

Note: Does not take unit mapping into consideration.

getUnitFromMapping

Looks up the unit from defined unit mapping. E.g. for defined unit mapping { "my": "my-custom-unit", "cm": "length-centimeter" }

Call: getUnitFromMapping("my") would result in "my-custom-unit"

getWeekendEnd

Returns the last day of a weekend for the given locale.

Days are encoded in the same way as for #getFirstDayOfWeek.

All week data information in the CLDR is provided for territories (countries). If the locale of this LocaleData doesn't contain country information (e.g. if it contains only a language), then the "likelySubtag" information of the CLDR is taken into account to guess the "most likely" territory for the locale.

getWeekendStart

Returns the first day of a weekend for the given locale.

Days are encoded in the same way as for #getFirstDayOfWeek.

All week data information in the CLDR is provided for territories (countries). If the locale of this LocaleData doesn't contain country information (e.g. if it contains only a language), then the "likelySubtag" information of the CLDR is taken into account to guess the "most likely" territory for the locale.

_get

sap.ui.core.LocaleData.extend

Creates a new subclass of class sap.ui.core.LocaleData with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.Object.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

firstDayStartsFirstWeek

Whether 1 January is the first day of the first calendar week. This is the definition of the calendar week in the US.

getCalendarWeek

Returns the defined pattern for representing the calendar week number.

Param Type DefaultValue Description
sStyle string

the style of the pattern. It can only be either "wide" or "narrow".

iWeekNumber int

the week number

getCombinedDateTimePattern

Get combined datetime pattern with given date and and time style.

Param Type DefaultValue Description
sDateStyle string

the required style for the date part

sTimeStyle string

the required style for the time part

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getCombinedIntervalPattern

Get combined interval pattern using a given pattern and the fallback interval pattern.

If a skeleton based pattern is not available or not wanted, this method can be used to create an interval pattern based on a given pattern, using the fallback interval pattern.

Param Type DefaultValue Description
sPattern string

the single date pattern to use within the interval pattern

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getCurrencyCodeBySymbol

Returns the currency code which is corresponded with the given currency symbol.

Param Type DefaultValue Description
sCurrencySymbol string

The currency symbol which needs to be converted to currency code

getCurrencyDigits

Returns the number of digits of the specified currency.

Param Type DefaultValue Description
sCurrency string

ISO 4217 currency code

getCurrencyFormat

Returns the short currency formats (like 1K USD, 1M USD....).

Param Type DefaultValue Description
sStyle string

short

sNumber string

1000, 10000 ...

sPlural string

one or other (if not exists other is used)

getCurrencyPattern

Get currency format pattern.

CLDR format pattern:

References:

Param Type DefaultValue Description
sContext string

the context of the currency pattern (standard or accounting)

getCurrencySymbol

Returns the currency symbol for the specified currency, if no symbol is found the ISO 4217 currency code is returned.

Param Type DefaultValue Description
sCurrency string

ISO 4217 currency code

getCurrencySymbols

Returns the currency symbols available for this locale. Currency symbols get accumulated by custom currency symbols.

getCurrentLanguageName

Get a display name for the language of the Locale of this LocaleData, using the CLDR display names for languages.

The lookup logic works as follows: 1. language code and region is checked (e.g. "en-GB") 2. If not found: language code and script is checked (e.g. "zh-Hant") 3. If not found language code is checked (e.g. "en") 4. If it is then still not found undefined is returned.

getCustomCurrencyCodes

Returns a map of custom currency codes, defined via global configuration.

getCustomDateTimePattern

Get custom datetime pattern for a given skeleton format.

The format string does contain pattern symbols (e.g. "yMMMd" or "Hms") and will be converted into the pattern in the used locale, which matches the wanted symbols best. The symbols must be in canonical order, that is: Era (G), Year (y/Y), Quarter (q/Q), Month (M/L), Week (w/W), Day-Of-Week (E/e/c), Day (d/D), Hour (h/H/k/K/), Minute (m), Second (s), Timezone (z/Z/v/V/O/X/x)

See http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems

Param Type DefaultValue Description
sSkeleton string

the wanted skeleton format for the datetime pattern

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getCustomIntervalPattern

Get interval pattern for a given skeleton format.

The format string does contain pattern symbols (e.g. "yMMMd" or "Hms") and will be converted into the pattern in the used locale, which matches the wanted symbols best. The symbols must be in canonical order, that is: Era (G), Year (y/Y), Quarter (q/Q), Month (M/L), Week (w/W), Day-Of-Week (E/e/c), Day (d/D), Hour (h/H/k/K/), Minute (m), Second (s), Timezone (z/Z/v/V/O/X/x)

See http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems

Param Type DefaultValue Description
sSkeleton string

the wanted skeleton format for the datetime pattern

vGreatestDiff object string

is either a string which represents the symbol matching the greatest difference in the two dates to format or an object which contains key-value pairs. The value is always true. The key is one of the date field symbol groups whose value are different between the two dates. The key can only be set with 'Year', 'Quarter', 'Month', 'Week', 'Day', 'DayPeriod', 'Hour', 'Minute', or 'Second'.

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getDatePattern

Get date pattern in format "short", "medium", "long" or "full".

Param Type DefaultValue Description
sStyle string

the required style for the date pattern

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getDateTimePattern

Get datetime pattern in style "short", "medium", "long" or "full".

Param Type DefaultValue Description
sStyle string

the required style for the datetime pattern

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getDayPeriods

Get day periods in width "narrow", "abbreviated" or "wide".

Param Type DefaultValue Description
sWidth string

the required width for the day period names

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getDayPeriodsStandAlone

Get standalone day periods in width "narrow", "abbreviated" or "wide".

Param Type DefaultValue Description
sWidth string

the required width for the day period names

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getDays

Get day names in width "narrow", "abbreviated" or "wide".

Param Type DefaultValue Description
sWidth string

the required width for the day names

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getDaysStandAlone

Get stand alone day names in width "narrow", "abbreviated" or "wide".

Param Type DefaultValue Description
sWidth string

the required width for the day names

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getDecimalFormat

Returns the short decimal formats (like 1K, 1M....).

Param Type DefaultValue Description
sStyle string

short or long

sNumber string

1000, 10000 ...

sPlural string

one or other (if not exists other is used)

getDecimalPattern

Get decimal format pattern.

getDisplayName

Returns the display name for a time unit (second, minute, hour, day, week, month, year).

Param Type DefaultValue Description
sType string

Type (second, minute, hour, day, week, month, year)

sStyle string "wide"

@since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow" returns {string} display name

getEraDates

Returns the map of era IDs to era dates.

Param Type DefaultValue Description
sCalendarType sap.ui.core.CalendarType

the type of calendar

getEras

Returns array of eras.

Param Type DefaultValue Description
sWidth string

the style of the era name. It can be 'wide', 'abbreviated' or 'narrow'

sCalendarType sap.ui.core.CalendarType

the type of calendar

getFirstDayOfWeek

Returns the day that usually is regarded as the first day of a week in the current locale.

Days are encoded as integer where Sunday=0, Monday=1 etc.

All week data information in the CLDR is provided for territories (countries). If the locale of this LocaleData doesn't contain country information (e.g. if it contains only a language), then the "likelySubtag" information of the CLDR is taken into account to guess the "most likely" territory for the locale.

getIntervalPattern

Returns the interval format with the given Id (see CLDR documentation for valid Ids) or the fallback format if no interval format with that Id is known.

The empty Id ("") might be used to retrieve the interval format fallback.

Param Type DefaultValue Description
sId string

Id of the interval format, e.g. "d-d"

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getLanguages

Get locale specific language names.

getLenientNumberSymbols

Get lenient number symbols for "plusSign" or "minusSign".

Param Type DefaultValue Description
sType string

the required type of symbol

sap.ui.core.LocaleData.getMetadata

Returns a metadata object for class sap.ui.core.LocaleData.

getMinimalDaysInFirstWeek

Returns the required minimal number of days for the first week of a year.

This is the minimal number of days of the week which must be contained in the new year for the week to become the first week of the year. Depending on the country, this is just a single day (in the US) or at least 4 days (in most of Europe).

All week data information in the CLDR is provided for territories (countries). If the locale of this LocaleData doesn't contain country information (e.g. if it contains only a language), then the "likelySubtag" information of the CLDR is taken into account to guess the "most likely" territory for the locale.

getMiscPattern

Get miscellaneous pattern.

Param Type DefaultValue Description
sName string

the name of the misc pattern, can be "approximately", "atLeast", "atMost" or "range"

getMonths

Get month names in width "narrow", "abbreviated" or "wide".

Param Type DefaultValue Description
sWidth string

the required width for the month names

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getMonthsStandAlone

Get stand alone month names in width "narrow", "abbreviated" or "wide".

Param Type DefaultValue Description
sWidth string

the required width for the month names

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getNumberSymbol

Get number symbol "decimal", "group", "plusSign", "minusSign", "percentSign".

Param Type DefaultValue Description
sType string

the required type of symbol

getOrientation

Get orientation (left-to-right or right-to-left).

getPercentPattern

Get percent format pattern.

getPluralCategories

Returns an array of all plural categories available in this language.

getPluralCategory

Returns the plural category (zero, one, two, few, many or other) for the given number value. The number should be passed as a string with dot as decimal separator and the number of decimal/fraction digits as used in the final output. This is needed in order to preserve trailing zeros which are relevant to determine the right plural category.

Param Type DefaultValue Description
sNumber string number

The number to find the plural category for

getPreferredCalendarType

Returns the preferred calendar type for the current locale which exists in sap.ui.core.CalendarType

getPreferredHourSymbol

Returns the preferred hour pattern symbol (h for 12, H for 24 hours) for the current locale.

getQuarters

Get quarter names in width "narrow", "abbreviated" or "wide".

Param Type DefaultValue Description
sWidth string

the required width for the quarter names

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getQuartersStandAlone

Get stand alone quarter names in width "narrow", "abbreviated" or "wide".

Param Type DefaultValue Description
sWidth string

the required width for the quarter names

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getRelativeDay

Returns the relative day resource pattern (like "Today", "Yesterday", "{0} days ago") based on the given difference of days (0 means today, 1 means tomorrow, -1 means yesterday, ...).

Param Type DefaultValue Description
iDiff int

the difference in days

sStyle string "wide"

@since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"

getRelativeHour

Returns the relative resource pattern with unit 'hour' (like "in {0} hour(s)", "{0} hour(s) ago" under locale 'en') based on the given difference value (positive value means in the future and negative value means in the past).

There's no pattern defined for 0 difference and the function returns null if 0 is given. In the 0 difference case, you can use the getRelativeMinute or getRelativeSecond function to format the difference using unit 'minute' or 'second'.

Param Type DefaultValue Description
iDiff int

the difference in hours

sStyle string "wide"

@since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"

getRelativeMinute

Returns the relative resource pattern with unit 'minute' (like "in {0} minute(s)", "{0} minute(s) ago" under locale 'en') based on the given difference value (positive value means in the future and negative value means in the past).

There's no pattern defined for 0 difference and the function returns null if 0 is given. In the 0 difference case, you can use the getRelativeSecond function to format the difference using unit 'second'.

Param Type DefaultValue Description
iDiff int

the difference in minutes

sStyle string "wide"

@since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"

getRelativeMonth

Returns the relative month resource pattern (like "This month", "Last month", "{0} months ago") based on the given difference of months (0 means this month, 1 means next month, -1 means last month, ...).

Param Type DefaultValue Description
iDiff int

the difference in months

sStyle string "wide"

@since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"

getRelativePattern

Returns the relative format pattern with given scale (year, month, week, ...) and difference value.

Param Type DefaultValue Description
sScale string

the scale the relative pattern is needed for

iDiff int

the difference in the given scale unit

bFuture boolean

whether a future or past pattern should be used

sStyle string "wide"

@since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"

getRelativePatterns

Returns relative time patterns for the given scales as an array of objects containing scale, value and pattern.

The array may contain the following values: "year", "month", "week", "day", "hour", "minute" and "second". If no scales are given, patterns for all available scales will be returned.

The return array will contain objects looking like:

{
    scale: "minute",
    sign: 1,
    pattern: "in {0} minutes"
}

Param Type DefaultValue Description
aScales string[]

The scales for which the available patterns should be returned

sStyle string "wide"

@since 1.32.10, 1.34.4 The style of the scale patterns. The valid values are "wide", "short" and "narrow".

getRelativeSecond

Returns the relative resource pattern with unit 'second' (like now, "in {0} seconds", "{0} seconds ago" under locale 'en') based on the given difference value (0 means now, positive value means in the future and negative value means in the past).

Param Type DefaultValue Description
iDiff int

the difference in seconds

sStyle string "wide"

@since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"

getRelativeWeek

Returns the relative week resource pattern (like "This week", "Last week", "{0} weeks ago") based on the given difference of weeks (0 means this week, 1 means next week, -1 means last week, ...).

Param Type DefaultValue Description
iDiff int

the difference in weeks

sStyle string "wide"

@since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"

getRelativeYear

Returns the relative year resource pattern (like "This year", "Last year", "{0} year ago") based on the given difference of years (0 means this year, 1 means next year, -1 means last year, ...).

Param Type DefaultValue Description
iDiff int

the difference in years

sStyle string "wide"

@since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"

getResolvedUnitFormat

Retrieves the unit format pattern for a specific unit name considering the unit mappings.

References:

Param Type DefaultValue Description
sUnit string

unit name, e.g. "duration-hour" or "my"

getScripts

Get locale specific script names.

getTerritories

Get locale specific territory names.

getTimePattern

Get time pattern in style "short", "medium", "long" or "full".

Param Type DefaultValue Description
sStyle string

the required style for the date pattern

sCalendarType sap.ui.core.CalendarType

the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.

getUnitDisplayName

Retrieves the localized display name of a unit by sUnit, e.g. "duration-hour".

Param Type DefaultValue Description
sUnit string

the unit key, e.g. "duration-hour"

getUnitFormat

Retrieves the unit format pattern for a specific unit name.

Note: Does not take unit mapping into consideration.

Param Type DefaultValue Description
sUnit string

unit name, e.g. "duration-hour"

getUnitFormats

Retrieves all unit format patterns merged.

Note: Does not take unit mapping into consideration.

getUnitFromMapping

Looks up the unit from defined unit mapping. E.g. for defined unit mapping { "my": "my-custom-unit", "cm": "length-centimeter" }

Call: getUnitFromMapping("my") would result in "my-custom-unit"

getWeekendEnd

Returns the last day of a weekend for the given locale.

Days are encoded in the same way as for #getFirstDayOfWeek.

All week data information in the CLDR is provided for territories (countries). If the locale of this LocaleData doesn't contain country information (e.g. if it contains only a language), then the "likelySubtag" information of the CLDR is taken into account to guess the "most likely" territory for the locale.

getWeekendStart

Returns the first day of a weekend for the given locale.

Days are encoded in the same way as for #getFirstDayOfWeek.

All week data information in the CLDR is provided for territories (countries). If the locale of this LocaleData doesn't contain country information (e.g. if it contains only a language), then the "likelySubtag" information of the CLDR is taken into account to guess the "most likely" territory for the locale.