Create README.md

This commit is contained in:
Mathieu Acthernoene 2017-06-15 07:34:14 +02:00 committed by GitHub
parent 65f0fcfc4f
commit 50e7a4931e
1 changed files with 3 additions and 5 deletions

View File

@ -177,20 +177,18 @@ I18n.translations = {
For a device with a `en_GB` locale this will return `Hi from the UK!'`, for a device with a `en_US` locale it will return `Hi!`. For a device with a `en_GB` locale this will return `Hi from the UK!'`, for a device with a `en_US` locale it will return `Hi!`.
### Device's locale ### Device's locales
You can get the user preferred locales with the `RNI18n` native module: You can get the user preferred locales with the `getLanguages` method:
```js ```js
import { getLanguages } from 'react-native-i18n' import { getLanguages } from 'react-native-i18n'
getLanguages().then(languages => { getLanguages().then(languages => {
console.log(languages) console.log(languages) // ['en-US', 'en']
}) })
``` ```
Returns `['en-US', 'en']`.
### I18n.js documentation ### I18n.js documentation