Nested Plural and Trans
See original GitHub issueHi,
I don’t know if i misread the documentation or if it’s a bug.
I did copy/paste the following example from the documentation:
<p>
<Plural
value={messagesCount}
one={`There's # message in your inbox, ${name}`}
other={<Trans>There're <strong>#</strong> messages in your inbox, {name}</Trans>}
/>
</p>
When i extract the translations i get:
msgid "{messagesCount, plural, one {There's # message in your inbox, {name}} other {}}"
msgstr "" // here i copied the id
So when the count is ‘1’, i get the correct translation (with the correct values). If i force the value
attribute to 2
i got nothing (empty string).
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
From Transgender to Plural: Evolution of Identity
When our binary-female identity (Ellie) first emerged in a more permanent way, we believed she was our one and true “authentic self”. This...
Read more >@lingui/macro - Reference — LinguiJS documentation
Additional validation of plural rules is performed during transformation. Non essentials data are removed from production build (e.g. comments and default ...
Read more >Trans Component - react-i18next documentation
This component enables you to nest any React content to be translated as one cohesive string. It supports both plural and interpolation.
Read more >Tutorial - Internationalization of React apps - LinguiJS
We can use nested macros, components, variables, expressions, really anything. This gives us enough flexibility for all usecases. Custom message ID¶. Let's ...
Read more >php - Use pluralization with nested keyword messages - Stack ...
$translator->transChoice( 'msg.singular|msg.plural', 2 );. This on its own outputs either msg.singular or as in this case msg.plural as expected, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Got same bug. Had to set “few” and “many” props, then translations appeared. As I can see, empty (or not set) “few”"many" prop doesn’t result in fallback to “other” prop.
This is already fixed in v3 (please checkout pre-release #334).
Ordering of imports doesn’t matter, the top-most macro is always processed first and “consumes” all inner macros.