Internationalization with React.js using Yahoo's react-intl

Viewed 5630

I'm trying to support different languages in a React.js app and found react-intl to be a good candidate. They've been transitioning into V2 but I'm having a hard time figuring out how it all works together. The example app is too complex and involves a client/server architecture. I just want a single page without a server.

It looks like the steps are something like this:

  • Define messages using react-intl's defineMessage
  • Add locales using addLocaleData
  • Build flattened message data into files for each locale using a build script

I've done these steps but I'm at a loss as to how to display the messages. I have my React component wrapped in <IntlProvider>. The react-intl V2 github issue is really long and I've been wading through it trying to find an answer. Can anyone provide a simple working example?

2 Answers
Related