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

fix: log error when Intl.PluralRules error #2155

Merged
merged 1 commit into from Mar 8, 2024

Conversation

zatteo
Copy link
Contributor

@zatteo zatteo commented Mar 8, 2024

When using i18next in an environment where Intl and Intl.PluralRules are not available we need to polyfill them.

When using intl and intl-pluralrules package, we also need to include locale data for the language we want like intl/locale-data/jsonp/fr.js (see here). If we do not do it, pluralization will fail silently and we will only get a no plural rule found for: fr warn log.

In this PR, I add a new log in the catch where we try to get the PluralRules. It helps debugging. It allowed to display a new and more explicit No locale data has been provided warn log in my case .

Checklist

  • only relevant code is changed (make a diff before you submit the PR)
  • run tests npm run test
  • tests are included
  • commit message and code follows the Developer's Certification of Origin

Checklist (for documentation change)

  • only relevant documentation part is changed (make a diff before you submit the PR)
  • motivation/reason is provided
  • commit message and code follows the Developer's Certification of Origin

@adrai adrai merged commit 0949a2b into i18next:master Mar 8, 2024
8 checks passed
@adrai
Copy link
Member

adrai commented Mar 8, 2024

will be added in the next release

@coveralls
Copy link

Coverage Status

coverage: 96.197%. remained the same
when pulling 604618a on zatteo:improve-logging
into da6d654 on i18next:master.

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

Successfully merging this pull request may close these issues.

None yet

3 participants