Get the user preferred languages and use the library of your choice to translate your appย !
- Android SDK Build-tools 25.0.3
$ yarn add react-native-languages$ npm i -S react-native-languages$ react-native link react-native-languages# add this line in your Podfile
pod 'RNLanguages', :path => '../node_modules/react-native-languages'$ pod install- In the XCode's "Project navigator", right click on your project's Libraries folder โ
Add Files to <...> - Go to
node_modulesโreact-native-languagesโiosโ selectRNLanguages.xcodeproj - Add
RNLanguages.atoBuild Phases -> Link Binary With Libraries
- 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
);
}
// ...
}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โฆ
});Browse the files in the /example directory.

