In this lesson, we’ll replace hard coded strings with text from the user’s locale data, using the react-intl
FormattedMessage
component.
We'll also discuss the structure of the messages
file, as well as use this utility from the react-intl
documentation in order to keep our messages
structured nicely.
If your default langauge in the running browser is not 'en-US', 'es-ES', 'fr-FR' then an runtime error will happen. You need to add entry for the language e.g. for English, you need an entry 'en'.
Couldn't you flatten the messages at build time? Seems like unnecessary computation for every client to be calling that function.
How did you ever get three different browser windows to show in chrome in different languages ?