localising your app is very important especially you’re targeting multiple audiance. I choose i18next is because it’s simple to use and understand. Let’s get started
- install i18next with
yarn add i18next
-- or --
npm install i18next --save
2. create the resource file
save this file in a folder lang/resource.json
(for example)
3. create a i18next module
save this file next to your main reducer, make sure resource is pointing to the right location!
4. put it in redux state
use it like this anywhere in your code
this.props.state.i18n.t('good-morning')
which will output
good-morning // or 早安