1 of 18

Intl Locale Info API �for Stage 3

2 of 18

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

3 of 18

Scope / Prior Arts / Underline Supportive Library & Data

4 of 18

Changes After Stage 2

  • Drop support of UnitInfo while advanced to Stage 2�
  • Specify get Intl.Locale.prototype.calendars
  • Specify get Intl.Locale.prototype.collations
  • Specify get Intl.Locale.prototype.hourCycles
  • Specify get Intl.Locale.prototype.numberSystems
  • Specify get Intl.Locale.prototype.timeZones �
  • Spec Draft https://tc39.es/proposal-intl-locale-info/

5 of 18

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

6 of 18

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

7 of 18

Change to ECMA402 Part 1 - add “get Intl.Locale.prototype.textInfo”

8 of 18

Change to ECMA402 Part 2 - add “get Intl.Locale.prototype.weekInfo”

9 of 18

Change to ECMA402 Part 3

New

10 of 18

Change to ECMA402 Part 4

New

11 of 18

Change to ECMA402 Part 5

New

12 of 18

Change to ECMA402 Part 6

New

13 of 18

References

14 of 18

ECMA402 2021-04 Monthly Meeting

  • Agree upon the spec text.
  • Shane and Zibi sign up to be reviewers
  • Agree to support champion to bring proposal to TC39 for Stage 3 Advancement

15 of 18

Entrance Criteria:

  • Complete spec text DONE
  • Designated reviewers have signed off on the current spec text DONE
  • All ECMAScript editors have signed off on the current spec text
  • All Entrance Criteria for State 2 DONE (see next slide)

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

16 of 18

Requesting the Committee Approval for advancement to Stage 3

17 of 18

Entrance Criteria / Acceptance Signifies�For Stage 2

Entrance Criteria:

  • Initial spec text DONE�https://tc39.es/proposal-intl-locale-info/
  • All Entrance Criteria for State 1 DONE (see next slide)

Acceptance Signifies:

  • Stage 1: “The committee expects to devote time to examining the problem space, solutions and cross-cutting concerns”
  • Stage 2: “The committee expects the feature to be developed and eventually included in the standard”

18 of 18

Entrance Criteria For Stage 1

  • Identified “champion” who will advance the addition: DONE- @FrankYFTang
  • Prose outlining the problem or need and the general shape of a solution DONE
  • Illustrative examples of usage DONE
  • High-level API DONE
  • Discussion of key algorithms, abstractions and semantics DONE
  • Identification of potential “cross-cutting” concerns and implementation challenges/complexity DONE
  • A publicly available repository for the proposal that captures the above requirements: DONE�https://github.com/tc39/proposal-intl-locale-info