Skip to content
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

Add PluralRules locale data shimming #200

Merged
merged 7 commits into from
Sep 27, 2024
Merged

Conversation

bearfriend
Copy link
Contributor

@bearfriend bearfriend commented Sep 24, 2024

Support for Māori across browsers is inconsistent at best. Specifically for Intl.PluralRules (which is relied upon by formatjs to render plural arguments), no browsers have (proper) native support for Māori's plural categories. The @formatjs/intl-pluralrules polyfill also does not have data for Māori, and provides no value otherwise as Intl.PluralRules is well supported at this point.

We can rely on native Intl.PluralRules as long as we can shim locale data into it for formatjs to use. So, that's what we do here.

@bearfriend bearfriend requested a review from a team as a code owner September 24, 2024 21:09
};

function getCanonicalLocales(locales) {
const mappedLocales = [locales].flat().map(locale => {
Copy link
Contributor Author

@bearfriend bearfriend Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only needed for Safari on older OS versions (< macOS ~12, based on sauce testing), which don't map the aliases back to mi.

@@ -44,7 +44,6 @@
"sinon": "^19.0.2"
},
"dependencies": {
"@formatjs/intl-pluralrules": "^1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify: the other things that this polyfill was providing (the plural rules locale data for browsers who don't support the native API) aren't needed at all anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack! Safari 12 is the only browser that isn't blocked that doesn't support Intl.Pluralules. Do we want to keep it for that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In keeping it, we'd simply continue to include it but then override some of its behavior to support Māori?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline.

Brightspace loads... something in Safari 12 but it's completely unuseable so we're going ahead with removing the polyfill. We expect to block Safari 12 in the near future.

@bearfriend bearfriend merged commit e6f11dd into main Sep 27, 2024
1 check passed
@bearfriend bearfriend deleted the dgleckler/intl-pluralrule branch September 27, 2024 20:24
Copy link

🎉 This PR is included in version 3.19.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants