These attributes are based on Java’s Calendar, Locale and TimeZone classes.
Attribute | Description | Sample Value |
---|---|---|
country | The ISO 3166 representation of the country code based on the language locale. | "US", "DE", "GB" |
currency | The currency symbol. | "$" |
currencyCode | The ISO 4217 representation of the currency code. | "USD" |
decimal | The decimal separator. | "." |
firstDayOfWeek | The first day of the week, where 1 is Sunday. | 1 |
grouping | The grouping separator. | "," |
isEasternNameStyle | Specifies if a name is based on eastern style, for example, last name first name [middle] [suffix]. | false |
labelForToday | The label for the Today link on the date picker. | “Today” |
language | The language code based on the language locale. | "en", "de", "zh" |
langLocale | The locale ID. | “en_US”, “en_GB” |
nameOfMonths | The full and short names of the calendar months | { fullName: “January”, shortName: “Jan” } |
nameOfWeekdays | The full and short names of the calendar weeks | { fullName: “Sunday”, shortName: “SUN” } |
timezone | The time zone ID. | "America/Los_Angeles" |
userLocaleCountry | The country based on the current user’s locale | “US” |
userLocaleLang | The language based on the current user’s locale | “en” |
variant | The vendor and browser-specific code. | "WIN", "MAC", "POSIX" |
The framework’s number and date formatting are based on Java’s DecimalFormat and DateFormat classes.
Attribute | Description | Sample Value |
---|---|---|
currencyformat | The currency format. | "¤#,##0.00;(¤#,##0.00)" ¤ represents the currency sign, which is replaced by the currency symbol. |
dateFormat | The date format. | "MMM d, yyyy" |
datetimeFormat | The date time format. | "MMM d, yyyy h:mm:ss a" |
numberformat | The number format. | "#,##0.###" # represents a digit, the comma is a placeholder for the grouping separator, and the period is a placeholder for the decimal separator. Zero (0) replaces # to represent trailing zeros. |
percentformat | The percentage format. | "#,##0%" |
timeFormat | The time format. | "h:mm:ss a" |
zero | The character for the zero digit. | “0” |
This example shows how to retrieve different $Locale attributes.
Component source
<aura:component> {!$Locale.language} {!$Locale.timezone} {!$Locale.numberFormat} {!$Locale.currencyFormat} </aura:component>
({ checkDevice: function(component) { var locale = $A.get("$Locale.language"); alert("You are using " + locale); } })