Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Safari browser pluralization failure

See original GitHub issue

In the Safari browser (Version 12.1.1) using ICU message format for interpolation leads to an error:

Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating '(_a = Intl.PluralRules).bind')

The global object Intl is empty. And binding of Intl.PluralRules cause to the error.


"sapper": "^0.27.9",
"svelte": "^3.12.1",
"svelte-i18n": "^1.1.2-beta",

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

rodochcommented, May 26, 2020

Resurrecting this issue as I can verify it’s a real problem on older versions of Safari and when it occurs as an uncaught exception it can hang your application. This is how I solved it:

Install plural rules polyfill

npm install @formatjs/intl-pluralrules

As per

Conditionally load polyfill in client.js

import * as sapper from '@sapper/app';

import 'i18n';

const config = {
    target: document.querySelector('#sapper')

if (!Intl.PluralRules) {
    (async () => {
        await import('@formatjs/intl-pluralrules/polyfill');
	await import('@formatjs/intl-pluralrules/dist/locale-data/en');
	await import('@formatjs/intl-pluralrules/dist/locale-data/ga');
} else {
felideoncommented, Jan 20, 2020

Hi @kaisermann. It’s actually not affecting me anymore because I am no longer doing any redirects for the default locale.

Read more comments on GitHub >

github_iconTop Results From Across the Web

If Safari on Mac doesn't open a webpage or isn't working as ...
If Safari isn't working as you expect, one of these solutions might help. These solutions are for issues that affect Safari on Mac, ......
Read more >
React-Intl: Message not formatting in Safari - Stack Overflow
Reason is that Intl.PluralRules it not available on Safari. Just use this polyfill and everything should work as expected.
Read more >
Intl.PluralRules - JavaScript - MDN Web Docs
Chrome Edge PluralRules Full support. Chrome63. Toggle history Full support. Edge18. Tog... PluralRules() constructor Full support. Chrome63. Toggle history Full support. Edge18. Tog... resolvedOptions Full support....
Read more >
Social login fails when using Safari - Akamai TechDocs
Due to changes in web browser technology, including the fact that most browsers prohibit the use of third-party cookies, SSO using the JavaScript...
Read more >
online ipa installer - Cucina Esplosiva
Return Download App Install App {{errorTitle || 'Signing failed'}} ... Make sure to visit this page from Safari Browser. slugrail. ipa file for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found