Last active
March 15, 2017 21:47
-
-
Save jazmon/ee0271822f0d1e9ce32e5c4859acf5db to your computer and use it in GitHub Desktop.
React Native i18n
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 i18nextReactNative from 'i18next-react-native-language-detector'; | |
// Path to your translation bundle | |
import translation from '../translation.json'; | |
i18n | |
.use(i18nextReactNative) // set to use the React Native locale detector | |
.init({ // look up these properties in the i18next documentation | |
fallbackLng: 'en', | |
debug: false, | |
ns: [ | |
'common', | |
], | |
defaultNS: 'common', | |
fallbackNS: 'common', | |
resources: translation, // Here you pass the translation bundle | |
interpolation: { | |
escapeValue: false, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment