npm install --save react-intl-simplelocalize react-intlor
yarn add react-intl-simplelocalize react-intl- 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);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.
Consider use of simplelocalize-cli for the best experience. This application will find and push all new i18n keys in seconds!
You can always manually add new keys using SimpleLocalize cloud.
