2.0.5 • Published 4 years ago

react-node-polyglot v2.0.5

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

React Node Pyloglot Build Status

React component to use node-polyglot

Install

npm install react-node-polyglot

You also need to install peer dependencies by yourself

npm install node-polyglot // v2.x.x
npm install react // v16.x.x
npm install prop-types // v15.x.x

This module targets Node.js 8 or later and the latest version of Chrome, Firefox, and Safari. If you want support for older browsers use Babel compiler.

Usage

const { Provider, withPolyglot, useT, useLocale } = require('react-node-polyglot');


const PolyglotHOC = withPolyglot(({ t, locale }) => {
  // locale object that is passed to provider
  return t('phrase');
});

const PolyglotHook = () => {
  // locale object that is passed to provider
  const locale = useLocale();

  const t = useT();
  return t('phrase');
};

const App = () => (
  <Provider locale={{ dictionary }}>
    <PolyglotHOC />
    <PolyglotHook />
  </Provider>
);

License

MIT © Abylay Keldibek

2.0.5

4 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago