1 of 20

Intl.DisplayNames v2 �for Stage 3

2 of 20

History of Intl.DisplayNames

  • Aug 2020: v2 repo is created as Stage 0 to track additional feature requests (will be discussed later)
  • Sep 2020: Advanced v2 to Stage 1 in TC39 meeting.
  • Jan 2021: Advanced v2 to Stage 2
  • April 2021: Proposed v2 to Stage 3

3 of 20

Motivation

To enable developers to get human translation of language, region, script, and other display names on the client.

Also, provide a straightforward API to provide the functionality to reduce developers to use “work in some context but not other” work around.

4 of 20

Change after �ECMA402 Jan Stage 2 Discussion

  • Calendar
  • Unit
  • Spec out Dialect Support
  • Add names for “Date Time Fields”

5 of 20

Change to ECMA402 - Part 1

New

6 of 20

Examples of Dialect Handling

d8> dn2 = new Intl.DisplayNames("en",

{type: "language",

dialectHandling: "dialectName"})

d8> dn2.of("en")

"English"

d8> dn2.of("en-GB")

"British English"

d8> dn2.of("en-US")

"American English"

d8> dn2.of("en-AU")

"Australian English"

d8> dn2.of("en-CA")

"Canadian English"

d8> dn2.of("zh")

"Chinese"

d8> dn2.of("zh-Hant")

"Traditional Chinese"

d8> dn2.of("zh-Hans")

"Simplified Chinese"

d8> dn3 = new Intl.DisplayNames("en",

{type: "language",

dialectHandling: "standardName"})

d8> dn3.of("en")

"English"

d8> dn3.of("en-GB")

"English (United Kingdom)"

d8> dn3.of("en-AU")

"English (Australia)"

d8> dn3.of("en-CA")

"English (Canada)"

d8> dn3.of("en-US")

"English (United States)"

d8> dn3.of("zh")

"Chinese"

d8> dn3.of("zh-Hant")

"Chinese (Traditional)"

d8> dn3.of("zh-Hans")

"Chinese (Simplified)"

New

7 of 20

Change to ECMA402 - Part 2

New

8 of 20

Example of type: “calendar”

d8> dn = new Intl.DisplayNames("en", �{type: "calendar"})

d8> dn.of("roc")

"Minguo Calendar"

d8> dn.of("persian")

"Persian Calendar"

d8> dn.of("gregory")

"Gregorian Calendar"

d8> dn.of("ethioaa")

"Ethiopic Amete Alem Calendar"

d8> dn.of("japanese")

"Japanese Calendar"

d8> dn.of("dangi")

"Dangi Calendar"

d8> dn.of("chinese")

"Chinese Calendar"

d8> dn = new Intl.DisplayNames("zh", �{type: "calendar"})

d8> dn.of("roc")

"民国纪年"

d8> dn.of("persian")

"波斯历"

d8> dn.of("gregory")

"公历"

d8> dn.of("ethioaa")

"埃塞俄比亚阿米特阿莱姆日历"

d8> dn.of("japanese")

"和历"

d8> dn.of("dangi")

"檀纪历"

8> dn.of("chinese")

"农历"

Unchanged from Stage 1

9 of 20

Example of type: “unit”

d8> dn1 = new Intl.DisplayNames("zh-Hant", {type: "unit"})

d8> dn1.of("meter")

"公尺"

d8> dn1.of("degree")

"角度"

d8> dn1.of("kilogram")

"公斤"

d8> dn2 = new Intl.DisplayNames("fr", {type: "unit"})

d8> dn2.of("meter")

"mètres"

d8> dn2.of("degree")

"degrés"

d8> dn2.of("kilogram")

"kilogrammes"

Unchanged from Stage 1

10 of 20

Change to ECMA402 - Part 3

New

11 of 20

Example of type: “dateTimeField”

d8> dn = new Intl.DisplayNames("zh", {type: "dateTimeField"})

d8> dn.of("era")

"纪元"

d8> dn.of("year")

"年"

d8> dn.of("month")

"月"

d8> dn.of("quarter")

"季度"

d8> dn.of("weekOfYear")

"周"

d8> dn.of("weekday")

"工作日"

d8> dn.of("dayPeriod")

"上午/下午"

d8> dn.of("day")

"日"

d8> dn.of("hour")

"小时"

d8> dn.of("minute")

"分钟"

d8> dn.of("second")

"秒"

d8> dn = new Intl.DisplayNames("es", {type: "dateTimeField"})

d8> dn.of("era")

"era"

d8> dn.of("year")

"año"

d8> dn.of("month")

"mes"

d8> dn.of("quarter")

"trimestre"

d8> dn.of("weekOfYear")

"semana"

d8> dn.of("weekday")

"día de la semana"

d8> dn.of("dayPeriod")

"a. m./p. m."

d8> dn.of("day")

"día"

d8> dn.of("hour")

"hora"

d8> dn.of("minute")

"minuto"

d8> dn.of("second")

"segundo"

New

12 of 20

Change to ECMA402 - Part 4

13 of 20

Change to ECMA402 - Part 5

New

14 of 20

Change to ECMA402 - Part 6

15 of 20

References

  • Reviewers:
    • Shane Carr
    • Ujjwal Sharma
  • Editor: Richard Gibson
  • V8 prototype: https://chromium-review.googlesource.com/c/v8/v8/+/2335890
  • Mozilla:
  • JSC:

16 of 20

ECMA402 2021-04-09 Monthly Meeting

Shane Carr and Ujjwal Sharma sign up for Stage 3 reviewers

Agree to support champion to bring to TC39 April meeting for Stage 3 advancement.

17 of 20

Entrance Criteria / Acceptance Signifies�For Stage 3

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.

18 of 20

Requesting the Committee Approval for advancement to Stage 3

19 of 20

Entrance Criteria / Acceptance Signifies�For Stage 2

Entrance Criteria:

  • Initial spec text DONE�https://tc39.es/intl-displaynames-v2/
  • 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

20 of 20

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/intl-displaynames-v2