...
We will first add the <Trans> where we want to render our sentence.
We will then state the i18nKey as a prop, this is the key we associate with our sentence in the JSON file.
Code Block |
---|
|
<Trans i18nKey="hello_msg" /> |
...
To render the sentence with a link, the components prop is used.
Code Block |
---|
|
<Trans i18nKey="hello_msg" components={{linkToGoogle: <a href="https://www.google.com/"/>}} /> |
Now in our JSON file, we edit our key where we want our link to be.
Code Block |
---|
|
hello_msg: "Hello <linkToGoogle>amazing<linkToGoogle/> world" |