Skip to content

Commit

Permalink
Updated install instructions and improved error reporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefalda committed Dec 31, 2016
1 parent 7448392 commit 06c844e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 5 additions & 1 deletion LocalizedStrings.js
Expand Up @@ -12,8 +12,12 @@
* https://github.com/stefalda/ReactNativeLocalization
*/
'use strict';
import { NativeModules } from 'react-native';
var localization = NativeModules.ReactLocalization;
if (!localization){
console.error("Something went wrong initializing the native ReactLocalization module.\nPlease check your configuration.\nDid you run 'react-native link'?");
}

var localization = require('react-native').NativeModules.ReactLocalization;
var interfaceLanguage = localization.language.replace(/_/g,'-');
class LocalizedStrings{

Expand Down
12 changes: 9 additions & 3 deletions README.md
Expand Up @@ -19,11 +19,17 @@ The Javascript library uses a native library (ReactLocalization) to get the curr
It's possible to force a language different from the interface one.

## Installation
The easiest way to install: use [rnpm](https://github.com/rnpm/rnpm), the react native package manager. (If you don´t have it: install it via `npm install rnpm -g`)
The easiest way to install is to type just 2 commands inside your react-native project folder and you are ready to go:

Just run `rnpm install react-native-localization` inside your react-native project folder and you are ready to go. Don´t forget to restart the app / node server or you will see an error.
```
npm install react-native-localization --save
react-native link
```

Don´t forget to restart the app / node server or you will see an error.

If you're installing for Android you should still manually execute step 4 of "Manual installation Android".
If you're installing for Android and still experiencing problems check if
step 4 of "Manual installation Android" has been automatically executed by the linker.

### Manual installation iOS

Expand Down

0 comments on commit 06c844e

Please sign in to comment.