i18next / i18next-parser

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

useKeysAsDefaultValue broken for Trans component #491

Open amandapouget opened 2 years ago

amandapouget commented 2 years ago

šŸ› Bug Report

When using Trans, default value is populated rather than left as empty string. useDefaultValueAsKeys should result in empty string.

To Reproduce

A codesandbox example or similar or at least steps to reproduce the behavior:

<Trans count={count}>
  <div>{'{{ count, INTEGER }}'}</div>
</Trans>

...
useKeysAsDefaultValue: false

Expected behavior

Should generate this:

"<0>{{ count, INTEGER }}</0>_one": "",
"<0>{{ count, INTEGER }}</0>_other": "",

But generates:

"<0>{{ count, INTEGER }}</0>_one": "<0>{{ count, INTEGER }}</0>",
"<0>{{ count, INTEGER }}</0>_other": "<0>{{ count, INTEGER }}</0>",

Your Environment

Will make a sandbox if the template link above is replaced with a link to a forkable sandbox that contains a Terminal rather a list of search results.

Fley commented 8 months ago

Hi, I still face same behavior on version 8.9.0, what is the status of this ticket?

karellm commented 8 months ago

@Fley I have extremely limited bandwidth to code this project. I will review PRs though. If you want this fixed, I invite you to make a PR