Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you interpolate dynamic values with the Trans component? #187

Open
JakeAngell opened this issue Feb 28, 2024 · 0 comments
Open

Can you interpolate dynamic values with the Trans component? #187

JakeAngell opened this issue Feb 28, 2024 · 0 comments

Comments

@JakeAngell
Copy link

JakeAngell commented Feb 28, 2024

Is your feature request related to a problem? Please describe.

There seems to be no way to interpolate strings with dynamic variables at the moment using the Trans component, if you want to interpolate with html tags like <em></em> at the same time.

Describe the solution you'd like

It seems like the react-i18nnext lib allows you to pass in values to be interpolated in as props on the Trans component.

e.g.

<Trans i18nKey="userMessagesUnread" count={count}>
      Hello <strong title={t('nameTitle')}>{{name}}</strong>, you have {{count}} unread message. <Link to="/msgs">Go to messages</Link>.
    </Trans>

Describe alternatives you've considered

Attempted to use a combination of Trans and t but cannot get the correct result.

Additional context

None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant