https://github.com/zeljkox/react-native-localization-example
Example of using react-native-localization
https://github.com/zeljkox/react-native-localization-example
localization react-native
Last synced: about 2 months ago
JSON representation
Example of using react-native-localization
- Host: GitHub
- URL: https://github.com/zeljkox/react-native-localization-example
- Owner: zeljkoX
- Created: 2017-02-07T20:11:51.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-08T08:18:38.000Z (about 8 years ago)
- Last Synced: 2025-02-28T22:53:31.295Z (2 months ago)
- Topics: localization, react-native
- Language: JavaScript
- Homepage:
- Size: 98.6 KB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Native Localization demo
This demo use react-native-localization package to support localization and adds support dynamic language change by updating all views.
By default without using provided code in this project by changing language using react-native-localization language wouldn't change in whole app.
This example uses context to pass language strings. Aproach is similiar to react-redux.
### Example
Wrap your app with LanguageProvider
```javascript
```If your component contain text then you should wrap it with connect function to pass language props
```javascriptimport { connect } from '@language';
export class Intro extends Component {
render() {
let { strings, language } = this.props;
return (
{strings.welcome}
{strings.change}
);
}
}export default connect(Intro);
```
### Props
- strings: react-native-localization strings
- language: used for setting language and reading current one