# new LocaleInfo(locale, optionsopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
locale |
Locale
|
string
|
the locale for which the info is sought, or undefined for |
|
options |
Object
|
<optional> |
the locale for which the info is sought, or undefined for the current locale |
- See:
-
- {ilib.setLoaderCallback} for information about registering a loader callback function
Methods
# getAllScripts() → {Array.<string>}
Return an array of script codes which are used to write text in the current language. Text for most languages is written in only one script, but there are some languages where the text can be written in a number of scripts, depending on a variety of things such as the region, ethnicity, religion, etc. of the author. This method returns an array of script codes in which the language is commonly written.
an array of ISO 15924 codes for the scripts used to write text in this language
Array.<string>
# getCalendar() → {string}
Return the name of the calendar that is commonly used in the given locale.
The name of the calendar commonly used in the locale
string
# getClock() → {string}
Return whether this locale commonly uses the 12- or the 24-hour clock.
"12" if the locale commonly uses a 12-hour clock, or "24" if the locale commonly uses a 24-hour clock.
string
# getCurrency() → {string}
Return the currency that is legal in the locale, or which is most commonly used in regular commerce.
the ISO 4217 code for the currency of this locale
string
# getCurrencyFormats() → {Object}
Return an object containing the format templates for formatting currencies in this locale. The object has a number of properties in it that each are a particular style of format. Normally, this contains a "common" and an "iso" style, but may contain others in the future.
an object containing the format templates for currencies
Object
# getDecimalSeparator() → {string}
Return the decimal separator for formatted numbers in this locale.
the decimal separator char
string
# getDefaultScript() → {string}
Return the default script used to write text in the language of this locale. Text for most languages is written in only one script, but there are some languages where the text can be written in a number of scripts, depending on a variety of things such as the region, ethnicity, religion, etc. of the author. This method returns the default script for the locale, in which the language is most commonly written.
The script is returned as an ISO 15924 4-letter code.
the ISO 15924 code for the default script used to write text in this locale
string
# getDelimiterQuotationEnd() → {string}
Return the default Delimiter QuotationEnd information in this locale.
default QuotationEnd in this locale
string
# getDelimiterQuotationStart() → {string}
Return the default Delimiter QuotationStart information in this locale.
default QuotationStart in this locale
string
# getDigits() → {string|undefined}
Return the digits of the default script if they are defined. If not defined, the default should be the regular "Arabic numerals" used in the Latin script. (0-9)
the digits used in the default script
string
|
undefined
# getDigitsStyle() → {string}
Return a string that describes the style of digits used by this locale. Possible return values are:
- western - uses the regular western 10-based digits 0 through 9
- optional - native 10-based digits exist, but in modern usage, this locale most often uses western digits
- native - native 10-based native digits exist and are used regularly by this locale
- custom - uses native digits by default that are not 10-based
string that describes the style of digits used in this locale
string
# getExponential() → {string}
Return the symbol used for exponential in this locale.
the symbol used for exponential in this locale
string
# getFirstDayOfWeek() → {number}
Return the day of week that starts weeks in the current locale. Days are still numbered the standard way with 0 for Sunday through 6 for Saturday, but calendars should be displayed and weeks calculated with the day of week returned from this function as the first day of the week.
the day of the week that starts weeks in the current locale.
number
# getGroupingSeparator() → {string}
Return the separator character used to separate groups of digits on the integer side of the decimal character.
the grouping separator char
string
# getLanguageName() → {string}
Return the name of the locale's language in English.
the name of the locale's language in English
string
# getLocale() → {Locale}
Return the locale that this info object was created with.
The locale spec of the locale used to construct this info instance
# getMeridiemsStyle() → {string}
Return the default style of meridiems used in this locale. Meridiems are times of day like AM/PM. In a few locales with some calendars, for example Amharic/Ethiopia using the Ethiopic calendar, the times of day may be split into different segments than simple AM/PM as in the Gregorian calendar. Only a few locales are like that. For most locales, formatting a Gregorian date will use the regular Gregorian AM/PM meridiems.
the default meridiems style used in this locale. Possible values are "gregorian", "chinese", and "ethiopic"
string
# getNativeDecimalSeparator() → {string}
Return the decimal separator for formatted numbers in this locale for native script.
the decimal separator char
string
# getNativeDigits() → {string|undefined}
Return the digits of the native script if they are defined.
the digits used in the default script
string
|
undefined
# getNativeExponential() → {string}
Return the symbol used for exponential in this locale for native script.
the symbol used for exponential in this locale for native script
string
# getNativeGroupingSeparator() → {string}
Return the separator character used to separate groups of digits on the integer side of the decimal character for the native script if present other than the default script.
the grouping separator char
string
# getNativePercentageSymbol() → {string}
Return the symbol used for percentages in this locale for native script.
the symbol used for percentages in this locale for native script
string
# getNegativeNumberFormat() → {string}
Return the format template used to format negative numbers in this locale.
the format template for formatting negative numbers
string
# getNegativePercentageFormat() → {string}
Return the format template used to format percentages in this locale with negative amounts.
the format template for formatting percentages
string
# getPaperSize() → {string}
Return the default PaperSize information in this locale.
default PaperSize in this locale
string
# getPercentageFormat() → {string}
Return the format template used to format percentages in this locale.
the format template for formatting percentages
string
# getPercentageSymbol() → {string}
Return the symbol used for percentages in this locale.
the symbol used for percentages in this locale
string
# getPrimaryGroupingDigits() → {number}
Return the minimum number of digits grouped together on the integer side for the first (primary) group. In western European cultures, groupings are in 1000s, so the number of digits is 3.
the number of digits in a primary grouping, or 0 for no grouping
number
# getRegionName() → {string|undefined}
Return the name of the locale's region in English. If the locale has no region, this returns undefined.
the name of the locale's region in English
string
|
undefined
# getRoundingMode() → {string}
If this locale typically uses a different type of rounding for numeric formatting other than halfdown, especially for currency, then it can be specified in the localeinfo. If the locale uses the default, then this method returns undefined. The locale's rounding method overrides the rounding method for the currency itself, which can sometimes shared between various locales so it is less specific.
the name of the rounding mode typically used in this locale, or "halfdown" if the locale does not override the default
string
# getScript() → {string}
Return the script used for the current locale. If the current locale explicitly defines a script, then this script is returned. If not, then the default script for the locale is returned.
- See:
-
- LocaleInfo.getDefaultScript
the ISO 15924 code for the script used to write text in this locale
string
# getSecondaryGroupingDigits() → {number}
Return the minimum number of digits grouped together on the integer side for the second or more (secondary) group.
In western European cultures, all groupings are by 1000s, so the secondary size should be 0 because there is no secondary size. In general, if this method returns 0, then all groupings are of the primary size.
For some other cultures, the first grouping (primary) is 3 and any subsequent groupings (secondary) are two. So, 100000 would be written as: "1,00,000".
the number of digits in a secondary grouping, or 0 for no secondary grouping.
number
# getTimeZone() → {string}
Return the default time zone for this locale. Many locales span across multiple time zones. In this case, the time zone with the largest population is chosen to represent the locale. This is obviously not that accurate, but then again, this method's return value should only be used as a default anyways.
the default time zone for this locale.
string
# getUnits() → {string}
Return the name of the measuring system that is commonly used in the given locale. Valid values are "uscustomary", "imperial", and "metric".
The name of the measuring system commonly used in the locale
string
# getWeekEndEnd() → {number}
Return the day of week that starts weekend in the current locale. Days are still numbered the standard way with 0 for Sunday through 6 for Saturday.
the day of the week that starts weeks in the current locale.
number
# getWeekEndStart() → {number}
Return the day of week that starts weekend in the current locale. Days are still numbered the standard way with 0 for Sunday through 6 for Saturday.
the day of the week that starts weeks in the current locale.
number