/ archiveofbelonging.org / back / node_modules / react-intl /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]dist/2 years ago -  
[DIR]lib/2 years ago -  
[DIR]src/2 years ago -  
[TXT]CHANGELOG.md39 years ago 25K 
[TXT]LICENSE.md39 years ago1.4K7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك]
[TXT]README.md39 years ago4.3Kf12eb36 documentaiton updates [كارل مبارك]
[   ]package.json2 years ago 13K7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك]
README.md

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

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

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.

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80