tsjing / react-native-locale-detector

Detects the locale of a user's phone.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-native-locale-detector (for RN v0.40+)

Detects the locale of a user's phone. Based on react-native-i18n, but this just exports the device's locale. This isn't particularly useful on it's own and you'll probably want to use it with an i18n library like i18next.

Installation

npm install @tsjing/react-native-locale-detector --save
react-native link

Usage

// Import the locale.
import locale from 'react-native-locale-detector'

// We could log it. Maybe it's en-US...
console.log(locale)

// Or if you're using a localization library.
yourLocalizationLibrary.setLocale(locale)

About

Detects the locale of a user's phone.

License:MIT License


Languages

Language:Java 65.1%Language:Objective-C 28.8%Language:JavaScript 6.0%