/react-intl-simplelocalize

Fetch i18n translations directly to React components

Primary LanguageJavaScript

simplelocalize yahoo/react-intl integration

react-intl-simplelocalize

NPM JavaScript Style Guide

Install

npm install --save react-intl-simplelocalize react-intl

or

yarn add react-intl-simplelocalize react-intl

Configuration

  • Setup account here: https://simplelocalize.io
  • Create new FormatJS project.
  • Copy project hash from settings tabs.
  • Wrap your applications same as you do with redux <Provider/>.
import SimpleLocalize from 'react-intl-simplelocalize'

const app = document.getElementById("root");

render(
  <SimpleLocalize projectToken="<PROJECT_TOKEN>">
      <App/>
  </SimpleLocalize>, app);

Usage

Start using <FormattedMessage />components from yahoo/react-intl.

import React from "react";
import {FormattedMessage} from "react-intl";

class Home extends React.Component {

  render() {
    return (<FormattedMessage id="hello" />);
  }

}

export default Footer;

That's all, all translations will be now loaded and injected automatically.

Adding new i18n keys

Discovering new keys automatically

Consider use of simplelocalize-cli for the best experience. This application will find and push all new i18n keys in seconds!

Adding new keys manually

You can always manually add new keys using SimpleLocalize cloud.

License

MIT ©