Ship 3.0.0

This commit is contained in:
zoontek
2018-09-06 15:58:44 +02:00
parent 662476c315
commit 6f8404e53f
32 changed files with 228 additions and 1257 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
[ignore]
.*/node_modules
<PROJECT_ROOT>/example/
[include]
@@ -7,6 +7,7 @@
[options]
munge_underscores=true
suppress_type=$FlowFixMe
[version]
^0.70.0
^0.80.0
+10 -13
View File
@@ -4,28 +4,23 @@ Get the user preferred languages and use the library of your choice to translate
[![npm version](https://badge.fury.io/js/react-native-languages.svg)](https://badge.fury.io/js/react-native-languages) [![npm](https://img.shields.io/npm/dt/react-native-languages.svg)](https://www.npmjs.org/package/react-native-languages) ![Platform - Android and iOS](https://img.shields.io/badge/platform-Android%20%7C%20iOS-yellow.svg) ![MIT](https://img.shields.io/dub/l/vibe-d.svg) [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
## Requirements
## Support
#### On Android
* Android SDK Build-tools 25.0.3
![](https://github.com/react-community/react-native-languages/blob/master/docs/android-build-tools.png?raw=true)
| Version | React Native Support |
| ------- | -------------------- |
| 3.0.0 | 0.56.0+ |
| 2.0.1 | 0.48.0 - 0.55.0 |
## Installation
#### Using yarn
```bash
$ npm install --save react-native-languages
# --- or ---
$ yarn add react-native-languages
```
#### Using npm
```bash
$ npm i -S react-native-languages
```
## Linking
#### Using react-native-cli
@@ -34,6 +29,8 @@ $ npm i -S react-native-languages
$ react-native link react-native-languages
```
_NB: If you use a Cocoapods and have a `Podfile`, `react-native link` will only add this library as a dependency, and you'll need to run `pod install`._
#### Using CocoaPods (iOS)
```ruby
@@ -112,6 +109,6 @@ RNLanguages.addEventListener('change', ({ language, languages }) => {
![](https://github.com/react-community/react-native-languages/blob/master/docs/xcode-adding-locales.png?raw=true)
## Example with i18next
## Example with [i18n-js](https://github.com/fnando/i18n-js)
Browse the files in the [/example](https://github.com/react-community/react-native-languages/tree/master/example) directory.
+1 -1
View File
@@ -10,7 +10,7 @@ Pod::Spec.new do |spec|
spec.authors = { "Mathieu Acthernoene" => "zoontek@gmail.com" }
spec.homepage = "https://github.com/react-community/react-native-languages"
spec.license = "MIT"
spec.platform = :ios, "8.0"
spec.platform = :ios, "9.0"
spec.source = { :git => "https://github.com/react-community/react-native-languages.git" }
spec.source_files = "ios/**/*.{h,m}"
+11 -5
View File
@@ -1,12 +1,18 @@
apply plugin: 'com.android.library'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion safeExtGet('compileSdkVersion', 26)
buildToolsVersion safeExtGet('buildToolsVersion', '26.0.3')
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 26)
versionCode 1
versionName "1.0"
}
lintOptions {
@@ -15,5 +21,5 @@ android {
}
dependencies {
compile "com.facebook.react:react-native:+" // From node_modules
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" // From node_modules
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 KiB

+14 -1
View File
@@ -30,6 +30,19 @@ node_modules/react-native/flow-github/
emoji=true
module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
munge_underscores=true
@@ -51,4 +64,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
[version]
^0.67.0
^0.75.0
+8 -8
View File
@@ -94,13 +94,13 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.rnlanguagesexample"
minSdkVersion 16
targetSdkVersion 25
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
@@ -137,10 +137,10 @@ android {
}
dependencies {
compile project(':react-native-languages')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-languages')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}
// Run this once to be able to run the application with BUCK
-53
View File
@@ -15,56 +15,3 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
-dontobfuscate
# React Native
# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keep @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.proguard.annotations.DoNotStrip *;
@com.facebook.common.internal.DoNotStrip *;
}
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
void set*(***);
*** get*();
}
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
-dontwarn com.facebook.react.**
# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
-dontwarn android.text.StaticLayout
# okhttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
# okio
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+18 -1
View File
@@ -3,9 +3,14 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -20,5 +25,17 @@ allprojects {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
ext {
buildToolsVersion = "26.0.3"
minSdkVersion = 16
compileSdkVersion = 26
targetSdkVersion = 26
supportLibVersion = "26.1.0"
}
+2 -1
View File
@@ -1,5 +1,6 @@
#Thu Sep 06 15:48:10 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
+2 -1
View File
@@ -1,4 +1,5 @@
import { AppRegistry } from 'react-native';
import App from './src/App';
import { name as appName } from './app.json';
AppRegistry.registerComponent('RNLanguagesExample', () => App);
AppRegistry.registerComponent(appName, () => App);
@@ -21,7 +21,7 @@
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
66163245208B9BEB005CF551 /* libRNLanguages.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 66163242208B9BC9005CF551 /* libRNLanguages.a */; };
664C1EFB2141632B00B5F149 /* libRNLanguages.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 664C1EF82141631C00B5F149 /* libRNLanguages.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
/* End PBXBuildFile section */
@@ -265,16 +265,16 @@
remoteGlobalIDString = 2D2A28201D9B03D100D4039D;
remoteInfo = "RCTAnimation-tvOS";
};
66163241208B9BC9005CF551 /* PBXContainerItemProxy */ = {
664C1EF72141631C00B5F149 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = A907886D322643F2983BD0E0 /* RNLanguages.xcodeproj */;
containerPortal = B23C49D0F8674F84828016EE /* RNLanguages.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RNLanguages;
};
66163243208B9BC9005CF551 /* PBXContainerItemProxy */ = {
664C1EF92141631C00B5F149 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = A907886D322643F2983BD0E0 /* RNLanguages.xcodeproj */;
containerPortal = B23C49D0F8674F84828016EE /* RNLanguages.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 2D2A28471D9B043800D4039D;
remoteInfo = "RNLanguages-tvOS";
@@ -309,6 +309,8 @@
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; };
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = "<group>"; };
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = "<group>"; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* RNLanguagesExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNLanguagesExampleTests.m; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* RNLanguagesExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RNLanguagesExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -323,8 +325,8 @@
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
A907886D322643F2983BD0E0 /* RNLanguages.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNLanguages.xcodeproj; path = "../node_modules/react-native-languages/ios/RNLanguages.xcodeproj"; sourceTree = "<group>"; };
ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
B23C49D0F8674F84828016EE /* RNLanguages.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNLanguages.xcodeproj; path = "../node_modules/react-native-languages/ios/RNLanguages.xcodeproj"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -345,7 +347,7 @@
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
66163245208B9BEB005CF551 /* libRNLanguages.a in Frameworks */,
664C1EFB2141632B00B5F149 /* libRNLanguages.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -394,6 +396,23 @@
name = Products;
sourceTree = "<group>";
};
00E356EF1AD99517003FC87E /* RNLanguagesExampleTests */ = {
isa = PBXGroup;
children = (
00E356F21AD99517003FC87E /* RNLanguagesExampleTests.m */,
00E356F01AD99517003FC87E /* Supporting Files */,
);
path = RNLanguagesExampleTests;
sourceTree = "<group>";
};
00E356F01AD99517003FC87E /* Supporting Files */ = {
isa = PBXGroup;
children = (
00E356F11AD99517003FC87E /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
139105B71AF99BAD00B5F7CC /* Products */ = {
isa = PBXGroup;
children = (
@@ -468,11 +487,11 @@
name = Products;
sourceTree = "<group>";
};
6616323D208B9BC7005CF551 /* Products */ = {
664C1EF32141631C00B5F149 /* Products */ = {
isa = PBXGroup;
children = (
66163242208B9BC9005CF551 /* libRNLanguages.a */,
66163244208B9BC9005CF551 /* libRNLanguages-tvOS.a */,
664C1EF82141631C00B5F149 /* libRNLanguages.a */,
664C1EFA2141631C00B5F149 /* libRNLanguages-tvOS.a */,
);
name = Products;
sourceTree = "<group>";
@@ -501,7 +520,7 @@
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
A907886D322643F2983BD0E0 /* RNLanguages.xcodeproj */,
B23C49D0F8674F84828016EE /* RNLanguages.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
@@ -520,6 +539,7 @@
children = (
13B07FAE1A68108700A75B9A /* RNLanguagesExample */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
00E356EF1AD99517003FC87E /* RNLanguagesExampleTests */,
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
);
@@ -636,8 +656,8 @@
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
},
{
ProductGroup = 6616323D208B9BC7005CF551 /* Products */;
ProjectRef = A907886D322643F2983BD0E0 /* RNLanguages.xcodeproj */;
ProductGroup = 664C1EF32141631C00B5F149 /* Products */;
ProjectRef = B23C49D0F8674F84828016EE /* RNLanguages.xcodeproj */;
},
);
projectRoot = "";
@@ -886,18 +906,18 @@
remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
66163242208B9BC9005CF551 /* libRNLanguages.a */ = {
664C1EF82141631C00B5F149 /* libRNLanguages.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNLanguages.a;
remoteRef = 66163241208B9BC9005CF551 /* PBXContainerItemProxy */;
remoteRef = 664C1EF72141631C00B5F149 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
66163244208B9BC9005CF551 /* libRNLanguages-tvOS.a */ = {
664C1EFA2141631C00B5F149 /* libRNLanguages-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libRNLanguages-tvOS.a";
remoteRef = 66163243208B9BC9005CF551 /* PBXContainerItemProxy */;
remoteRef = 664C1EF92141631C00B5F149 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = {
@@ -989,10 +1009,6 @@
);
INFOPLIST_FILE = RNLanguagesExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/RNLanguagesExample\"",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@@ -1014,10 +1030,6 @@
);
INFOPLIST_FILE = RNLanguagesExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/RNLanguagesExample\"",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@@ -1062,7 +1074,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -1097,7 +1109,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
+6 -4
View File
@@ -6,10 +6,12 @@
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"i18next": "11.2.3",
"react": "16.3.1",
"react-i18next": "7.6.0",
"react-native": "0.55.3",
"i18n-js": "^3.0.11",
"react": "16.4.1",
"react-native": "0.56.0",
"react-native-languages": "file:../"
},
"devDependencies": {
"babel-preset-react-native": "^5"
}
}
+4 -9
View File
@@ -1,10 +1,9 @@
import React, { PureComponent } from 'react';
import React, { Component } from 'react';
import RNLanguages from 'react-native-languages';
import { I18nextProvider } from 'react-i18next';
import i18n from './i18n';
import Root from './Root';
export default class App extends PureComponent {
export default class App extends Component {
componentWillMount() {
RNLanguages.addEventListener('change', this._onLanguagesChange);
}
@@ -14,14 +13,10 @@ export default class App extends PureComponent {
}
_onLanguagesChange = ({ language }) => {
i18n.changeLanguage(language);
i18n.locale = language;
};
render() {
return (
<I18nextProvider i18n={i18n}>
<Root />
</I18nextProvider>
);
return <Root />;
}
}
+6 -8
View File
@@ -1,17 +1,15 @@
import React, { PureComponent } from 'react';
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { translate } from 'react-i18next';
import i18n from './i18n';
class Root extends PureComponent {
class Root extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>{this.props.t('title')}</Text>
<Text style={styles.title}>{i18n.t('title')}</Text>
<Text style={styles.line}>
{this.props.t('current', {
language: this.props.i18n.language
})}
{i18n.t('current', { language: i18n.currentLocale() })}
</Text>
</View>
);
@@ -35,4 +33,4 @@ const styles = StyleSheet.create({
}
});
export default translate('common')(Root);
export default Root;
+6 -11
View File
@@ -1,17 +1,12 @@
import RNLanguages from 'react-native-languages';
import i18n from 'i18next';
import i18n from 'i18n-js';
import en from './translations/en.json';
import fr from './translations/fr.json';
import de from './translations/de.json';
export default i18n.init({
debug: __DEV__,
lng: RNLanguages.language,
fallbackLng: 'en',
ns: ['common'],
defaultNS: 'common',
resources: { en, fr, de },
interpolation: { escapeValue: false }, // not needed for react
react: { wait: true }
});
i18n.locale = RNLanguages.language;
i18n.fallbacks = true;
i18n.translations = { en, fr, de };
export default i18n;
+2 -4
View File
@@ -1,6 +1,4 @@
{
"common": {
"title": "react-native-languages demo",
"current": "Die Sprache ist auf \"{{language}}\" gesetzt"
}
"title": "react-native-languages demo",
"current": "Die Sprache ist auf \"{{language}}\" gesetzt"
}
+2 -4
View File
@@ -1,6 +1,4 @@
{
"common": {
"title": "react-native-languages demo",
"current": "The current language is \"{{language}}\""
}
"title": "react-native-languages demo",
"current": "The current language is \"{{language}}\""
}
+2 -4
View File
@@ -1,6 +1,4 @@
{
"common": {
"title": "Démo de react-native-languages",
"current": "Le langage courant est \"{{language}}\""
}
"title": "Démo de react-native-languages",
"current": "Le langage courant est \"{{language}}\""
}
+1
View File
@@ -2,6 +2,7 @@
'use strict';
// $FlowFixMe
import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
const { RNLanguages } = NativeModules;
+15 -9
View File
@@ -1,23 +1,29 @@
{
"name": "react-native-languages",
"version": "2.0.0",
"version": "3.0.0",
"license": "MIT",
"description":
"React Native properties and methods related to the language of the device",
"description": "React Native properties and methods related to the language of the device",
"repository": "https://github.com/react-community/react-native-languages",
"author": "Mathieu Acthernoene <zoontek@gmail.com>",
"main": "index.js",
"scripts": {
"precommit": "lint-staged",
"format": "prettier --write '**/*.js'"
"format": "prettier --write '**/*.js'",
"typecheck": "flow ."
},
"lint-staged": {
"**/*.js": ["prettier --write", "git add"]
"**/*.js": [
"prettier --write",
"git add"
]
},
"peerDependencies": {
"react-native": ">=0.56.0"
},
"devDependencies": {
"flow-bin": "^0.70.0",
"husky": "^0.14.3",
"lint-staged": "^7.0.4",
"prettier": "^1.12.1"
"flow-bin": "0.80.0",
"husky": "0.14.3",
"lint-staged": "7.2.2",
"prettier": "1.14.2"
}
}
+76 -1091
View File
File diff suppressed because it is too large Load Diff