react-intl
Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.
Last updated 5 years ago by longlho .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ npm install react-intl 
SYNC missed versions from official npm registry.

React Intl

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

npm Version npm Version Build Status

Package Minified Size Minzipped Size
react-intl minified size minzipped size

Overview

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

Slack: Join us on Slack at formatjs.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 /docs folder, Get 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.

Example

There are several runnable examples in this Git repo, but here's a Hello World one:

import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import {IntlProvider, FormattedMessage} from 'react-intl';

class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      name: 'Eric',
      unreadCount: 1000,
    };
  }

  render() {
    const {name, unreadCount} = this.state;

    return (
      <p>
        <FormattedMessage
          id="welcome"
          defaultMessage={`Hello {name}, you have {unreadCount, number} {unreadCount, plural,
                      one {message}
                      other {messages}
                    }`}
          values={{name: <b>{name}</b>, unreadCount}}
        />
      </p>
    );
  }
}

ReactDOM.render(
  <IntlProvider locale="en">
    <App />
  </IntlProvider>,
  document.getElementById('container')
);

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: one, few, many and other. Check out the official Unicode CLDR documentation.

Contribute

Let's make React Intl and FormatJS better! If you're interested in helping, all contributions are welcome and appreciated. React Intl is just one of many packages that make up the FormatJS suite of packages, and you can contribute to any/all of them, including the Format JS website itself.

Check out the Contributing document for the details. Thanks!

License

This software is free to use under the Yahoo Inc. BSD license. See the LICENSE file for license text and copyright information.

Current Tags

  • 6.6.8                                ...           latest (7 months ago)
  • 5.0.4-alpha.0                                ...           next (4 years ago)

330 Versions

  • 6.6.8                                ...           7 months ago
  • 6.6.7                                ...           7 months ago
  • 6.6.6                                ...           8 months ago
  • 6.6.5                                ...           9 months ago
  • 6.6.4                                ...           9 months ago
  • 6.6.3                                ...           9 months ago
  • 6.6.2                                ...           a year ago
  • 6.6.1                                ...           a year ago
  • 6.6.0                                ...           a year ago
  • 6.5.5                                ...           a year ago
  • 6.5.4                                ...           a year ago
  • 6.5.3                                ...           a year ago
  • 6.5.2                                ...           a year ago
  • 6.5.1                                ...           a year ago
  • 6.5.0                                ...           a year ago
  • 6.4.7                                ...           a year ago
  • 6.4.6                                ...           a year ago
  • 6.4.5                                ...           a year ago
  • 6.4.4                                ...           2 years ago
  • 6.4.3                                ...           2 years ago
  • 6.4.2                                ...           2 years ago
  • 6.4.1                                ...           2 years ago
  • 6.4.0                                ...           2 years ago
  • 6.3.2                                ...           2 years ago
  • 6.3.1                                ...           2 years ago
  • 6.3.0                                ...           2 years ago
  • 6.2.10                                ...           2 years ago
  • 6.2.9                                ...           2 years ago
  • 6.2.8                                ...           2 years ago
  • 6.2.7                                ...           2 years ago
  • 6.2.6                                ...           2 years ago
  • 6.2.5                                ...           2 years ago
  • 6.2.4                                ...           2 years ago
  • 6.2.2                                ...           2 years ago
  • 6.2.1                                ...           2 years ago
  • 6.2.0                                ...           2 years ago
  • 6.1.2                                ...           2 years ago
  • 6.1.1                                ...           2 years ago
  • 6.1.0                                ...           2 years ago
  • 6.0.8                                ...           2 years ago
  • 6.0.6                                ...           2 years ago
  • 6.0.5                                ...           2 years ago
  • 6.0.4                                ...           3 years ago
  • 6.0.3                                ...           3 years ago
  • 6.0.2                                ...           3 years ago
  • 6.0.1                                ...           3 years ago
  • 5.25.1                                ...           3 years ago
  • 5.25.0                                ...           3 years ago
  • 5.24.8                                ...           3 years ago
  • 5.24.7                                ...           3 years ago
  • 5.24.6                                ...           3 years ago
  • 5.24.5                                ...           3 years ago
  • 5.24.4                                ...           3 years ago
  • 5.24.3                                ...           3 years ago
  • 5.24.2                                ...           3 years ago
  • 5.24.1                                ...           3 years ago
  • 5.24.0                                ...           3 years ago
  • 5.23.0                                ...           3 years ago
  • 5.22.0                                ...           3 years ago
  • 5.21.2                                ...           3 years ago
  • 5.21.1                                ...           3 years ago
  • 5.21.0                                ...           3 years ago
  • 5.20.13                                ...           3 years ago
  • 5.20.12                                ...           3 years ago
  • 5.20.11                                ...           3 years ago
  • 5.20.10                                ...           3 years ago
  • 5.20.9                                ...           3 years ago
  • 5.20.8                                ...           3 years ago
  • 5.20.7                                ...           3 years ago
  • 5.20.6                                ...           3 years ago
  • 5.20.5                                ...           3 years ago
  • 5.20.4                                ...           3 years ago
  • 5.20.3                                ...           4 years ago
  • 5.20.2                                ...           4 years ago
  • 5.20.1                                ...           4 years ago
  • 5.20.0                                ...           4 years ago
  • 5.19.0                                ...           4 years ago
  • 5.18.3                                ...           4 years ago
  • 5.18.2                                ...           4 years ago
  • 5.18.1                                ...           4 years ago
  • 5.18.0                                ...           4 years ago
  • 5.17.7                                ...           4 years ago
  • 5.17.6                                ...           4 years ago
  • 5.17.5                                ...           4 years ago
  • 5.17.4                                ...           4 years ago
  • 5.17.3                                ...           4 years ago
  • 5.17.2                                ...           4 years ago
  • 5.17.1                                ...           4 years ago
  • 5.17.0                                ...           4 years ago
  • 5.16.2                                ...           4 years ago
  • 5.16.1                                ...           4 years ago
  • 5.16.0                                ...           4 years ago
  • 5.15.8                                ...           4 years ago
  • 5.15.7                                ...           4 years ago
  • 5.15.6                                ...           4 years ago
  • 5.15.5                                ...           4 years ago
  • 5.15.4                                ...           4 years ago
  • 5.15.3                                ...           4 years ago
  • 5.15.2                                ...           4 years ago
  • 5.15.1                                ...           4 years ago
  • 5.15.0                                ...           4 years ago
  • 5.14.1                                ...           4 years ago
  • 5.14.0                                ...           4 years ago
  • 5.13.5                                ...           4 years ago
  • 5.13.4                                ...           4 years ago
  • 5.13.3                                ...           4 years ago
  • 5.13.2                                ...           4 years ago
  • 5.13.1                                ...           4 years ago
  • 5.13.0                                ...           4 years ago
  • 5.12.5                                ...           4 years ago
  • 5.12.4                                ...           4 years ago
  • 5.12.3                                ...           4 years ago
  • 5.12.2                                ...           4 years ago
  • 5.12.1                                ...           4 years ago
  • 5.12.0                                ...           4 years ago
  • 5.11.0                                ...           4 years ago
  • 5.10.19                                ...           4 years ago
  • 5.10.18                                ...           4 years ago
  • 5.10.17                                ...           4 years ago
  • 5.10.16                                ...           4 years ago
  • 5.10.15                                ...           4 years ago
  • 5.10.14                                ...           4 years ago
  • 5.10.13                                ...           4 years ago
  • 5.10.12                                ...           4 years ago
  • 5.10.11                                ...           4 years ago
  • 5.10.10                                ...           4 years ago
  • 5.10.9                                ...           4 years ago
  • 5.10.8                                ...           4 years ago
  • 5.10.7                                ...           4 years ago
  • 5.10.6                                ...           4 years ago
  • 5.10.5                                ...           4 years ago
  • 5.10.4                                ...           4 years ago
  • 5.10.3                                ...           4 years ago
  • 5.10.2                                ...           4 years ago
  • 5.10.1                                ...           4 years ago
  • 5.10.0                                ...           4 years ago
  • 5.9.4                                ...           4 years ago
  • 5.9.3                                ...           4 years ago
  • 5.9.2                                ...           4 years ago
  • 5.9.1                                ...           4 years ago
  • 5.9.0                                ...           4 years ago
  • 5.8.9                                ...           4 years ago
  • 5.8.8                                ...           4 years ago
  • 5.8.6                                ...           4 years ago
  • 5.8.5                                ...           4 years ago
  • 5.8.4                                ...           4 years ago
  • 5.8.3                                ...           4 years ago
  • 5.8.2                                ...           4 years ago
  • 5.8.1                                ...           4 years ago
  • 5.8.0                                ...           4 years ago
  • 5.7.2                                ...           4 years ago
  • 5.7.1                                ...           4 years ago
  • 5.7.0                                ...           4 years ago
  • 5.6.10                                ...           4 years ago
  • 5.6.9                                ...           4 years ago
  • 5.6.8                                ...           4 years ago
  • 5.6.7                                ...           4 years ago
  • 5.6.6                                ...           4 years ago
  • 5.6.5                                ...           4 years ago
  • 5.6.4                                ...           4 years ago
  • 5.6.3                                ...           4 years ago
  • 5.6.2                                ...           4 years ago
  • 5.6.1                                ...           4 years ago
  • 5.6.0                                ...           4 years ago
  • 5.5.0                                ...           4 years ago
  • 5.4.8                                ...           4 years ago
  • 5.4.7                                ...           4 years ago
  • 5.4.6                                ...           4 years ago
  • 5.4.5                                ...           4 years ago
  • 5.4.4                                ...           4 years ago
  • 5.4.3                                ...           4 years ago
  • 5.4.2                                ...           4 years ago
  • 5.4.1                                ...           4 years ago
  • 5.4.0                                ...           4 years ago
  • 5.3.2                                ...           4 years ago
  • 5.3.1                                ...           4 years ago
  • 5.3.0                                ...           4 years ago
  • 5.2.2                                ...           4 years ago
  • 5.2.1                                ...           4 years ago
  • 5.2.0                                ...           4 years ago
  • 5.1.0                                ...           4 years ago
  • 5.0.4-alpha.0                                ...           4 years ago
  • 5.0.2                                ...           4 years ago
  • 5.0.1                                ...           4 years ago
  • 5.0.0 [deprecated]           ...           4 years ago
  • 4.7.6                                ...           4 years ago
  • 4.7.5                                ...           4 years ago
  • 4.7.4                                ...           4 years ago
  • 4.7.3                                ...           4 years ago
  • 4.7.2                                ...           5 years ago
  • 4.7.1                                ...           5 years ago
  • 4.7.0 [deprecated]           ...           5 years ago
  • 4.6.10                                ...           5 years ago
  • 4.6.9                                ...           5 years ago
  • 4.6.7                                ...           5 years ago
  • 4.6.6                                ...           5 years ago
  • 4.6.5                                ...           5 years ago
  • 4.6.4                                ...           5 years ago
  • 4.6.3                                ...           5 years ago
  • 4.6.2                                ...           5 years ago
  • 4.6.1                                ...           5 years ago
  • 4.6.0                                ...           5 years ago
  • 4.5.12                                ...           5 years ago
  • 4.5.11                                ...           5 years ago
  • 4.5.10                                ...           5 years ago
  • 4.5.9                                ...           5 years ago
  • 4.5.8                                ...           5 years ago
  • 4.5.7                                ...           5 years ago
  • 4.5.6                                ...           5 years ago
  • 4.5.5                                ...           5 years ago
  • 4.5.4                                ...           5 years ago
  • 4.5.3                                ...           5 years ago
  • 4.5.2                                ...           5 years ago
  • 4.5.1                                ...           5 years ago
  • 4.5.0                                ...           5 years ago
  • 4.4.0                                ...           5 years ago
  • 4.3.1                                ...           5 years ago
  • 4.3.0                                ...           5 years ago
  • 4.2.2                                ...           5 years ago
  • 4.2.1                                ...           5 years ago
  • 4.2.0                                ...           5 years ago
  • 4.1.1                                ...           5 years ago
  • 4.1.0                                ...           5 years ago
  • 4.0.0                                ...           5 years ago
  • 3.12.1                                ...           5 years ago
  • 3.12.0                                ...           5 years ago
  • 3.11.0                                ...           5 years ago
  • 3.9.3                                ...           5 years ago
  • 3.10.0                                ...           5 years ago
  • 3.9.2                                ...           5 years ago
  • 3.9.1                                ...           5 years ago
  • 3.9.0                                ...           5 years ago
  • 3.8.0                                ...           5 years ago
  • 3.7.0                                ...           5 years ago
  • 3.6.2                                ...           5 years ago
  • 3.6.1                                ...           5 years ago
  • 3.6.0                                ...           5 years ago
  • 3.5.0                                ...           5 years ago
  • 3.4.0                                ...           5 years ago
  • 3.3.2                                ...           5 years ago
  • 3.3.1                                ...           5 years ago
  • 3.3.0                                ...           5 years ago
  • 3.2.4                                ...           5 years ago
  • 3.2.3                                ...           5 years ago
  • 3.2.2 [deprecated]           ...           5 years ago
  • 3.2.1                                ...           5 years ago
  • 3.2.0                                ...           5 years ago
  • 3.2.0-rc.2                                ...           5 years ago
  • 3.2.0-rc.1                                ...           5 years ago
  • 3.2.0-rc.0                                ...           5 years ago
  • 3.1.13                                ...           5 years ago
  • 3.1.12                                ...           5 years ago
  • 3.1.11                                ...           5 years ago
  • 3.1.10                                ...           5 years ago
  • 3.1.9                                ...           5 years ago
  • 3.1.8                                ...           5 years ago
  • 3.1.7                                ...           5 years ago
  • 3.1.6                                ...           5 years ago
  • 3.1.5                                ...           5 years ago
  • 3.1.4                                ...           5 years ago
  • 3.1.3                                ...           5 years ago
  • 3.1.2                                ...           5 years ago
  • 3.1.1                                ...           5 years ago
  • 3.1.0                                ...           5 years ago
  • 3.0.0                                ...           5 years ago
  • 3.0.0-beta.23                                ...           5 years ago
  • 3.0.0-beta.22                                ...           5 years ago
  • 3.0.0-beta.21                                ...           5 years ago
  • 3.0.0-beta.20                                ...           5 years ago
  • 3.0.0-beta.19                                ...           5 years ago
  • 3.0.0-beta.18                                ...           5 years ago
  • 3.0.0-beta.17                                ...           5 years ago
  • 3.0.0-beta.16                                ...           5 years ago
  • 3.0.0-beta.15                                ...           5 years ago
  • 3.0.0-beta.14                                ...           5 years ago
  • 3.0.0-beta.13                                ...           5 years ago
  • 3.0.0-beta.12                                ...           5 years ago
  • 3.0.0-beta-11                                ...           5 years ago
  • 3.0.0-beta-10                                ...           5 years ago
  • 3.0.0-beta-9                                ...           5 years ago
  • 3.0.0-beta-8                                ...           6 years ago
  • 3.0.0-beta-7                                ...           6 years ago
  • 3.0.0-beta-6                                ...           6 years ago
  • 3.0.0-beta-5                                ...           6 years ago
  • 3.0.0-beta-4                                ...           6 years ago
  • 3.0.0-beta-3                                ...           6 years ago
  • 3.0.0-beta-2                                ...           6 years ago
  • 2.9.0                                ...           6 years ago
  • 3.0.0-beta-1                                ...           6 years ago
  • 2.8.0                                ...           6 years ago
  • 2.7.2                                ...           6 years ago
  • 2.7.1                                ...           6 years ago
  • 2.7.0                                ...           6 years ago
  • 2.6.0                                ...           6 years ago
  • 2.5.0                                ...           6 years ago
  • 2.4.0                                ...           7 years ago
  • 2.3.0                                ...           8 years ago
  • 2.2.3                                ...           8 years ago
  • 2.2.2                                ...           8 years ago
  • 2.2.1                                ...           8 years ago
  • 2.2.0                                ...           8 years ago
  • 2.1.5                                ...           8 years ago
  • 2.1.4                                ...           8 years ago
  • 2.1.3                                ...           9 years ago
  • 2.1.2                                ...           9 years ago
  • 2.1.1                                ...           9 years ago
  • 2.1.0                                ...           9 years ago
  • 2.0.1                                ...           9 years ago
  • 2.0.0                                ...           9 years ago
  • 2.0.0-rc-1                                ...           9 years ago
  • 2.0.0-beta-2                                ...           9 years ago
  • 1.2.2                                ...           9 years ago
  • 2.0.0-beta-1                                ...           9 years ago
  • 1.2.1                                ...           9 years ago
  • 2.0.0-pr-3                                ...           9 years ago
  • 2.0.0-pr-2                                ...           9 years ago
  • 2.0.0-pr-1                                ...           9 years ago
  • 1.2.0                                ...           10 years ago
  • 1.1.0                                ...           10 years ago
  • 1.1.0-rc-3                                ...           10 years ago
  • 1.1.0-rc-2                                ...           10 years ago
  • 1.1.0-rc-1                                ...           10 years ago
  • 1.0.2                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.1-rc-1                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
  • 1.0.0-rc-3                                ...           10 years ago
  • 1.0.0-rc-2                                ...           10 years ago
  • 1.0.0-rc-1                                ...           10 years ago
  • 0.1.0-rc-1                                ...           11 years ago
Downloads
Total 184
Today 1
This Week 1
This Month 184
Last Day 0
Last Week 0
Last Month 0

© 2010 - cnpmjs.org x YWFE | Home | YWFE