i18next-parser
i18next-parser copied to clipboard
React component key is extracted instead of i18nKey
🐛 Bug Report
When extracting translation from a Trans component with a react key prop, this key is used in place of the i18nKey.
To Reproduce
Running i18next-parser on the following tsx code
<SomeComponent
texts={[
<Trans ns="settings" key={0} i18nKey="my.i18n.key">
<span className="font-bold">Lorem Ipsum…</span>
</Trans>,
]}
/>
Expected behavior
The etracted key should be my.i18n.key but is instead {0}
{
"{0}": "<0>Lorem Ipsum…</0> "
}
Your Environment
- runtime version: node 20, pnpm
- i18next version: 23.6.0 ; react-i18next: 13.3.1 ; i18next-parser: 8.13.0
- os: Linux
- I tried quickly with i18next-parser 9.0.1 and by customizing the JsxLexer, but got the same result. Changing the prop order of key / i18nKey did not fix the problem either, key is always used in place of i18nKey
If you like you could try if it works with: https://github.com/i18next/i18next-cli