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.

Allow named components in Trans

See original GitHub issue

The documentation of Trans has the following example:

<Trans id="Read the <0>docs</0>." components={{0: <a href="/docs" />}} />

Since the number tags don’t provide much context to the translator I was hoping I could use named tags instead as such:

<Trans id="Read the <link>docs</link>." components={{link: <a href="/docs" />}} />

Unfortunately, it seems only numbered tags are supported.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
fdevcommented, Jul 30, 2022

I’m replying (again again) to keep this issue from going stale. I would still very much like to see this implemented.

0reactions
stale[bot]commented, Sep 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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. Let's...
Read more >
React-i18n Trans Component with translations that contain ...
I read in the docs that you can use something called Trans components for translations with HTML tags. Docs: Using for <br />...
Read more >
Use i18next Trans Component to Translate Complex React ...
The react-i18next library has a Trans component that we can use to interpolate or translate complex react element. In most cases, we don't...
Read more >
Support passing objects to <Trans components={{ ... }} /> #833
Which would enable the use of the "named placeholder" method above. I can have a stab at this myself, just will have to...
Read more >
Complex Translations Using the Trans Component
Let's assume that we want to use a Link component inside of our translations. The code might resemble this: <p> <label> <input type="checkbox"...
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