formatjs / formatjs-old

The monorepo home to all of the FormatJS related libraries.
https://formatjs.io/
156 stars 53 forks source link

Intl.ListFormat #154

Closed klimashkin closed 4 years ago

klimashkin commented 5 years ago

Hi, since Intl.ListFormat is already supported in Chrome and there is 100% polyfill, maybe it's a good time to add its support to intl-messageformat, like: You have {count, plural, one {# new message} other {# new messages}} from these people: {people, list}

And also add type for ListFormat into intl-format-cache.

longlho commented 5 years ago

yeah that's definitely in our roadmap, further discussion: https://github.com/formatjs/react-intl/issues/1328

If you have some thoughts on API & message format semantics feel free to share them as well.

Right now I'm actually working on polyfilling https://github.com/tc39/proposal-unified-intl-numberformat since it's quite useful (allow you to format things like 1Kb or 12m/s)

klimashkin commented 5 years ago

Awesome!

We don't use react-intl, dropped its usage in the end of 2014 : ), but just pure intl-messageformat instead. And api inside the message might be just {param, list} with optional {param, list, {style: 'long', type: 'conjunction'}}

longlho commented 5 years ago

ICU messageformat has been traditionally ambiguous in its level of support for custom format. Introducing list would mean supporting custom formatters which require some more thinking around. We'll try to tackle that next.