Last active
August 7, 2018 19:20
-
-
Save darde/154e6f675e608c4c3b36df73073eba78 to your computer and use it in GitHub Desktop.
react-i18next-example/src/i18n/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import i18n from 'i18next'; | |
import LanguageDetector from 'i18next-browser-languagedetector'; | |
import { pt, en } from './locales'; | |
const options = { | |
interpolation: { | |
escapeValue: false, // not needed for react!! | |
}, | |
debug: true, | |
// lng: 'en', | |
resources: { | |
pt: { | |
common: pt['pt-BR'], | |
}, | |
en: { | |
common: en.en, | |
}, | |
}, | |
fallbackLng: 'en', | |
ns: ['common'], | |
defaultNS: 'common', | |
react: { | |
wait: false, | |
bindI18n: 'languageChanged loaded', | |
bindStore: 'added removed', | |
nsMode: 'default' | |
}, | |
}; | |
i18n | |
.use(LanguageDetector) | |
.init(options) | |
.changeLanguage('en', (err, t) => { | |
if (err) return console.log('something went wrong loading', err); | |
}); | |
export default i18n; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment