i18next / i18next-parser

Parse your code to extract translation keys/values and manage your catalog files
MIT License
466 stars 189 forks source link

Plural keys not detected anymore when `count` is an expression #1015

Open cochery opened 3 weeks ago

cochery commented 3 weeks ago

💥 Regression Report

t('mykey', '{{count}} something', { count: expression() }) used to be extracted as 2 plural keys, but the plural form isn't detected anymore.

t('mykey', '{{count}} something', { count: value }) is still extracted as 2 plural keys.

Last working version

Worked up to version: 8.13.0

Stopped working in version: 9.0.0

To Reproduce

Steps to reproduce the behavior:

function expression() {
  return 1;
}
`t('mykey', '{{count}} something', { count: expression() })`

Only one key mykey is extracted.

Expected behavior

2 keys mykey_one and mykey_other should be extracted in English. That was the former behaviour and still works when count is a value and not an expression.

Probably introduced by https://github.com/i18next/i18next-parser/pull/994

Your Environment

Zerebokep commented 2 weeks ago

Same here after updating to 9.0.0.

glsignal commented 19 hours ago

Ran into this issue as well. I opened a PR with a patch here -> https://github.com/i18next/i18next-parser/pull/1022