--
You received this message because you are subscribed to the Google Groups "JavaScript Globalization" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-globali...@googlegroups.com.
To post to this group, send email to javascript-g...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/javascript-globalization/17328bff-ec4e-4184-b9b1-c5ec44a21e30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yeah, exactly; the motivation here is to avoid having to drag in Closure or similar libraries given that browsers already ship ICU.
To view this discussion on the web visit https://groups.google.com/d/msgid/javascript-globalization/CY1PR0501MB13690378A0CDFCC728E6C268DFD50%40CY1PR0501MB1369.namprd05.prod.outlook.com.
This low-level Intl.PluralFormat API could then be used along with Intl.NumberFormat and Intl.DateTimeFormat to back a higher-level ICU Message Format API.
To view this discussion on the web visit https://groups.google.com/d/msgid/javascript-globalization/5F66F4DB-05D7-48CF-B48D-05BA3FF186EB%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/javascript-globalization/CADdLYsoqqur1RchKAD_toV1dMtiGP4F5FkKfF92w_LMSR0J4Zw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/javascript-globalization/055605B7-CDD9-4077-999F-CD032211F2A1%40icu-project.org.
Eric, this sounds really good. I think this kind of incremental step (Intl.PluralFormat) would make a lot of sense, since Alex’s more ambitious plan of specifying MessageFormat seems like a large dependency to introduce. Getting pluralization support into the hands of users sooner would be truly great.
> Maybe better would be returning a known Symbol since the potential return values are finite?
No, a string is much better for JS enums. Symbols should only be used to prevent collision with future author-defined properties.
--
You received this message because you are subscribed to a topic in the Google Groups "JavaScript Globalization" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/javascript-globalization/3nFDf5al5hU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
javascript-globali...@googlegroups.com.
To post to this group, send email to
javascript-g...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/javascript-globalization/5F66F4DB-05D7-48CF-B48D-05BA3FF186EB%40gmail.com.
Eric, this sounds really good. I think this kind of incremental step (Intl.PluralFormat) would make a lot of sense, since Alex’s more ambitious plan of specifying MessageFormat seems like a large dependency to introduce. Getting pluralization support into the hands of users sooner would be truly great.
I’m up for helping to formalize my proposal in this thread. I can work on it next week at the TC39 meeting.I see one major API decision to work out, and that’s whether we want `.format(number)` to return one the discrete ICU plural category strings: “zero”, “one”, “two”, “few”, “many”, or “other” and require the developer to `switch` on that value, or if we want to have the constructor take these as options and do the switch/selection internally.1) new Intl.PluralFormat(‘en-US’).format(100); // => “other”vs.2) new Intl.PluralFormat(‘en-US’, {one: ‘comment’,other: ‘comments’}).format(100); // => “comments”#1 would be more flexible and lower level, but #2 is probably closer to the majority use-case of selecting the correct string “label”.Thoughts?
I’m up for helping to formalize my proposal in this thread. I can work on it next week at the TC39 meeting.I see one major API decision to work out, and that’s whether we want `.format(number)` to return one the discrete ICU plural category strings: “zero”, “one”, “two”, “few”, “many”, or “other” and require the developer to `switch` on that value, or if we want to have the constructor take these as options and do the switch/selection internally.1) new Intl.PluralFormat(‘en-US’).format(100); // => “other”vs.2) new Intl.PluralFormat(‘en-US’, {one: ‘comment’,other: ‘comments’}).format(100); // => “comments”#1 would be more flexible and lower level, but #2 is probably closer to the majority use-case of selecting the correct string “label”.
On Wednesday, September 16, 2015 at 11:55:45 AM UTC-7, Eric Ferraiuolo wrote:I’m up for helping to formalize my proposal in this thread. I can work on it next week at the TC39 meeting.I see one major API decision to work out, and that’s whether we want `.format(number)` to return one the discrete ICU plural category strings: “zero”, “one”, “two”, “few”, “many”, or “other” and require the developer to `switch` on that value, or if we want to have the constructor take these as options and do the switch/selection internally.1) new Intl.PluralFormat(‘en-US’).format(100); // => “other”vs.2) new Intl.PluralFormat(‘en-US’, {one: ‘comment’,other: ‘comments’}).format(100); // => “comments”#1 would be more flexible and lower level, but #2 is probably closer to the majority use-case of selecting the correct string “label”.
I would prefer 1). My reasoning is that you can easily create 2 out of 1, but getting to 1 out of 2 is non-trivial.
Another reason is that not all technologies will want a simple one-dimensional string branching - we use multilevel, and 2) doesn't fit into this too much (we may branch on plural, then gender, then something else).
I'm fine leaving #2 out, but I don't think `format` is the right name for a function that returns a pluralization key.
Another reason is that not all technologies will want a simple one-dimensional string branching - we use multilevel, and 2) doesn't fit into this too much (we may branch on plural, then gender, then something else).At this point it's full MessageFormat again (or similar), right?
zb.
--
You received this message because you are subscribed to the Google Groups "JavaScript Globalization" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-globali...@googlegroups.com.
To post to this group, send email to javascript-g...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/javascript-globalization/54790cf5-a61d-48fe-ab2d-5b722e07f219%40googlegroups.com.
On Wed, Sep 16, 2015 at 3:01 PM <zbran...@mozilla.com> wrote:
On Wednesday, September 16, 2015 at 12:54:11 PM UTC-7, Alex Sexton wrote:I'm fine leaving #2 out, but I don't think `format` is the right name for a function that returns a pluralization key.
Agree.
Intl.PluralForm(navigator.languages).resolve(100)
?
Another reason is that not all technologies will want a simple one-dimensional string branching - we use multilevel, and 2) doesn't fit into this too much (we may branch on plural, then gender, then something else).At this point it's full MessageFormat again (or similar), right?
Sort of. MessageFormat is one of the approaches, that ICU champions, but I believe that there's room for a better one (or several) and I expect to see a new generation of localization libraries to come to life soon, compete for a while, and maybe then we'll get something worth standardizing.
PluralForm is required for all of them, and having it in Intl would lower the barrier for them. But another lesson from my analysis of our Firefox OS project is that we have cases where we need to get plural form outside of localization strings. Solution #1 would give both raw JS, and l10n libraries a good base.
We could also evaluate a merged approach, based on #1, but with ability to perform #2. For example:
var f = Intl.PluralForm(navigator.languages);
f.resolve(100); // 'other'
f.format(100, {
one: 'comment',
other: 'comments'
}); // 'comments'This feels like it's a nice API surface. It covers the by-far-most-common use-case, and allows for people to build more complex systems with the primitives.Feels weird to require people to write out this same boilerplate in all of their applications:```jsIntl.PluralForm.prototype.format = function(number, choices = {}) {return choices[this.format(number)];};```
Intl.PluralForm(navigator.languages).resolve(100)
The fact that we will be able to reuse the instance is enough reason for me to choose 1. lets remember that creating instances of intl stuff is usually an expensive operation. in the case of #2 we will have to create new instances for every combination of labels.
Ok guys, finally got a chance to work on this, here is the initial proposal flush out:
On Saturday, September 19, 2015 at 3:01:18 PM UTC-7, Caridy Patiño wrote:Ok guys, finally got a chance to work on this, here is the initial proposal flush out:Thank you for drafting the spec.I wonder if it's possible to add an 'end-to-end' usage example to format messages with plural to README.md. e.g. what steps should be taken to get a result equivalent to the following ICU example?"{num_people, plural, ""=0 {I met nobody in {place}.}""=1 {I met a person in {place}.}""other {I met # people in {place}.}}")I'm aware that this spec has a very specific (narrow) scope on purpose, but I think it's not a bad idea to think about how this can be integrated with a translation process and resource bundle handling.
JungshikP.S.FYI, for Chrome's (internal) use (web UI), I'm considering supporting ICU message format.Another FYI, has anybody seen this ? https://github.com/yahoo/intl-messageformat (or has it been mentioned in the thread already? )
The generated spec [draft] is here:https://rawgit.com/caridy/intl-plural-form-spec/master/index.html
I will work with @ericf next week for formalize the proposal, get the polyfill ready and to see if we can formally presented (if we get a chance to add it to the agenda, which I doubt)./caridy
On Friday, May 1, 2015 at 6:16:37 AM UTC-7, Domenic Denicola wrote:Hi all,
I'm here to forward a concern from the V8 and Chrome teams, which originally came up in https://code.google.com/p/chromium/issues/detail?id=481718. We were frustrated that, while ICU includes pluralization support, that was not included in Ecma 402. As such, we were hoping to get an update on whether this would be a priority for you all with regard to the next edition? Has this perhaps been considered in the past but dropped?
Thanks very much for your consideration,
-Domenic
--
You received this message because you are subscribed to the Google Groups "JavaScript Globalization" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-globali...@googlegroups.com.
To post to this group, send email to javascript-g...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/javascript-globalization/89c9d4a7-c653-4e80-a8ae-f4c85d3579cc%40googlegroups.com.
On Sep 22, 2015, at 5:27 PM, Jungshik Shin (신정식, 申政湜) <js...@chromium.org> wrote:f.resolve(100); // 'other'f.format(100, {one: 'comment',other: 'comments'}); // 'comments'With the above approach, I wonder what messages in source language and target languages would look like. Up to 6 separate messages? Out of which a the following can be built.
{one: 'a person attended',other: '{num_person} people attended'}Chrome used to have a 6-string approach, but we switched to a single message approach (used by Android and other Google products) with ICU message format.
FYI, for Chrome's (internal) use (web UI), I'm considering supporting ICU message format.
Another FYI, has anybody seen this ? https://github.com/yahoo/intl-messageformat (or has it been mentioned in the thread already? )
UPDATE: This proposal has advanced to stage 1, details here: https://github.com/caridy/intl-plural-rules-spec
--
You received this message because you are subscribed to the Google Groups "JavaScript Globalization" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-globali...@googlegroups.com.
To post to this group, send email to javascript-g...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/javascript-globalization/f53f3ef5-5efc-4ac6-a917-60c62d03404c%40googlegroups.com.