react-native-i18n-localize
A pure javascript language control for your React Native app localization.
Installation
Using npm
$ npm install --save react-native-i18n-localize
Using yarn
$ yarn add react-native-i18n-localize
Example
1. Create your translation file in project
en.json
th.json
2. Inject translation file to App.js
I18nLocalize { // I18nLocalize.setLanguage('th') } { return <View style=stylescontainer> <MainScreen /> </View> } ...
3. Wrapping your component for forcing update after change language
Example
4. Switching language with this method
{ return <View style=stylescontainer> <Text style=stylestext> i18n </Text> <Button onPress=thistrigger title=i18n /> </View> } { ifI18nLocalize === 'th' I18nLocalize else I18nLocalize }
Note
withLanguage
work with React Component
only
If you want to manual catch event use
{ I18nLocalize} { I18nLocalize}
Browse the files in the /example directory.