Versions Compared

Key

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

...

  • A whole word/sentence is wrapped inside a react/HTML node.

Conventions

  1. HTML values are kept out of the locale files

    • HTML values within translation key text can decrease readability.

  2. Hard coded text is not used outside the locale files

    • Using hard coded text within the <Trans> component, means the text has to be maintained in two places. Therefore, we should avoid using hard coded text outside the locale JSON files for easy maintenance.

  3. Links used in the home page are kept inside the homeConfig.ts file

    • This is for easy alteration, if links happen to change

Adding a link with the <Trans> component

Our plain sentence in our JSON file, without any markup:

...

Code Block
languagejs
hello_msg: "Hello <linkToGoogle>amazing<linkToGoogle/> world"

Adding a link without the <Trans> component

A link can be added to a whole sentence without the <Trans> component.

...