Simplify documentation
This commit is contained in:
parent
3fb2eaa7fc
commit
1fc994f357
29
README.md
29
README.md
|
@ -12,27 +12,17 @@ Get the user preferred languages and use the library of your choice to translate
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
#### Using yarn
|
|
||||||
```bash
|
```bash
|
||||||
$ yarn add react-native-languages
|
$ yarn add react-native-languages
|
||||||
```
|
# -- OR --
|
||||||
|
npm i react-native-languages --save
|
||||||
#### Using npm
|
# - THEN -
|
||||||
```bash
|
|
||||||
$ npm i react-native-languages --save
|
|
||||||
```
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
### Automatic setup
|
|
||||||
|
|
||||||
#### Using react-native link (react-native >= 0.29)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ react-native link react-native-languages
|
$ react-native link react-native-languages
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Using Cocoapods (iOS only)
|
## Setup using Cocoapods (iOS only)
|
||||||
|
|
||||||
|
Instead of using `react-native link`, you can use Cocoapods to manage your dependencies.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
# Add this line in your Podfile
|
# Add this line in your Podfile
|
||||||
|
@ -101,13 +91,8 @@ console.log('language', ReactNativeLanguages.language);
|
||||||
|
|
||||||
// User preferred languages (in order)
|
// User preferred languages (in order)
|
||||||
console.log('languages', ReactNativeLanguages.languages);
|
console.log('languages', ReactNativeLanguages.languages);
|
||||||
```
|
|
||||||
|
|
||||||
### Listening for languages changes (Android)
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
import ReactNativeLanguages from 'react-native-languages';
|
|
||||||
|
|
||||||
|
// Listening for languages changes (on Android)
|
||||||
ReactNativeLanguages.addEventListener('change', ({ language, languages }) => {
|
ReactNativeLanguages.addEventListener('change', ({ language, languages }) => {
|
||||||
// Do languages related things…
|
// Do languages related things…
|
||||||
// ReactNativeLanguages.language and ReactNativeLanguages.languages will be correct too !
|
// ReactNativeLanguages.language and ReactNativeLanguages.languages will be correct too !
|
||||||
|
|
Loading…
Reference in New Issue