New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing support for Norwegian locales in Chrome >=92 breaks formatjs #3066
Labels
Comments
looks like the fix is to change |
longlho
added a commit
that referenced
this issue
Jul 24, 2021
longlho
added a commit
that referenced
this issue
Jul 24, 2021
longlho
added a commit
that referenced
this issue
Jul 24, 2021
This helped us: // polyfills.js
// Chrome 92
// https://bugs.chromium.org/p/chromium/issues/detail?id=1215606&q=norwegian&can=2
// https://github.com/formatjs/formatjs/issues/3066
import '@formatjs/intl-datetimeformat/polyfill-force';
import '@formatjs/intl-datetimeformat/locale-data/en';
import '@formatjs/intl-datetimeformat/locale-data/nb';
import '@formatjs/intl-datetimeformat/locale-data/sv';
import '@formatjs/intl-numberformat/polyfill-force';
import '@formatjs/intl-numberformat/locale-data/en';
import '@formatjs/intl-numberformat/locale-data/nb';
import '@formatjs/intl-numberformat/locale-data/sv'; Seems like once you force the locale polyfill, you have to explicitly polyfill every other language too? |
You can load those dynamically like if (shouldPolyfill('nb')) {
import('@formatjs/intl-numberformat/locale-data/nb');
} |
ingara
added a commit
to navikt/su-se-framover
that referenced
this issue
Aug 3, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Which package?
This is causing issues in
@formatjs/intl-numberformat
and@formatjs/intl-datetimeformat
, but impacts anywhere that relies on the browser for Intl supported locales.Polyfilling with
@formatjs/intl-pluralrules/should-polyfill
can be used to workaround the issue, but only if that polyfill is forced in Chrome with@formatjs/intl-numberformat/polyfill-force
.Describe the bug
Norwegian locales are not currently supported in Google Chrome versions 92 and above, which causes formatjs to fail. The polyfills successfully work around the issue but aren't applied without the (private) polyfill force package because Chrome >= 92 is expected to support these rules.
Here's where the check fails in formatjs:
formatjs/packages/intl/src/create-intl.ts
Line 76 in eb9f193
To Reproduce
Codesandbox URL
Reproducible directly in the browser console window.
Reproducible Steps/Repo
Steps to reproduce the behavior:
window.Intl.NumberFormat.supportedLocalesOf(['nb-NO', 'nn-NO', 'en-US'])
(Similarly,
window.Intl.DateTimeFormat.supportedLocalesOf(['nb-NO', 'nn-NO', 'en-US'])
will check DateTimeFormat).Expected behavior
Expectation is an array which includes the Norwegian locales: ["nb-NO", "nn-NO", "en-US"]
Actual: ["en-US"]
Desktop (please complete the following information):
Additional context
There's an existing Chromium bug reported, but we hope that formatjs may be able to work around the issue for users of this project: https://bugs.chromium.org/p/chromium/issues/detail?id=1215606&q=norwegian&can=2
We are able to patch the issue using polyfill-force but that applies the polyfills to all browsers, would formatjs be able to patch this in a more targeted way?
The text was updated successfully, but these errors were encountered: