Fwd: [v8-dev] Intent to ship: Intl.Locale

13 views
Skip to first unread message

Frank Tang

unread,
Feb 20, 2019, 1:11:07 AM2/20/19
to v8-u...@googlegroups.com, Sathya Gunasekaran, Adam Klein, Mathias Bynens, Nebojša Ćirić, Felipe Balbontín, Shane Carr, Jungshik Shi n (신정식, 申政湜), Yang Guo
FYI-

My first attempt sent from ft...@google.com got bounced back. Trying to forward from ft...@chromium.org

Sorry for the DUP

---------- Forwarded message ---------
From: 'Frank Tang (譚永鋒)' via v8-dev <v8-...@googlegroups.com>
Date: Tue, Feb 19, 2019 at 9:59 PM
Subject: [v8-dev] Intent to ship: Intl.Locale
To: <v8-u...@googlegroups.com>, <v8-...@googlegroups.com>, <blin...@chromium.org>
Cc: Sathya Gunasekaran <gsa...@google.com>, Adam Klein <ad...@google.com>, Mathias Bynens <mt...@google.com>, Nebojša Ćirić <ci...@google.com>, Felipe Balbontín <faba...@google.com>, Shane Carr <sf...@google.com>, Jungshik Shi n (신정식, 申政湜) <jung...@google.com>, Yang Guo <yan...@google.com>


Spec

https://tc39.github.io/proposal-intl-locale/


Summary

A Stage 3 proposal that introduces a new standard built-in property of the Intl object, which allows the following:

  • Parsing and manipulating the language, region and script of a locale

  • Reading or writing the Unicode extension tags in a locale

  • A serializable, standard format to store user locale preferences for use in Intl APIs rather than a combination of language and options bag.

  • For future proposals, a Locale class can be used for an interface to get at various kinds of locale data, including likely subtags, first day of the week, various display names, etc.

  • Allow Intl objects to take Intl.Locale object as item in the locales parameter in addition to the pre-existing string form.

Example

let loc = new Intl.Locale("pl-u-hc-h12", {

 calendar: 'gregory'

});

console.log(loc.language); // "pl"

console.log(loc.hourCycle); // "h12"

console.log(loc.calendar); // "gregory"

console.log(loc.toString()); // "pl-u-ca-gregory-hc-h12"

// use Intl.Locale in Intl.DateTimeFormat constructor

let df = new Intl.DateTimeFormat([loc, "pl"]);

// Add likely subtags to the locale

console.log(loc.maximize().toString()); // "pl-Latn-PL-u-ca-gregory-hc-h12"

// Remove likely subtags from locale

console.log((new Intl.Locale("zh-Hant-TW")).minimize().toString()) // "zh-TW"

console.log((new Intl.Locale("zh-Hans-CN")).minimize().toString()) // "zh"

 

Interoperability and compatibility risk

The Intl.Locale is new and should have no risk to break pre-existing javascript code.


Is this feature fully tested?

Yes; our implementation passes our own V8 tests as well as the Test262 tests for all the features. To pass all the test262 tests, V8 is based on the latest ICU version 63 with 3 bug fixing patches (uloc1.patch, uloc2.patch, uloc3.patch), which are part of the coming ICU 64 (schedule to be released on March 29, 2019) release.


Tracking bug

https://crbug.com/v8/7684

 

Link to entry on the Chrome Platform Status dashboard

https://www.chromestatus.com/feature/4936310187884544  

 

Requesting approval to ship?

Yes. Note that since this is a V8/JS feature, this post is just an FYI to blink-dev — no signoff from Blink API owners is required.



--
Frank Yung-Fong Tang
譚永鋒 / 🌭🍊 
Sr. Software Engineer 

--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Klein

unread,
Feb 20, 2019, 2:42:03 PM2/20/19
to ft...@chromium.org, v8-users, v8-...@googlegroups.com, blink-dev
LGTM to ship, one note inline

Based on our previous conversation, it sounds like even with ICU 63 the failures would only be in edge cases, i.e., very uncommon locales. Can you confirm?

Sathya Gunasekaran

unread,
Feb 20, 2019, 3:00:51 PM2/20/19
to Frank Tang (譚永鋒), v8-users, v8-...@googlegroups.com, blink-dev, Adam Klein, Mathias Bynens, Nebojša Ćirić, Felipe Balbontín, Shane Carr, Jungshik Shi n (신정식, 申政湜), Yang Guo
LGTM2

Tracking bug

https://crbug.com/v8/7684

 

Link to entry on the Chrome Platform Status dashboard

https://www.chromestatus.com/feature/4936310187884544  

 

Requesting approval to ship?

Yes. Note that since this is a V8/JS feature, this post is just an FYI to blink-dev — no signoff from Blink API owners is required.

Frank Tang

unread,
Feb 20, 2019, 3:09:54 PM2/20/19
to Adam Klein, v8-users, v8-...@googlegroups.com, blink-dev
YES. In my 30+ years involving software internationalization, I have not seen a real system (beyond toy project from college homework) really use these broken cases. The failure are on some uncommon locale ON some additional edge cases. (not just uncommon locales)
Reply all
Reply to author
Forward
0 new messages