Using React Intl without a key

22 views Asked by At

5 years ago, my team started building a React web app. We made a conscious decision to hard code all text strings in American English. It expedite our development. Now we need to expand it to display additional languages.

After much research, it appears the two major packages to help us internationalize the app are: react-i18next and react-intl. The latter has been recommended for us to use by the owner of a company that offers a language translation management website.

With react-intl, the general approach appears to use their <FormattedMessage> tag, whereby you have an id like id=header.title. I fully understand why they do it this way but here's the thing . . .

We have all of our text strings rendered by a single custom <Label> component. It would be a whole lot of extra work to have to tag every single such text string.

So I'm wondering if anyone has found a hack whereby just the text string itself is passed to <FormattedMessage> and nothing else?

0

There are 0 answers