simple-react-i18n
v1.0.2
Published
Simple i18n library for node
Downloads
8
Readme
Simple i18n 1.0
Very short and simple library to use i18n. You can use this library without React !!!
Import properties
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 !"}
Init the library
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()
Use JSON properties
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 }
Installation
You can fetch the package using npm
npm install simple-react-i18n
Changelog
1.0
- Add polyfill for Proxy object
- Change import method, use CommonJS2
- Add Unit Test
- Fix minor bug
- Update Readme