i18next / i18next-parser

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

React component key is extracted instead of i18nKey #1038

Open Shiwa opened 1 month ago

Shiwa commented 1 month ago

šŸ› 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