yassinedoghri / astro-i18next

An astro integration of i18next + some utility components to help you translate your astro websites!
https://astro-i18next.yassinedoghri.com
MIT License
502 stars 38 forks source link

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

Open JakeAngell opened 7 months ago

JakeAngell commented 7 months ago

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.