Lecture React.js

Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.

React Intl is part of FormatJS. It provides bindings to React via its components and API.

Slack: Join us on Slack at react-intl.slack.com for help, general conversation and more 💬🎊🎉 You can sign-up using this invitation link.

Documentation

React Intl’s docs are in this GitHub repo’s WikiGet Started. There are also several runnable example apps which you can reference to learn how all the pieces fit together.

(If you’re looking for React Intl v1, you can find it here.)

Features

  • Display numbers with separators.
  • Display dates and times correctly.
  • Display dates relative to “now”.
  • Pluralize labels in strings.
  • Support for 150+ languages.
  • Runs in the browser and Node.js.
  • Built on standards.

Conclusion

This example would render: “Hello Eric, you have 1,000 messages.” into the container element on the page.

Pluralization rules: In some languages you have more than one and other. For example in ru there are the following plural rules: onefewmany and other. Check out the official Unicode CLDR documentation.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *