New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-native-languages

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-languages

React Native properties and methods related to the language of the device

Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
3.3K
6.87%
Maintainers
1
Weekly downloads
 
Created
Source

🌍 react-native-languages

Get the user preferred languages and use the library of your choice to translate your app !

npm version npm Platform - Android and iOS MIT styled with prettier

Requirements

On Android

  • Android SDK Build-tools 25.0.3

Installation

$ yarn add react-native-languages
# -- OR --
npm i react-native-languages --save
# - THEN -
$ react-native link react-native-languages

Setup using Cocoapods (iOS only)

Instead of using react-native link, you can use Cocoapods to manage your dependencies.

# Add this line in your Podfile
pod 'RNLanguages', :path => '../node_modules/react-native-languages'
$ pod install

Manual setup

On iOS

  • In the XCode's "Project navigator", right click on your project's Libraries folder ➜ Add Files to <...>
  • Go to node_modulesreact-native-languagesios ➜ select RNLanguages.xcodeproj
  • Add RNLanguages.a to Build Phases -> Link Binary With Libraries

On Android

  • Add the following lines to android/settings.gradle:
include ':react-native-languages'
project(':react-native-languages').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-languages/android')
  • Add the compile line to the dependencies in android/app/build.gradle:
dependencies {
  // ...
  compile project(':react-native-languages')
}
  • Add the import and link the package in MainApplication.java:
import com.reactcommunity.rnlanguages.RNLanguagesPackage; // <-- Add the RNLanguages import

public class MainApplication extends Application implements ReactApplication {

  // ...

  @Override
  protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
      new MainReactPackage(),
      // ...
      new RNLanguagesPackage() // <-- Add it to the packages list
    );
  }

  // ...
}

Usage

import RNLanguages from 'react-native-languages';

// Current device language
console.log('language', RNLanguages.language);

// User preferred languages (in order)
console.log('languages', RNLanguages.languages);

// Listening for languages changes (on Android)
RNLanguages.addEventListener('change', ({ language, languages }) => {
  // Do languages related things…
});

Add project's supported localizations (iOS)

FAQs

Package last updated on 21 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts