Very short and simple library to use i18n. You can use this library without React !!!
You can load external JSON object with webpack for example.
import fr from '../properties/properties_FR.json'
Or use a simple javascript object
const fr = { hello : "Bonjour !"}
On your index.js page, import i18n library.
First parameter is a Javascript object with every property.
import i18n from 'simple-react-i18n'
i18n.addLang(fr, ['fr', 'FR'])
i18n.addLang(en, 'default')
i18n.init()
i18n work as a closure function. Init langage on the main component, and use it
On your component:
import i18n from 'simple-react-i18n'
...
{ i18n.props }
You can fetch the package using npm
npm install simple-react-i18n
1.0
- Add polyfill for Proxy object
- Change import method, use CommonJS2
- Add Unit Test
- Fix minor bug
- Update Readme