Bootstrap i18next with React in 4 steps

Jim Kang
1 min readAug 10, 2017

--

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

  1. 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 早安

--

--

Jim Kang
Jim Kang

Written by Jim Kang

love writing bit sized programming memo, acoustic guitarist, proud daddy of 5 and great listener (to my kids)

No responses yet