You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is related to how the plural rule is applied to the string, which is translated using react.i18next in conjunction with i18next-icu where intl-messageformat is a peer dependency. Initially, I suspected the issue lay with i18next-icu. However, during debugging, I traced it back to this line of code:
None of the rules like other, many, one, etc are functioning correctly. intl-messageformat throws an error, specifically: [TypeError: Cannot read property 'fn' of undefined]. This error occurs when the formatters.getPluralRules() invokes select()here.
If I remove the arguments passed to select() call like below, everything works as expected:
var rule = formatters
.getPluralRules(locales, { type: el.pluralType })
.select();
To Reproduce
See the section Describe the bug
Expected behavior
Correct translation rules for plurals.
Smartphone (please complete the following information):
Which package?
@formatjs/intl-messageformat @ 10.5.0
Describe the bug
The problem is related to how the plural rule is applied to the string, which is translated using react.i18next in conjunction with i18next-icu where
intl-messageformat
is a peer dependency. Initially, I suspected the issue lay with i18next-icu. However, during debugging, I traced it back to this line of code:Translations json:
The use-case:
None of the rules like
other, many, one, etc
are functioning correctly.intl-messageformat
throws an error, specifically:[TypeError: Cannot read property 'fn' of undefined]
. This error occurs when theformatters.getPluralRules()
invokesselect()
here.If I remove the arguments passed to
select()
call like below, everything works as expected:To Reproduce
See the section Describe the bug
Expected behavior
Correct translation rules for plurals.
Smartphone (please complete the following information):
"react": "~18.2.0",
"react-i18next": "~13.3.1",
"react-native": "~0.72.0",
"i18next-icu": "~2.3.0",
"intl-messageformat": "10.5.0",
"@formatjs/intl-locale": "~3.4.5",
"@formatjs/intl-pluralrules": "~5.2.12",
Additional context
The issue might stem from @formatjs/intl-pluralrules.
The text was updated successfully, but these errors were encountered: