Skip to content

React Native library to provide access to system language and currency information

Notifications You must be signed in to change notification settings

patrickgalbraith/react-native-system-language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-system-language and add RNSystemLanguage.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNSystemLanguage.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. 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 the getPackages() method
  1. 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')
    
  2. 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;

About

React Native library to provide access to system language and currency information

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published