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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultValue_plural value is ignored and doesn't get parsed to be the plural form of default value in t function #795

Open
crazyyi opened this issue Mar 20, 2023 · 0 comments

Comments

@crazyyi
Copy link

crazyyi commented Mar 20, 2023

馃悰 Bug Report

The plural form of the default value is not parsed correctly using defaultValue_plural. This seems to be the correct keyword according to i18next's doc, but it always falls back to the default singular value no matter what value I change it to. In order to parse the defaultValue plural forms correctly, I have to add another property called defaultValue_other, which does the same thing as the defaultValue_plural is supposed to do. And it works. I am not sure what other value I can change the property to but this is not documented anywhere.

To Reproduce

A minimal reproducible example.
In this sample project, I have provided both the successful examples and the failed examples.
Every time I modify the keys or i18next tags I use yarn lang:extract to parse the keys and translations with gulp in i18next-parser

Expected behavior

I expected the defaultValue_plural property will produce a correct plural form for the default value. like the first two.
But I got results like the last two when using defaultValue_plural with i18next-parser.

JSON output:

"itemCount_one": "{{ count }} unit",
"itemCount_other": "{{ count }} units", // this only works with property "defaultValue_other"
"itemFailedCount_one": " You can see this is not working using defaultValue_plural: {{ count }} unit",
"itemFailedCount_other": " You can see this is not working using defaultValue_plural: {{ count }} unit"

Your Environment

  • runtime version: node v18
  • i18next version: 22.4.12
  • os: Mac
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

No branches or pull requests

1 participant