Class sap.ui.core.LocaleDataModule: sap/ui/core/LocaleData

extends Object

Data provides access to locale-specific data, like date formats, number formats, currencies, etc.

Constructor Summary
new sap.ui.core.LocaleData(oLocale)Creates an instance of the Data.
Method Summary
sap.ui.core.LocaleData.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.LocaleData with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.core.LocaleData.getMetadata()Returns a metadata object for class sap.ui.core.LocaleData.
getCalendarWeek(sStyle, iWeekNumber)Returns the defined pattern for representing the calendar week number.
getCombinedDateTimePattern(sDateStyle, sTimeStyle, sCalendarType?)Get combined datetime pattern with given date and and time style
getCurrencyCodeBySymbol(sCurrencySymbol)Returns the currency code which is corresponded with the given currency symbol.
getCurrencyDigits(sCurrency)Returns the number of digits of the specified currency
getCurrencyPattern(sContext)Get currency format pattern
getCurrencySymbol(sCurrency)Returns the currency symbol for the specified currency, if no symbol is found the ISO 4217 currency code is returned
getCustomDateTimePattern(sSkeleton, sCalendarType?)Get custom datetime pattern for a given skeleton format.
getDatePattern(sStyle, sCalendarType?)Get date pattern in format "short", "medium", "long" or "full"
getDateTimePattern(sStyle, sCalendarType?)Get datetime pattern in style "short", "medium", "long" or "full"
getDayPeriods(sWidth, sCalendarType?)Get day periods in width "narrow", "abbreviated" or "wide"
getDayPeriodsStandAlone(sWidth, sCalendarType?)Get standalone day periods in width "narrow", "abbreviated" or "wide"
getDays(sWidth, sCalendarType?)Get day names in width "narrow", "abbreviated" or "wide"
getDaysStandAlone(sWidth, sCalendarType?)Get stand alone day names in width "narrow", "abbreviated" or "wide"
getDecimalFormat(sStyle, sNumber, sPlural)Returns the short decimal formats (like 1K, 1M.
getDecimalPattern()Get decimal format pattern
getDisplayName(sType, sStyle?)Returns the display name for a time unit (second, minute, hour, day, week, month, year)
getEraDates(sCalendarType?)Returns the map of era ids to era dates
getEras(sWidth, sCalendarType?)Returns array of eras
getFirstDayOfWeek()Returns the day that usually is regarded as the first day of a week in the current locale.
getIntervalPattern(sId, sCalendarType?)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.
getLanguages()Get locale specific language names
getMinimalDaysInFirstWeek()Returns the minimal number of days of the week which must be contained in the new year to become the first week of the year.
getMonths(sWidth, sCalendarType?)Get month names in width "narrow", "abbreviated" or "wide"
getMonthsStandAlone(sWidth, sCalendarType?)Get stand alone month names in width "narrow", "abbreviated" or "wide"
getNumberSymbol(sType)Get number symbol "decimal", "group", "plusSign", "minusSign", "percentSign"
getOrientation()Get orientation (left-to-right or right-to-left)
getPercentPattern()Get percent format pattern
getPreferredCalendarType()Returns the preferred calendar type for the current locale which exists in sap.ui.core.CalendarType

returns {sap.ui.core.CalendarType} the preferred calendar type

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

returns {string} the preferred hour symbol

getQuarters(sWidth, sCalendarType?)Get quarter names in width "narrow", "abbreviated" or "wide"
getQuartersStandAlone(sWidth, sCalendarType?)Get stand alone quarter names in width "narrow", "abbreviated" or "wide"
getRelativeDay(iDiff, sStyle?)Returns the relative day resource pattern (like "Today", "Yesterday", "{0} days ago") based on the given difference of days (0 means today, 1 means tommorrow, -1 means yesterday, .
getRelativeHour(iDiff, sStyle?)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).
getRelativeMinute(iDiff, sStyle?)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).
getRelativeMonth(iDiff, sStyle?)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(sScale, iDiff, bFuture?, sStyle?)Returns the relative format pattern with given scale (year, month, week, .
getRelativePatterns(aScales, sStyle?)Returns relative time patterns for the given scales as an array of objects containing scale, value and pattern.
getRelativeSecond(iDiff, sStyle?)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(iDiff, sStyle?)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(iDiff, sStyle?)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, .
getScripts()Get locale specific script names
getTerritories()Get locale specific territory names
getTimePattern(sStyle, sCalendarType?)Get time pattern in style "short", "medium", "long" or "full"
getWeekendEnd()Returns the last day of a weekend for the given locale.
getWeekendStart()Returns the first day of a weekend for the given locale.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.core.LocaleData(oLocale)
Creates an instance of the Data.
Parameters:
{sap.ui.core.Locale}oLocale the locale
Method Detail
sap.ui.core.LocaleData.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.core.LocaleData.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.core.LocaleData.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
getCalendarWeek(sStyle, iWeekNumber): string
Returns the defined pattern for representing the calendar week number.
Parameters:
{string}sStyle the style of the pattern. It can only be either "wide" or "narrow".
{number}iWeekNumber the week number
Since:
1.32.0
Returns:
{string} the week number string
getCombinedDateTimePattern(sDateStyle, sTimeStyle, sCalendarType?): string
Get combined datetime pattern with given date and and time style
Parameters:
{string}sDateStyle the required style for the date part
{string}sTimeStyle the required style for the time part
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{string} the combined datetime pattern
getCurrencyCodeBySymbol(sCurrencySymbol): string
Returns the currency code which is corresponded with the given currency symbol.
Parameters:
{string}sCurrencySymbol The currency symbol which needs to be converted to currency code
Since:
1.27.0
Returns:
{string} The corresponded currency code defined for the given currency symbol. The given currency symbol is returned if no currency code can be found by using the given currency symbol.
getCurrencyDigits(sCurrency): int
Returns the number of digits of the specified currency
Parameters:
{string}sCurrency ISO 4217 currency code
Since:
1.21.1
Returns:
{int} digits of the currency
getCurrencyPattern(sContext): string
Get currency format pattern
Parameters:
{string}sContext the context of the currency pattern (standard or accounting)
Returns:
{string} The pattern
getCurrencySymbol(sCurrency): string
Returns the currency symbol for the specified currency, if no symbol is found the ISO 4217 currency code is returned
Parameters:
{string}sCurrency ISO 4217 currency code
Since:
1.21.1
Returns:
{string} the currency symbol
getCustomDateTimePattern(sSkeleton, sCalendarType?): string
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

Parameters:
{string}sSkeleton the wanted skeleton format for the datetime pattern
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Since:
1.34
Returns:
{string} the best matching datetime pattern
getDatePattern(sStyle, sCalendarType?): string
Get date pattern in format "short", "medium", "long" or "full"
Parameters:
{string}sStyle the required style for the date pattern
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{string} the selected date pattern
getDateTimePattern(sStyle, sCalendarType?): string
Get datetime pattern in style "short", "medium", "long" or "full"
Parameters:
{string}sStyle the required style for the datetime pattern
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{string} the selected datetime pattern
getDayPeriods(sWidth, sCalendarType?): array
Get day periods in width "narrow", "abbreviated" or "wide"
Parameters:
{string}sWidth the required width for the day period names
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{array} array of day periods (AM, PM)
getDayPeriodsStandAlone(sWidth, sCalendarType?): array
Get standalone day periods in width "narrow", "abbreviated" or "wide"
Parameters:
{string}sWidth the required width for the day period names
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{array} array of day periods (AM, PM)
getDays(sWidth, sCalendarType?): array
Get day names in width "narrow", "abbreviated" or "wide"
Parameters:
{string}sWidth the required width for the day names
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{array} array of day names (starting with Sunday)
getDaysStandAlone(sWidth, sCalendarType?): array
Get stand alone day names in width "narrow", "abbreviated" or "wide"
Parameters:
{string}sWidth the required width for the day names
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{array} array of day names (starting with Sunday)
getDecimalFormat(sStyle, sNumber, sPlural): string
Returns the short decimal formats (like 1K, 1M....)
Parameters:
{string}sStyle short or long
{string}sNumber 1000, 10000 ...
{string}sPlural one or other (if not exists other is used)
Since:
1.25.0
Returns:
{string} decimal format
getDecimalPattern(): string
Get decimal format pattern
Returns:
{string} The pattern
getDisplayName(sType, sStyle?)
Returns the display name for a time unit (second, minute, hour, day, week, month, year)
Parameters:
{string}sType Type (second, minute, hour, day, week, month, year)
{string}sStyle?, Default: "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
Since:
1.34.0
getEraDates(sCalendarType?): array
Returns the map of era ids to era dates
Parameters:
{sap.ui.core.CalendarType}sCalendarType? the type of calendar
Since:
1.32.0
Returns:
{array} the array of eras containing objects with either an _end or _start property with a date
getEras(sWidth, sCalendarType?): array
Returns array of eras
Parameters:
{string}sWidth the style of the era name. It can be 'wide', 'abbreviated' or 'narrow'
{sap.ui.core.CalendarType}sCalendarType? the type of calendar
Since:
1.32.0
Returns:
{array} the array of eras
getFirstDayOfWeek(): int
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.

Returns:
{int} first day of week
getIntervalPattern(sId, sCalendarType?): string
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.

Parameters:
{string}sId Id of the interval format, e.g. "d-d"
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Since:
1.17.0
Returns:
{string} interval format string with placeholders {0} and {1}
getLanguages(): object
Get locale specific language names
Returns:
{object} map of locale specific language names
getMinimalDaysInFirstWeek(): int
Returns the minimal number of days of the week which must be contained in the new year 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.

Returns:
{int} minimal number of days
getMonths(sWidth, sCalendarType?): array
Get month names in width "narrow", "abbreviated" or "wide"
Parameters:
{string}sWidth the required width for the month names
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{array} array of month names (starting with January)
getMonthsStandAlone(sWidth, sCalendarType?): array
Get stand alone month names in width "narrow", "abbreviated" or "wide"
Parameters:
{string}sWidth the required width for the month names
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{array} array of month names (starting with January)
getNumberSymbol(sType): string
Get number symbol "decimal", "group", "plusSign", "minusSign", "percentSign"
Parameters:
{string}sType the required type of symbol
Returns:
{string} the selected number symbol
getOrientation(): string
Get orientation (left-to-right or right-to-left)
Returns:
{string} character orientation for this locale
getPercentPattern(): string
Get percent format pattern
Returns:
{string} The pattern
getPreferredCalendarType()
Returns the preferred calendar type for the current locale which exists in sap.ui.core.CalendarType

returns {sap.ui.core.CalendarType} the preferred calendar type

Since:
1.28.6
getPreferredHourSymbol()
Returns the preferred hour pattern symbol (h for 12, H for 24 hours) for the current locale

returns {string} the preferred hour symbol

Since:
1.34
getQuarters(sWidth, sCalendarType?): array
Get quarter names in width "narrow", "abbreviated" or "wide"
Parameters:
{string}sWidth the required width for the quarter names
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{array} array of quarters
getQuartersStandAlone(sWidth, sCalendarType?): array
Get stand alone quarter names in width "narrow", "abbreviated" or "wide"
Parameters:
{string}sWidth the required width for the quarter names
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{array} array of quarters
getRelativeDay(iDiff, sStyle?): string
Returns the relative day resource pattern (like "Today", "Yesterday", "{0} days ago") based on the given difference of days (0 means today, 1 means tommorrow, -1 means yesterday, ...).
Parameters:
{int}iDiff the difference in days
{string}sStyle?, Default: "wide" @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
Since:
1.25.0
Returns:
{string} the relative day resource pattern
getRelativeHour(iDiff, sStyle?): string|null
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'.

Parameters:
{int}iDiff the difference in hours
{string}sStyle?, Default: "wide" @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
Since:
1.31.0
Returns:
{string|null} the relative resource pattern in unit 'hour'. The method returns null if 0 is given as parameter.
getRelativeMinute(iDiff, sStyle?): string|null
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'.

Parameters:
{int}iDiff the difference in minutes
{string}sStyle?, Default: "wide" @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
Since:
1.31.0
Returns:
{string|null} the relative resource pattern in unit 'minute'. The method returns null if 0 is given as parameter.
getRelativeMonth(iDiff, sStyle?): string
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, ...).
Parameters:
{int}iDiff the difference in months
{string}sStyle?, Default: "wide" @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
Since:
1.25.0
Returns:
{string} the relative month resource pattern
getRelativePattern(sScale, iDiff, bFuture?, sStyle?): string
Returns the relative format pattern with given scale (year, month, week, ...) and difference value
Parameters:
{string}sScale the scale the relative pattern is needed for
{int}iDiff the difference in the given scale unit
{boolean}bFuture? whether a future or past pattern should be used
{string}sStyle?, Default: "wide" @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
Since:
1.34
Returns:
{string} the relative format pattern
getRelativePatterns(aScales, sStyle?): object[]
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" }

Parameters:
{string[]}aScales The scales for which the available patterns should be returned
{string}sStyle?, Default: "wide" @since 1.32.10, 1.34.4 The style of the scale patterns. The valid values are "wide", "short" and "narrow".
Since:
1.34
Returns:
{object[]} An array of all relative time patterns
getRelativeSecond(iDiff, sStyle?): string
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).
Parameters:
{int}iDiff the difference in seconds
{string}sStyle?, Default: "wide" @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
Since:
1.31.0
Returns:
{string} the relative resource pattern in unit 'second'
getRelativeWeek(iDiff, sStyle?): string
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, ...).
Parameters:
{int}iDiff the difference in weeks
{string}sStyle?, Default: "wide" @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
Since:
1.31.0
Returns:
{string} the relative week resource pattern
getRelativeYear(iDiff, sStyle?): string
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, ...).
Parameters:
{int}iDiff the difference in years
{string}sStyle?, Default: "wide" @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
Since:
1.25.0
Returns:
{string} the relative year resource pattern
getScripts(): object
Get locale specific script names
Returns:
{object} map of locale specific script names
getTerritories(): object
Get locale specific territory names
Returns:
{object} map of locale specific territory names
getTimePattern(sStyle, sCalendarType?): string
Get time pattern in style "short", "medium", "long" or "full"
Parameters:
{string}sStyle the required style for the date pattern
{sap.ui.core.CalendarType}sCalendarType? the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
Returns:
{string} the selected time pattern
getWeekendEnd(): int
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.

Returns:
{int} last day of weekend
getWeekendStart(): int
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.

Returns:
{int} first day of weekend