question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested Plural and Trans

See original GitHub issue

Hi,

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:closed
  • Created 5 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
Skippidarcommented, Mar 15, 2019

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.

2reactions
tricoder42commented, Jun 3, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found