0

I am having table structure with the text. I want to localize it using react-i18next.

Using Trans, it supports basic html tags like
. However, I am having email template as follows:

<table><tr><td>Hello User</td></tr><tr><td>Please visit the site for exclusive offers</td></tr></table>

I don't want to separate out table and text. I want it in translation.json itself. Is there any way out to achieve this kind of scenario in i18n?

asked Dec 6, 2024 at 8:35
0

1 Answer 1

0

Just supply your HTML tags to the Trans component. Where the key in the component object matches the HTML tag within your translation JSON. Modify as you see fit.

<Trans i18nKey="yourKey" components={{table: <table></table>, tr: <tr></tr>, td: <td></td>}}/>
answered Dec 9, 2024 at 23:25
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.