ndla-i18n
NDLA's own i18n package based on react-intl
Installation
# Using npm: $ npm install ndla-i18n --save # Using yarn: $ yarn add ndla-i18n
Usage
// In app/server entry index file:import IntlProvider from 'ndla-i18n';...ReactDOM;
// After initial instantiation, using it with a React component...import injectT from 'ndla-i18n'; ... { const t = thisprops; return <button></button>; }... i18nReactComponent;
// Using it with a render props component...import Trans from 'ndla-i18n'; ... { return <Trans> t <button></button> </Trans> }... ;