1 of 11

Update of Intl.DisplayNames v2 �in Stage 3

Frank Yung-Fong Tang / 譚永鋒

ftang@google.com

TC39 July 2021 Meeting

July 13-16, 2021

Slide: https://docs.google.com/presentation/d/1EUJ8fIBcCN784S_Da5FT8Fxgo1_lVM8InbSUjhuvpkU

Repo: https://github.com/tc39/intl-displaynames-v2

2 of 11

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.

3 of 11

History of Intl.DisplayNames (v1 and v2)

  • Jan 2019: v1 advanced to Stage 1 in TC39 meeting.
  • Jun 2019: v1 advanced to Stage 2 in TC39 meeting.
  • Oct 2019: v1 advanced to Stage 3 in TC39 meeting.
  • Dec 2019: ECMA402 scaled back v1 by removing features pending on Temporal.
  • Aug 2020: v2 repo is created as Stage 0
  • Sep 2020: Advanced v1 to Stage 4 and v2 to Stage 1
  • Jan 2021: Advanced v2 to Stage 2
  • Apr 2021: Proposed v2 for Stage 3
    • Not able to reach consensus on the spot due to last minutes feature requests and question about user needs.
  • May 2021: Advanced to Stage 3

4 of 11

Enhanced Features

  • Add “languageDisplay” option:
    • For “language” type only
    • Accept “dialect” or “standard”
    • Default: “dialect”
  • Add new type “calendar”
  • Add new type “dateTimeField”

5 of 11

Examples of languageDisplay

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

{type: "language",

languageDisplay: "dialect"})

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",

languageDisplay: "standard"})

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)"

6 of 11

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")

"农历"

7 of 11

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"

8 of 11

Stage 3 Activities

  • Chrome/v8:
    • Stage in Chrome m93
      • Behind the flag of harmony_intl_displaynames_v2
    • Plan to flip to ship in 2021Q3
    • See status page & issue tracker 11637
  • Mozilla: landed (91)
    • see 1693575
  • Safari: unclear
  • Test262: Need help, under feature tag “Intl.DisplayNames-v2”
  • MDN: Need help
  • Polyfills: Need help

9 of 11

Acknowledgement

I would like to thank the following delegates for supporting the development & deployment of this proposal

  • Stage 3 Reviewers: Shane F. Carr @sffc / Ujjwal Sharma @ryzokuken
  • Editor: Richard Gibson @gibson042
  • TG2 members: Long Ho @longlho and other member of TG2

Also special thanks to André Bargul @anba from Mozilla for his amazing review.

10 of 11

Q&A

11 of 11

Requesting the Committee

to help the development of test262, MDN, polyfills and to evangelize this new API