pp108 : Locale

Locale

This component enables operations to be performed on the locale related formats by setting or retrieving the specific locale format values.

The following table lists the methods that can be defined for the component:

Method

Description

getName

Returns the name of the locale

getFullName

Returns the full name of the locale

getDecimalSeparator

Returns the number decimal separator for the corresponding locale

setDecimalSeparator

Sets the number decimal separator for the corresponding locale

getGroupSeparator

Returns the number group separator for the corresponding locale

setGroupSeparator

Sets the number group separator for the corresponding locale

getNumberGroupSizes

Returns the number group sizes for the corresponding locale

setNumberGroupSizes

Sets the number group sizes for the corresponding locale

getNumberDecimalDigits

Returns the number of decimal digits for the corresponding locale

setNumberDecimalDigits

Sets the number of decimal digits for the corresponding locale

getCurrencyDecimalSeparator

Returns the currency decimal separator for the corresponding locale

setCurrencyDecimalSeparator

Sets the currency decimal separator for the corresponding locale

getCurrencyGroupSeparator

Returns the currency group separator for the corresponding locale

setCurrencyGroupSeparator

Sets the currency group separator for the corresponding locale

getCurrencyGroupSizes

Returns the currency group sizes for the corresponding locale

setCurrencyGroupSizes

Sets the currency group sizes for the corresponding locale

getCurrencyDecimalDigits

Returns the currency decimal digits for the corresponding locale

setCurrencyDecimalDigits

Sets the currency decimal digits for the corresponding locale

getCurrencyCode

Returns the currency code for the corresponding locale

setCurrencyCode

Sets the currency code for the corresponding locale

getCurrencySymbol

Returns the currency symbol for the corresponding locale

setCurrencySymbol

Sets the currency symbol for the corresponding locale

getNegativePattern

Returns the negative pattern for the number

setNegativePattern

Sets the negative pattern for the number

getCurrencyPositivePattern

Returns the positive pattern for the currency

setCurrencyPositivePattern

Sets the positive pattern for the currency

getCurrencyNegativePattern

Returns the negative pattern for the currency

setCurrencyNegativePattern

Sets the negative pattern for the currency

getMonthNames

Returns the month names for the corresponding locale as an array

getMonthName

Sets the month name for the index in the corresponding locale

getMonth

Returns the month name for the index in the corresponding locale

setMonthNames

Sets the month names for the corresponding locale

getAbbreviatedMonthNames

Returns the abbreviated month names for the corresponding locale

getAbbreviatedMonthName

Returns the abbreviated month name in the index for the corresponding locale

getAbbreviatedMonth

Returns the index for the abbreviated month name for the corresponding locale

setAbbreviatedMonthNames

Sets the abbreviated month names for the corresponding locale

getDayNames

Returns the day names as an array for the corresponding locale

getDayName

Returns the day name for the index in the corresponding locale

getDay

Returns the index for the day name for the corresponding locale

setDayNames

Sets the day names for the corresponding locale

getAbbreviatedDayNames

Returns the abbreviated day names for the corresponding locale

getAbbreviatedDayName

Returns the abbreviated day name for the index in the corresponding locale

getAbbreviatedDay

Returns the index for the abbreviated day name for the corresponding locale

setAbbreviatedDayNames

Sets the abbreviated month names for the corresponding locale

getAMDesignator

Returns the AM designator for the corresponding locale

setAMDesignator

Sets the AM designator for the corresponding locale

getPMDesignator

Returns the PM designator for the corresponding locale

setPMDesignator

Sets the PM designator for the corresponding locale

getShortDateFormat

Returns the short date format for the corresponding locale

setShortDateFormat

Sets the short date format for the corresponding locale

getLongDateFormat

Returns the long date format for the corresponding locale

setLongDateFormat

Sets the long date format for the corresponding locale

getShortTimeFormat

Returns the short time format for the corresponding locale

setShortTimeFormat

Sets the short time format for the corresponding locale

getLongTimeFormat

Returns the long time format for the corresponding locale

setLongTimeFormat

Sets the long time format for the corresponding locale

Static Methods

Method

Description

getLocale

Returns the locale object

Example

This sample displays the use of the Locale library. 

var locale = new Locale("en-US");
locale.setDecimalSeparator(",");
locale.setGroupSeparator(" ");
locale.setNumberGroupSizes("2,3");
var numberFormat = new NumberFormat();
numberFormat.setLocale(locale);
numberFormat.format("123504.36");