Intl Locale Info API �for Stage 3
Frank Yung-Fong Tang / 譚永鋒
TC39 April 2021 Meeting
April 19-22, 2021
Slide: https://docs.google.com/presentation/d/1h-iaDM5RiD5rpb0aYr1GMRLRRBh72zVEKtMyMJkCkfE
Motivation
A proposal to expose Locale information, such as week data (first day in a week, weekend start day, weekend end day, minimum day in the first week), hour cycle used in the locale, measurement system used in the locale.
Advanced to Stage 1 in 2020-09 TC39 meeting
Advanced to Stage 2 in 2021-01 TC39 meeting
Scope / Prior Arts / Underline Supportive Library & Data
Changes After Stage 2
High Level Design
// Week Data:�let weekInfo = (new Intl.Locale("en-US")).weekInfo;�// { �// firstDay: 7,�// weekendStart: 6,�// weekendEnd: 7,�// minimalDays: 4�// }
// Text information�let textInfo = (new Intl.Locale("ar")).textInfo;�// { direction: "rtl" }
Unchanged from Stage 1
Examples of “defaults”
> let ar = new Intl.Locale("ar")�> ar.calendars�["gregory", "coptic", "islamic", "islamic-civil", "islamic-tbla"]�> ar.collations�["compat", "emoji", "eor"]�> ar.hourCycles�["h12"]�> ar.numberingSystems�["latn"]�> ar.timeZones�undefined
> let arEG = new Intl.Locale("ar-EG")�> arEG.calendars�["gregory", "coptic", "islamic", "islamic-civil", "islamic-tbla"]�> arEG.collations�["compat", "emoji", "eor"]�> arEG.hourCycles�["h12"]�> arEG.numberingSystems�["arab"]�> arEG.timeZones�["Africa/Cairo"]
> let ja = new Intl.Locale("ja")�> ja.calendars�["gregory", "japanese"]�> ja.collations�["unihan", "emoji", "eor"]�> ja.hourCycles�["h23"]�> ja.numberingSystems�["latn"]�> ja.timeZones�undefined
> let jaJP = new Intl.Locale("ja-JP")�> jaJP.calendars�["gregory", "japanese"]�> jaJP.collations�["unihan", "emoji", "eor"]�> jaJP.hourCycles�["h23"]�> jaJP.numberingSystems�["latn"]�> jaJP.timeZones�["Asia/Tokyo"]}
New
Change to ECMA402 Part 1 - add “get Intl.Locale.prototype.textInfo”
Change to ECMA402 Part 2 - add “get Intl.Locale.prototype.weekInfo”
Change to ECMA402 Part 3
New
Change to ECMA402 Part 4
New
Change to ECMA402 Part 5
New
Change to ECMA402 Part 6
New
References
ECMA402 2021-04 Monthly Meeting
Entrance Criteria:
Acceptance Signifies:
The solution is complete and no further work is possible without implementation experience, significant usage and external feedback.
Entrance Criteria / Acceptance Signifies�For Stage 3
Requesting the Committee Approval for advancement to Stage 3
Entrance Criteria / Acceptance Signifies�For Stage 2
Entrance Criteria:
Acceptance Signifies:
Entrance Criteria For Stage 1