Localization for React components
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
flow-typed
src
test test: add test case for globalValue inside child provider Nov 20, 2017
.babelrc Initial commit Jul 18, 2016
.editorconfig
.eslintrc.json fix: correctly pick translation Nov 15, 2017
.flowconfig chore+fix: update dependencies Nov 15, 2017
.gitignore chore: ignore yarn.lock Jan 20, 2017
LICENSE chore: update copyright Jan 20, 2017
README.md fix: main path Jul 19, 2016
circle.yml
package-lock.json
package.json

README.md

React localization

Localization for React components

Installation

npm install --save react
npm install --save @dlghq/react-l10n

Usage

import React from 'react';
import { render } from 'react-dom';
import { Provider, Text } from '@dlghq/react-l10n';

const messages = {
  'en-US': { hello: 'Hello' },
  'ru-RU': { hello: 'Привет' }
};

function Application() {
  return (
    <Provider messages={messages} locale={navigator.language}>
      <Text id="hello" className="text" tagName="p" />
    </Provider>
  );
}

const container = document.getElementById('container');

render(<Application />, container);

More examples in tests

License

Apache-2.0