3
2 Comments

React i18n - Extend react-intl with our own context and markup

I was recently looking for a neat way to make react-intl translations keys more dynamic and our React code less verbose when it comes to passing values.

Fortunately it's quite easy to wrap react-intl to create your own markup language and expose constants that must be reused across keys.

The blog article below summarizes how to do it:
https://www.keypup.io/blog/react-extend-react-intl-with-our-own-context-and-markup

Hope this helps anyone looking to simplify their i18n code :)

on May 11, 2021
  1. 1

    Hey i have created an app that translate json files into multiple languages without breaking placeholders. Here is the link if you want to check it out: https://localizejson.lovable.app

  2. 2

    This is a great guide about i18n which helps removing the occasional need for dangerouslySetInnerHTML. Very cool!