Name: proposal-intl-locale
Owner: Ecma TC39
Description: `Intl.Locale` specification [draft]
Created: 2016-10-07 18:59:34.0
Updated: 2018-05-13 23:11:27.0
Pushed: 2018-04-30 15:14:27.0
Homepage: https://tc39.github.io/proposal-intl-locale/
Size: 97
Language: HTML
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
The JavaScript Intl library (ECMA 402) has used strings to identify locales since the beginning. This works well for many simple cases, and is lightweight and user-friendly. ICU uses a Locale class instead. Defining a Locale class allows the following:
Intl.Locale has a toString method which represents the complete contents of the locale. This method allows Locale instances to be provided as an argument to existing Intl constructors, serialized iN JSON, or any other context where an exact string representation is useful.
Intl.Locale is proposed to be the class that HTML uses to expose the current locale to the Web. Currently, HTML supports only navigator.languages
, but with navigator.locales
, an Array of Intl.Locale instances, browsers may expose user preferences for calendar, numbering system, and more to Progressive Web applications.
Stage 3
Implementation Progress
Backpointers
Spec
TBD
loc = new Intl.Locale("pl-u-hc-h12", {
lendar: 'gregory'
ole.log(loc.language); // "pl"
ole.log(loc.hourCycle); // "h12"
ole.log(loc.calendar); // "gregory"
ole.log(loc.toString()); // "pl-u-ca-gregory-hc-h12"
install
run build
index.html