react-native-system-language
v1.0.1
Published
React Native library to provide access to system language and currency information
Downloads
3
Readme
react-native-system-language
Getting started
$ npm install react-native-system-language --save
Mostly automatic installation
$ react-native link react-native-system-language
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-system-language
and addRNSystemLanguage.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNSystemLanguage.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNSystemLanguagePackage;
to the imports at the top of the file - Add
new RNSystemLanguagePackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-system-language' project(':react-native-system-language').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-system-language/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-system-language')
Usage
import RNSystemLanguage from 'react-native-system-language';
// Android
RNSystemLanguage.language; // See https://developer.android.com/reference/java/util/Locale.html#getLanguage()
RNSystemLanguage.country; // See https://developer.android.com/reference/java/util/Locale.html#getCountry()
RNSystemLanguage.currencyCode; // See https://developer.android.com/reference/java/util/Currency.html#getCurrencyCode()
RNSystemLanguage.currencySymbol; // See https://developer.android.com/reference/java/util/Currency.html#getSymbol()
// Android Only
RNSystemLanguage.languageISO3; // See https://developer.android.com/reference/java/util/Locale.html#getISO3Language()
RNSystemLanguage.countryISO3; // See https://developer.android.com/reference/java/util/Locale.html#getISO3Country()
// iOS
RNSystemLanguage.language;
RNSystemLanguage.country;
RNSystemLanguage.currencyCode;
RNSystemLanguage.currencySymbol;
// iOS Only
RNSystemLanguage.localeIdentifier;
RNSystemLanguage.usesMetricSystem;
RNSystemLanguage.measurementSystem;
RNSystemLanguage.decimalSeparator;
RNSystemLanguage.groupingSeparator;
RNSystemLanguage.collatorIdentifier;
RNSystemLanguage.quotationBeginDelimiterKey;
RNSystemLanguage.quotationEndDelimiterKey;
RNSystemLanguage.alternateQuotationBeginDelimiterKey;
RNSystemLanguage.alternateQuotationEndDelimiterKey;
RNSystemLanguage.preferredLanguages;