Class LocaleInfo
Create a new locale info instance. Locale info instances give information about the default settings for a particular locale. These settings may be overridden by various parts of the code, and should be used as a fall-back setting of last resort.
The optional options object holds extra parameters if they are necessary. The current list of supported options are:
- onLoad - a callback function to call when the locale info object is fully loaded. When the onLoad option is given, the localeinfo object will attempt to load any missing locale data using the ilib loader callback. When the constructor is done (even if the data is already preassembled), the onLoad function is called with the current instance as a parameter, so this callback can be used with preassembled or dynamic loading or a mix of the two.
- sync - tell whether to load any missing locale data synchronously or asynchronously. If this option is given as "false", then the "onLoad" callback must be given, as the instance returned from this constructor will not be usable for a while.
- loadParams - an object containing parameters to pass to the loader callback function when locale data is missing. The parameters are not interpretted or modified in any way. They are simply passed along. The object may contain any property/value pairs as long as the calling code is in agreement with the loader callback function as to what those parameters mean.
Defined in: ilib-full-dyn.js.
Constructor Attributes | Constructor Name and Description |
---|---|
LocaleInfo(locale, options)
|
Method Attributes | Method Name and Description |
---|---|
Return an array of script codes which are used to write text in the current
language.
|
|
Return the name of the calendar that is commonly used in the given locale.
|
|
getClock()
Return whether this locale commonly uses the 12- or the 24-hour clock.
|
|
Return the currency that is legal in the locale, or which is most commonly
used in regular commerce.
|
|
Return an object containing the format templates for formatting currencies
in this locale.
|
|
Return the decimal separator for formatted numbers in this locale.
|
|
Return the default script used to write text in the language of this
locale.
|
|
Return the default Delimiter QuotationEnd information in this locale.
|
|
Return the default Delimiter QuotationStart information in this locale.
|
|
Return the digits of the default script if they are defined.
|
|
Return a string that describes the style of digits used by this locale.
|
|
Return the symbol used for exponential in this locale.
|
|
Return the day of week that starts weeks in the current locale.
|
|
Return the separator character used to separate groups of digits on the
integer side of the decimal character.
|
|
Return the name of the locale's language in English.
|
|
Return the locale that this info object was created with.
|
|
Return the default style of meridiems used in this locale.
|
|
Return the decimal separator for formatted numbers in this locale for native script.
|
|
Return the digits of the native script if they are defined.
|
|
Return the symbol used for exponential in this locale for native script.
|
|
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.
|
|
Return the symbol used for percentages in this locale for native script.
|
|
Return the format template used to format negative numbers in this locale.
|
|
Return the format template used to format percentages in this locale
with negative amounts.
|
|
Return the default PaperSize information in this locale.
|
|
Return the format template used to format percentages in this locale.
|
|
Return the symbol used for percentages in this locale.
|
|
Return the minimum number of digits grouped together on the integer side
for the first (primary) group.
|
|
Return the name of the locale's region in English.
|
|
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.
|
|
Return the script used for the current locale.
|
|
Return the minimum number of digits grouped together on the integer side
for the second or more (secondary) group.
|
|
Return the default time zone for this locale.
|
|
getUnits()
Return the name of the measuring system that is commonly used in the given locale.
|
|
Return the day of week that starts weekend in the current locale.
|
|
Return the day of week that starts weekend in the current locale.
|
- Parameters:
- {Locale|string=} locale
- the locale for which the info is sought, or undefined for
- {Object=} options
- the locale for which the info is sought, or undefined for the current locale
- See:
- for information about registering a loader callback function
- Returns:
- {Array.<string>} an array of ISO 15924 codes for the scripts used to write text in this language
- Returns:
- {string} The name of the calendar commonly used in the locale
- Returns:
- {string} "12" if the locale commonly uses a 12-hour clock, or "24" if the locale commonly uses a 24-hour clock.
- Returns:
- {string} the ISO 4217 code for the currency of this locale
- Returns:
- {Object} an object containing the format templates for currencies
- Returns:
- {string} the decimal separator char
The script is returned as an ISO 15924 4-letter code.
- Returns:
- {string} the ISO 15924 code for the default script used to write text in this locale
- Returns:
- {string} default QuotationEnd in this locale
- Returns:
- {string} default QuotationStart in this locale
- Returns:
- {string|undefined} the digits used in the default script
- 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
- Returns:
- {string} string that describes the style of digits used in this locale
- Returns:
- {string} the symbol used for exponential in this locale
- Returns:
- {number} the day of the week that starts weeks in the current locale.
- Returns:
- {string} the grouping separator char
- Returns:
- {string} the name of the locale's language in English
- Returns:
- {Locale} The locale spec of the locale used to construct this info instance
- Returns:
- {string} the default meridiems style used in this locale. Possible values are "gregorian", "chinese", and "ethiopic"
- Returns:
- {string} the decimal separator char
- Returns:
- {string|undefined} the digits used in the default script
- Returns:
- {string} the symbol used for exponential in this locale for native script
- Returns:
- {string} the grouping separator char
- Returns:
- {string} the symbol used for percentages in this locale for native script
- Returns:
- {string} the format template for formatting negative numbers
- Returns:
- {string} the format template for formatting percentages
- Returns:
- {string} default PaperSize in this locale
- Returns:
- {string} the format template for formatting percentages
- Returns:
- {string} the symbol used for percentages in this locale
- Returns:
- {number} the number of digits in a primary grouping, or 0 for no grouping
- Returns:
- {string|undefined} the name of the locale's region in English
- Returns:
- {string} the name of the rounding mode typically used in this locale, or "halfdown" if the locale does not override the default
- Returns:
- {string} the ISO 15924 code for the script used to write text in this locale
- See:
- LocaleInfo.getDefaultScript
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".
- Returns:
- {number} the number of digits in a secondary grouping, or 0 for no secondary grouping.
- Returns:
- {string} the default time zone for this locale.
- Returns:
- {string} The name of the measuring system commonly used in the locale
- Returns:
- {number} the day of the week that starts weeks in the current locale.
- Returns:
- {number} the day of the week that starts weeks in the current locale.