po-gettext formatter could not correctly handle plural inside a trans
Open
Nobody has claimed this yet.
bug
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 457
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 16
Description
Description
When using both Trans and Plural react macros, gettext formatter does not capture the inner Plural rule properly and instead formats using ICU format.
Verifications
Reproduction Steps
<Trans>
Trans with plural inside
<Plural
value={count}
zero={"There are no items"}
one={"There's one item"}
other={"There are # items"}
/>
</Trans>
Expected Behavior
Expected result:
Po file with:
msgid "There are no items"
msgid_plural "There are # items"
msgstr[0] "There are no items"
msgstr[1] "There's one item"
msgstr[2] "There are # items"
Actual:
msgid "Trans with plural inside{count, plural, zero {There are no items} one {There's one item} other {There are # items}}"
msgstr "Trans with plural inside{count, plural, zero {There are no items} one {There's one item} other {There are # items}}"
Macro Support
Babel with babel-macro-plugin
Lingui Version
5.2
Babel Version
No response
Framework
Create React app
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the gettext formatter's handling of Babel macro output and reproduce the nested Trans/Plural example from the issue. Add a formatter regression test; done means the generated PO content uses msgid/msgid_plural and separate plural translations instead of an ICU-formatted msgstr.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, react, typescript
- Domain
- internationalization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100