formatjs / formatjs-old

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

Pluralization formatting is not working in IE11 & react-intl >= 3.7 #516

Closed rheckart closed 4 years ago

rheckart commented 4 years ago

Which package? I'm assuming intl-messageformat-parser, intl-messageformat or intl-pluralrules.

Describe the bug

Using a pluralization, such as the below example, should produce the correct output by removing the braced content and replacing it with the calculated result.

Showing {COUNT, plural, =0 {0 notes} one {1 note} other {# notes} }

To Reproduce Steps to reproduce the behavior:

  1. Go to https://5e305cbeb26a2c605940b0ba--csb-0j3tj.netlify.com/
  2. See the unexpected behavior
  3. In a non-IE browser, go to https://codesandbox.io/s/react-intl-formattedmessage-using-plural-ejected-0j3tj
  4. See that the expected behavior occurs (codesandbox don't work correctly on IE)
  5. Go to a react-intl 2.4 sandbox in IE and observe that the formatting works (https://csb-lr3d2.netlify.com/)

Expected behavior In the reproduction example above the output should be no items, 1 item, 8 items

Desktop (please complete the following information):

Additional context In react-intl version 2.4, the formatting correctly occurs.

longlho commented 4 years ago

Did you include @formatjs/intl-pluralrules polyfill? https://github.com/formatjs/react-intl/blob/master/docs/Getting-Started.md#runtime-requirements

dkordik commented 4 years ago

We had not in that sandbox version- thanks. We now have added the related Polyfills, and are experiencing the same behavior. Here's an updated deploy with the Intl.PluralRules/locale polyfills:

https://5e30727b1ecc927a2cc06a76--csb-0j3tj.netlify.com/

longlho commented 4 years ago

I got some other unrelated errors when loading your link( e.g require is undefined)