Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We will first add the <Trans> where we want to render our sentence.

Code Block
languagejs
<Trans>

We will then state the i18nKey as a prop, this is the key we associate with our sentence in the JSON file.

Code Block
languagejs
<Trans i18nKey="hello_msg" />

...

To render the sentence with a link, the components prop is used.

Code Block
languagejs
<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
languagejs
hello_msg: "Hello <linkToGoogle>amazing<linkToGoogle/> world"