Intl.js
Intl.js copied to clipboard
Import plural rules data
I'm working on adding Intl.PluralRules to Intl.js[0].
One area which I could use help with is getting the data for the API available.
The data should be pulled from CLDR json/xml, parsed into JS functions and attached so that [1] can read it.
It seems to me that the easiest way to achieve it would be to reuse @eemeli's make-plural.js[2]. @eemeli, would you be able to help me get it hooked into Intl.js?
[0] https://github.com/zbraniecki/Intl.js/tree/pluralrules [1] https://github.com/zbraniecki/Intl.js/blob/pluralrules/src/core.js#L92 [2] https://github.com/eemeli/make-plural.js
Sure. Actually, for something of a lark and as a proof-of-concept, I put together an Intl.PluralRules polyfill a year ago, based on the then-current version of the draft & also using make-plural.js. I'll have a look at the state of this codebase, and see what's needed. No promises on timeframes, though.
I can probably help with this.
@caridy - awesome!
@eemeli - yeah, it's actually awesome to work with multiple different polyfills while ironing out the spec. I have your polyfill, my polyfill, my Gecko implementation and now I'm trying to write the Intl.js patch without looking at other polyfills - just following the spec ;)
I'll have a go at writing a PluralRuleSelection function that uses make-plural.js for its "implementation dependent algorithm".
@eemeli awesome! Thank you.
Please, make sure to stay in line with @caridy's planned https://github.com/andyearnshaw/Intl.js/issues/242 - I want to make sure that PluralRules is an optional plugin for Intl.js.
You should probably have a look at what the formatJS guys did in their library. They have ICU message formatting and plural rules. And everything based on CLDR data, too.
@caridy , @eemeli - can you guys help me get PluralRules into Intl.js? I landed it in SpiderMonkey, and would like to get a separate implementation to test the spec fully.
Ummm. Did you perhaps miss my PR for this, onto your zbraniecki:pluralrules branch?
https://github.com/zbraniecki/Intl.js/pull/1
Is this still an issue?
The plurals are imported, but I can't get to test it, details in #1.