Class Index | File Index

Classes


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:

If this copy of ilib is pre-assembled and all the data is already available, or if the data was already previously loaded, then this constructor will call the onLoad callback immediately when the initialization is done. If the onLoad option is not given, this class will only attempt to load any missing locale data synchronously.
Defined in: ilib-full-dyn.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
LocaleInfo(locale, options)
Method Summary
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.
 
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 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 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.
 
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.
Class Detail
LocaleInfo(locale, options)
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
Method Detail
{Array.<string>} getAllScripts()
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.
Returns:
{Array.<string>} an array of ISO 15924 codes for the scripts used to write text in this language

{string} getCalendar()
Return the name of the calendar that is commonly used in the given locale.
Returns:
{string} The name of the calendar commonly used in the locale

{string} getClock()
Return whether this locale commonly uses the 12- or the 24-hour clock.
Returns:
{string} "12" if the locale commonly uses a 12-hour clock, or "24" if the locale commonly uses a 24-hour clock.

{string} getCurrency()
Return the currency that is legal in the locale, or which is most commonly used in regular commerce.
Returns:
{string} the ISO 4217 code for the currency of this locale

{Object} getCurrencyFormats()
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.
Returns:
{Object} an object containing the format templates for currencies

{string} getDecimalSeparator()
Return the decimal separator for formatted numbers in this locale.
Returns:
{string} the decimal separator char

{string} getDefaultScript()
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.

Returns:
{string} the ISO 15924 code for the default script used to write text in this locale

{string|undefined} getDigits()
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)
Returns:
{string|undefined} the digits used in the default script

{string} getDigitsStyle()
Return a string that describes the style of digits used by this locale. Possible return values are:
Returns:
{string} string that describes the style of digits used in this locale

{string} getExponential()
Return the symbol used for exponential in this locale.
Returns:
{string} the symbol used for exponential in this locale

{number} getFirstDayOfWeek()
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.
Returns:
{number} the day of the week that starts weeks in the current locale.

{string} getGroupingSeparator()
Return the separator character used to separate groups of digits on the integer side of the decimal character.
Returns:
{string} the grouping separator char

{string} getLanguageName()
Return the name of the locale's language in English.
Returns:
{string} the name of the locale's language in English

{Locale} getLocale()
Return the locale that this info object was created with.
Returns:
{Locale} The locale spec of the locale used to construct this info instance

{string} getMeridiemsStyle()
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.
Returns:
{string} the default meridiems style used in this locale. Possible values are "gregorian", "chinese", and "ethiopic"

{string} getNativeDecimalSeparator()
Return the decimal separator for formatted numbers in this locale for native script.
Returns:
{string} the decimal separator char

{string|undefined} getNativeDigits()
Return the digits of the native script if they are defined.
Returns:
{string|undefined} the digits used in the default script

{string} getNativeExponential()
Return the symbol used for exponential in this locale for native script.
Returns:
{string} the symbol used for exponential in this locale for native script

{string} getNativeGroupingSeparator()
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.
Returns:
{string} the grouping separator char

{string} getNativePercentageSymbol()
Return the symbol used for percentages in this locale for native script.
Returns:
{string} the symbol used for percentages in this locale for native script

{string} getNegativeNumberFormat()
Return the format template used to format negative numbers in this locale.
Returns:
{string} the format template for formatting negative numbers

{string} getNegativePercentageFormat()
Return the format template used to format percentages in this locale with negative amounts.
Returns:
{string} the format template for formatting percentages

{string} getPercentageFormat()
Return the format template used to format percentages in this locale.
Returns:
{string} the format template for formatting percentages

{string} getPercentageSymbol()
Return the symbol used for percentages in this locale.
Returns:
{string} the symbol used for percentages in this locale

{number} getPrimaryGroupingDigits()
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.
Returns:
{number} the number of digits in a primary grouping, or 0 for no grouping

{string|undefined} getRegionName()
Return the name of the locale's region in English. If the locale has no region, this returns undefined.
Returns:
{string|undefined} the name of the locale's region in English

{string} getRoundingMode()
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.
Returns:
{string} the name of the rounding mode typically used in this locale, or "halfdown" if the locale does not override the default

{string} getScript()
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.
Returns:
{string} the ISO 15924 code for the script used to write text in this locale
See:
LocaleInfo.getDefaultScript

{number} getSecondaryGroupingDigits()
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".

Returns:
{number} the number of digits in a secondary grouping, or 0 for no secondary grouping.

{string} getTimeZone()
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.
Returns:
{string} the default time zone for this locale.

{string} getUnits()
Return the name of the measuring system that is commonly used in the given locale. Valid values are "uscustomary", "imperial", and "metric".
Returns:
{string} The name of the measuring system commonly used in the locale

{number} getWeekEndEnd()
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.
Returns:
{number} the day of the week that starts weeks in the current locale.

{number} getWeekEndStart()
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.
Returns:
{number} the day of the week that starts weeks in the current locale.

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Feb 02 2016 15:53:55 GMT-0800 (PST)