i18next / i18next-parser

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

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

Closed cochery closed 3 months ago

cochery commented 5 months 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 4 months ago

Same here after updating to 9.0.0.

glsignal commented 4 months ago

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

karellm commented 3 months ago

This is now part of 9.0.1.