This Tuesday (March 21), we had a TC39 meeting. I'm bringing a digested (and non-official) version of the Ecma-402 updates for your information and convenience. I hope you like.
Best,
PS: If you are interested in any of these, open the link to find more details and to provide your feedback, which by the way would be extremely helpful. Thanks.
PS2: Anyone, feel free to correct me if any information is misleading or if it could be improved. Thanks
=====
Basically we had 4 proposals.
Overall, the Ecma-402 updates took a bigger slot than original planned. It seems it has gained enough traction to actually make TC39 intrigued and asking lots of questions. Allen Wirfs-Brock (former Ecma-262 editor) mentioned TC39 needs to invest time into understanding more about i18n and what Ecma-402 is doing.
By the way, below the terms stage 1, 2, 3, and 4 are mentioned. Find details about that at https://tc39.github.io/process-document/.
Intl.ListFormat (link)
Presented by Zibi (Mozilla), this is a new API to allow the creation of localized lists. It’s currently at stage 1 (proposal) and seeks stage 2 (draft). It looks something like this:
new Intl.ListFormat("en").format(["John", "Mary", "Mike"]);
// > "John, Mary, and Mike"
TC39 agreed to advanced it to stage 2 (draft) despite some initial confusion about the use cases.
Intl.UnitFormat (link)
New API to allow simple unit formatting. It’s currently at stage 1 (proposal) and seeks stage 2 (draft). It looks something like this:
new Intl.UnitFormat("en", {category: "duration"}).format(2, "hour");
// > "2 hours"
Remaining at stage 1 (proposal). The agreement was that it needs more experimentation and exploration. It was specially confusing for the TC39 the relationship between this formatter and others like relativeTimeFormat and Duration (this one by the way isn’t even elaborated).
Intl.RelativeTimeFormat (link)
New API to allow simple relative time formatting. It’s currently at stage 1 (proposal) and seeks stage 2 (draft). It looks something like this:
new Intl.RelativeTimeFormat("en").format(-10, "second");
// > "10 seconds ago"
Remaining at stage 1 (proposal) pending more understanding. Similar to the UnitFormat.
Intl.DateTimeFormat dateStyle/timeStyle (link)
Update to existing DateTimeFormat. It’s about the addition of preset styles that looks like the below.
let dtf = new Intl.DateTimeFormat("en", {
dateStyle: “short”
}); // "3/21/17"
let dtf = new Intl.DateTimeFormat("en", {
timeStyle: “short”
}); // "1:31 PM"
let dtf = new Intl.DateTimeFormat("en", {
dateStyle: “short”,
timeStyle: “long”
}); // "3/21/17, 1:31:47 PM PDT"
Advanced to stage 1 (proposal), which doesn’t necessarily mean the API was in agreement. It was discussed whether to use the current proposal or to follow using a different approach by breaking it down into two explicit steps like the below.
let options = Intl.DateTimeFormat.getOptionsForStyle("date", "short");
let dtf = new Intl.DateTimeFormat("en", options);
Intl.Segmenter (link)
Presented by (Daniel Ehrenberg), It’s currently at stage 2 (draft) and seeking reviewers for stage 3 (candidate). It’s a new API that helps finding localized grapheme, word and sentence breaks (UTS 29) and line breaks (UAX 14). It looks something like this:
let segmenter = new Intl.Segmenter("fr", {type: "word"});
let segmentIterator = segmenter.segment("Ceci n'est pas une pipe");
It remains at stage 2. Stage 3 reviewers identified.