eemeli / intl-pluralrules

Polyfill for Intl.PluralRules
https://www.npmjs.com/package/intl-pluralrules
ISC License
41 stars 7 forks source link

Support minimumFractionDigits #2

Closed stasm closed 5 years ago

stasm commented 5 years ago

Hi @eemeli, thank you for creating this polyfill!

Now that the PluralRules proposal has reached Stage 4, I wonder if the reasons for the diversion from the spec described in the README still hold?

The prototype.select() input is not forced to number, so for locales like English the correct plural rule is returned for '1.0' input. On the other hand, the minimum/mamximum digits options are ignored.

Even if Intl.PluralRules is now avaiable in Chrome, Firefox and Node.js 10+, your polyfill continues to useful in environments still running Node 8 (now in maintenance mode). The native v8 implementation also appears to be buggy wrt. considering minimumFractionDigits, which could make your polyfill viable even in modern Node and Chrome.

Would you be open to updating the polyfill to match the spec?

eemeli commented 5 years ago

I have no good reason for the divergence any more, so yeah, ought to update the polyfill. Please remind me if I've not gotten to this within the next week or so?

eemeli commented 5 years ago

Updated, and released as 1.0.0.

I went and also added support for min/max significant digits and improved the locale support detection when used as a polyfill.