From 6988950ea8e7a0f6650593152d474fc8076d5218 Mon Sep 17 00:00:00 2001 From: kn Date: Sat, 2 Feb 2019 09:21:05 -0800 Subject: [PATCH] [#6973] Replace react-native-i18n with react-native-languages --- android/app/build.gradle | 2 +- .../im/status/ethereum/MainApplication.java | 4 +- android/settings.gradle | 4 +- clj-rn.conf.edn | 6 +- desktop_files/package.json.orig | 5 +- desktop_files/yarn.lock | 13 ++- ios/StatusIm.xcodeproj/project.pbxproj | 96 +++++++++---------- mobile_files/package.json.orig | 3 +- mobile_files/yarn.lock | 20 ++-- .../react_native/js_dependencies.cljs | 3 +- .../react_native/js_dependencies.cljs | 3 +- scripts/build-desktop.sh | 2 +- src/status_im/android/core.cljs | 10 +- src/status_im/i18n.cljs | 1 + src/status_im/ios/core.cljs | 10 +- .../react_native/js_dependencies.cljs | 1 + 16 files changed, 102 insertions(+), 81 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 5f56307765..683fa0ca8e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -240,7 +240,7 @@ dependencies { // https://docs.gradle.org/current/userguide/introduction_dependency_management.html#sec:dependency_resolution //compile ("com.facebook.react:react-native:0.55.4") { force = true } // From node_modules implementation project(':react-native-android') - implementation project(':react-native-i18n') + implementation project(':react-native-languages') implementation project(':react-native-status') implementation project(':react-native-fs') implementation project(':react-native-image-crop-picker') diff --git a/android/app/src/main/java/im/status/ethereum/MainApplication.java b/android/app/src/main/java/im/status/ethereum/MainApplication.java index a7d26e6fae..7d0dc6a071 100644 --- a/android/app/src/main/java/im/status/ethereum/MainApplication.java +++ b/android/app/src/main/java/im/status/ethereum/MainApplication.java @@ -2,7 +2,6 @@ package im.status.ethereum; import android.support.multidex.MultiDexApplication; -import com.AlexanderZaytsev.RNI18n.RNI18nPackage; import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; @@ -14,6 +13,7 @@ import com.horcrux.svg.SvgPackage; import com.lugg.ReactNativeConfig.ReactNativeConfigPackage; import com.oblador.keychain.KeychainPackage; import com.ocetnik.timer.BackgroundTimerPackage; +import com.reactcommunity.rnlanguages.RNLanguagesPackage; import com.reactnative.ivpusic.imagepicker.PickerPackage; import com.rnfs.RNFSPackage; @@ -60,7 +60,7 @@ public class MainApplication extends MultiDexApplication implements ReactApplica statusPackage, new RNStatusKeycardPackage(), new RealmReactPackage(), - new RNI18nPackage(), + new RNLanguagesPackage(), new RNCameraPackage(), new RNFSPackage(), new ReactNativeDialogsPackage(), diff --git a/android/settings.gradle b/android/settings.gradle index 12b0f0ca90..c8ff5c4589 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -18,8 +18,8 @@ include ':react-native-image-resizer' project(':react-native-image-resizer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-resizer/android') include ':react-native-dialogs' project(':react-native-dialogs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-dialogs/android') -include ':react-native-i18n' -project(':react-native-i18n').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-i18n/android') +include ':react-native-languages' +project(':react-native-languages').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-languages/android') include ':realm' project(':realm').projectDir = new File(rootProject.projectDir, '../node_modules/realm/android') include ':react-native-status' diff --git a/clj-rn.conf.edn b/clj-rn.conf.edn index 9ab4e403e2..65160f0b69 100644 --- a/clj-rn.conf.edn +++ b/clj-rn.conf.edn @@ -5,7 +5,8 @@ :figwheel-bridge "./figwheel-bridge.js" ;; JS modules :js-modules ["realm" - "react-native-i18n" + "react-native-languages" + "i18n-js" "realm/react-native" "dismissKeyboard" "react-native-splash-screen" @@ -45,7 +46,8 @@ ;; Desktop modules :desktop-modules ["realm" - "react-native-i18n" + "react-native-languages" + "i18n-js" "realm/react-native" "dismissKeyboard" "react-native-splash-screen" diff --git a/desktop_files/package.json.orig b/desktop_files/package.json.orig index 51a163324f..2815bb5abb 100644 --- a/desktop_files/package.json.orig +++ b/desktop_files/package.json.orig @@ -7,7 +7,7 @@ "prepare": "patch-package" }, "desktopExternalModules": [ - "node_modules/react-native-i18n/desktop", + "node_modules/react-native-languages/desktop", "node_modules/react-native-config/desktop", "node_modules/react-native-fs/desktop", "node_modules/react-native-http-bridge/desktop", @@ -41,6 +41,7 @@ "events": "1.1.1", "google-breakpad": "git+https://github.com/status-im/google-breakpad.git#v0.9.0", "homoglyph-finder": "1.1.1", + "i18n-js": "^3.1.0", "identicon.js": "git+https://github.com/status-im/identicon.js.git#v1.2.1-status", "js-sha3": "^0.8.0", "level-filesystem": "1.2.0", @@ -63,11 +64,11 @@ "react-native-fs": "git+https://github.com/status-im/react-native-fs.git#v2.9.7-status", "react-native-http": "git+https://github.com/tradle/react-native-http.git#834492d", "react-native-http-bridge": "0.6.1", - "react-native-i18n": "git+https://github.com/status-im/react-native-i18n.git#v0.0.8-desktop", "react-native-image-crop-picker": "0.18.1", "react-native-image-resizer": "1.0.0", "react-native-invertible-scroll-view": "1.1.0", "react-native-keychain": "git+https://github.com/status-im/react-native-keychain.git#v.3.0.0-2-status", + "react-native-languages": "git+https://github.com/status-im/react-native-languages.git#v0.1.1-status", "react-native-level-fs": "3.0.0", "react-native-os": "1.1.0", "react-native-qrcode": "0.2.6", diff --git a/desktop_files/yarn.lock b/desktop_files/yarn.lock index de071a3152..f596fb25d6 100644 --- a/desktop_files/yarn.lock +++ b/desktop_files/yarn.lock @@ -4481,6 +4481,11 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +i18n-js@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/i18n-js/-/i18n-js-3.1.0.tgz#4ec474b2b7ba8175284a0003804c7bf713991919" + integrity sha512-xkpkBgf7anfmoRnJFdTqSQuv3phuP2DHEakWbNJUQMZxaLf146dcYWscOyN6wlG6R2WgS6AE7y664yiAaXXDwg== + iconv-lite@0.4.23: version "0.4.23" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" @@ -7203,10 +7208,6 @@ react-native-http-bridge@0.6.1: Base64 "~0.2.0" inherits "~2.0.1" -"react-native-i18n@git+https://github.com/status-im/react-native-i18n.git#v0.0.8-desktop": - version "0.0.8" - resolved "git+https://github.com/status-im/react-native-i18n.git#e4361722d5fcaaa52d561d948dc7ed2a5e709d38" - react-native-image-crop-picker@0.18.1: version "0.18.1" resolved "https://registry.yarnpkg.com/react-native-image-crop-picker/-/react-native-image-crop-picker-0.18.1.tgz#ebdbe72def5afb6c69aa6e2ad72fd3a7de8ee408" @@ -7231,6 +7232,10 @@ react-native-invertible-scroll-view@1.1.0: version "3.0.0-rc.3" resolved "git+https://github.com/status-im/react-native-keychain.git#ce6cec62222713f2cec7798b69c4fae6b493832f" +"react-native-languages@git+https://github.com/status-im/react-native-languages.git#v0.1.1-status": + version "3.0.2" + resolved "git+https://github.com/status-im/react-native-languages.git#60338ff3040b8af68d33233aebeb36db4d31aed0" + react-native-level-fs@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/react-native-level-fs/-/react-native-level-fs-3.0.0.tgz#b9e7d278485b696634a627cc604577cb2af9ebdf" diff --git a/ios/StatusIm.xcodeproj/project.pbxproj b/ios/StatusIm.xcodeproj/project.pbxproj index 1f0cdfd8be..2889179098 100644 --- a/ios/StatusIm.xcodeproj/project.pbxproj +++ b/ios/StatusIm.xcodeproj/project.pbxproj @@ -24,7 +24,6 @@ 20B6B6851D92C42600CC5C6A /* RSKImageCropper.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 20B6B6831D92C42600CC5C6A /* RSKImageCropper.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 20B6B6871D92C42600CC5C6A /* QBImagePicker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20B6B6861D92C42600CC5C6A /* QBImagePicker.framework */; }; 20B6B6881D92C42600CC5C6A /* QBImagePicker.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 20B6B6861D92C42600CC5C6A /* QBImagePicker.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 213311F38CA74CE280FD09AD /* libRNI18n.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52F6ED6465184513A082652B /* libRNI18n.a */; }; 22118DE1207A419FBFE7B62D /* libRealmReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CD48A32459B64E96843BB238 /* libRealmReact.a */; }; 25DC9C9DC25846BD8D084888 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9A886A2CB448B1ABA0EB62 /* libc++.tbd */; }; 3E15DFEC1F6F4D7CAE088F49 /* libTcpSockets.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C2A4E93F6B154AEFA3485B45 /* libTcpSockets.a */; }; @@ -45,6 +44,7 @@ 9EE89E2D1E03FD9F007D3C25 /* libimageCropPicker.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 20A5C9531D927137002C4965 /* libimageCropPicker.a */; }; 9EF0836B1F3B53AB00876A8F /* libReactNativeConfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EF083611F3B538B00876A8F /* libReactNativeConfig.a */; }; AB96C730942E49178F59AE6F /* libRNSecureRandom.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1464A9A9E12F45068947C28F /* libRNSecureRandom.a */; }; + ABC194E5221009A800EB06E6 /* libRNLanguages.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ABC194E22210099C00EB06E6 /* libRNLanguages.a */; }; ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; }; B24FC7FD1DE7195700D694FF /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B24FC7FC1DE7195700D694FF /* Social.framework */; }; B24FC7FF1DE7195F00D694FF /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B24FC7FE1DE7195F00D694FF /* MessageUI.framework */; }; @@ -143,13 +143,6 @@ remoteGlobalIDString = 3400A8081CEB54A6008A0BC7; remoteInfo = imageCropPicker; }; - 20B7D10D1D3F74CD00B70F14 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 46E2F6052EB44C698C680894 /* RNI18n.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = CDD7BF781B2D5125006FDA75; - remoteInfo = RNI18n; - }; 20B7D1191D3F74CD00B70F14 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 305F194186D848FDB07AF34C /* RNFS.xcodeproj */; @@ -276,6 +269,20 @@ remoteGlobalIDString = EB2648DF1C7BE17A00B8F155; remoteInfo = ReactNativeConfig; }; + ABC194E12210099C00EB06E6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = ABC194DC2210099B00EB06E6 /* RNLanguages.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 134814201AA4EA6300B7C361; + remoteInfo = RNLanguages; + }; + ABC194E32210099C00EB06E6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = ABC194DC2210099B00EB06E6 /* RNLanguages.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 2D2A28471D9B043800D4039D; + remoteInfo = "RNLanguages-tvOS"; + }; ADBDB9261DFEBF0700ED6528 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */; @@ -444,13 +451,6 @@ remoteGlobalIDString = 2D2A28201D9B03D100D4039D; remoteInfo = "RCTAnimation-tvOS"; }; - C9B824E81FC713C800D277C6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 46E2F6052EB44C698C680894 /* RNI18n.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 6476C4051EEAA69700B10F51; - remoteInfo = "RNI18n-tvOS"; - }; CE4E319D1D8693090033ED64 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 5E5A7625B76441D984EA8C0D /* RCTImageResizer.xcodeproj */; @@ -514,13 +514,11 @@ 38E1A2C8D0734EE99E2B16CE /* TcpSockets.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = TcpSockets.xcodeproj; path = "../node_modules/react-native-tcp/ios/TcpSockets.xcodeproj"; sourceTree = ""; }; 3A7EB0491DD9CABC00A4FCC8 /* SplashScreen.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SplashScreen.xcodeproj; path = "../node_modules/react-native-splash-screen/ios/SplashScreen.xcodeproj"; sourceTree = ""; }; 439B6B4B407A4E2AACAFE5BE /* RCTStatus.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTStatus.xcodeproj; path = "../modules/react-native-status/ios/RCTStatus/RCTStatus.xcodeproj"; sourceTree = ""; }; - 46E2F6052EB44C698C680894 /* RNI18n.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNI18n.xcodeproj; path = "../node_modules/react-native-i18n/ios/RNI18n.xcodeproj"; sourceTree = ""; }; 475D1F8D20B7413500879A77 /* RNFirebase.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNFirebase.xcodeproj; path = "../node_modules/react-native-firebase/ios/RNFirebase.xcodeproj"; sourceTree = ""; }; 475D1FCD20B7415300879A77 /* libFirebaseCore.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libFirebaseCore.a; sourceTree = BUILT_PRODUCTS_DIR; }; 475D1FCE20B7415300879A77 /* libFirebaseMessaging.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libFirebaseMessaging.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4C16DE0B1F89508700AA10DB /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 4E586E1B0E544F64AA9F5BD1 /* libz.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; - 52F6ED6465184513A082652B /* libRNI18n.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNI18n.a; sourceTree = ""; }; 5535217F57E44D77AA9CF083 /* libRCTOrientation.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTOrientation.a; sourceTree = ""; }; 55C386202185E83600B7A324 /* Inter-UI-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Inter-UI-Medium.otf"; path = "fonts/Inter-UI-Medium.otf"; sourceTree = ""; }; 55C386212185E83600B7A324 /* Inter-UI-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Inter-UI-Regular.otf"; path = "fonts/Inter-UI-Regular.otf"; sourceTree = ""; }; @@ -548,6 +546,7 @@ 9ED2F45D1D9D52DD00B36508 /* SF-UI-Text-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Regular.otf"; sourceTree = ""; }; 9ED2F4601D9D577B00B36508 /* SF-UI-Text-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Bold.otf"; sourceTree = ""; }; 9EF083381F3B538A00876A8F /* ReactNativeConfig.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeConfig.xcodeproj; path = "../node_modules/react-native-config/ios/ReactNativeConfig.xcodeproj"; sourceTree = ""; }; + ABC194DC2210099B00EB06E6 /* RNLanguages.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNLanguages.xcodeproj; path = "../node_modules/react-native-languages/ios/RNLanguages.xcodeproj"; sourceTree = ""; }; ACA66A8F16CD2FE21F38738B /* Pods-StatusIm.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StatusIm.debug.xcconfig"; path = "Pods/Target Support Files/Pods-StatusIm/Pods-StatusIm.debug.xcconfig"; sourceTree = ""; }; ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = ""; }; AF2BF381BC7B4EB0887F0091 /* libRNSVG.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNSVG.a; sourceTree = ""; }; @@ -581,6 +580,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + ABC194E5221009A800EB06E6 /* libRNLanguages.a in Frameworks */, 475D202F20B7450D00879A77 /* libRNFirebase.a in Frameworks */, C93242561FE1C68C00FE7099 /* libRCTAnimation.a in Frameworks */, 4C16DE0C1F89508700AA10DB /* JavaScriptCore.framework in Frameworks */, @@ -607,7 +607,6 @@ 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, FD4F213C3873473CB703B1D2 /* libRNFS.a in Frameworks */, - 213311F38CA74CE280FD09AD /* libRNI18n.a in Frameworks */, 22118DE1207A419FBFE7B62D /* libRealmReact.a in Frameworks */, 25DC9C9DC25846BD8D084888 /* libc++.tbd in Frameworks */, BA68A2377A20496EA737000D /* libz.tbd in Frameworks */, @@ -793,15 +792,6 @@ name = Products; sourceTree = ""; }; - 20B7D1041D3F74CD00B70F14 /* Products */ = { - isa = PBXGroup; - children = ( - 20B7D10E1D3F74CD00B70F14 /* libRNI18n.a */, - C9B824E91FC713C800D277C6 /* libRNI18n-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; 20B7D1161D3F74CD00B70F14 /* Products */ = { isa = PBXGroup; children = ( @@ -858,6 +848,7 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( + ABC194DC2210099B00EB06E6 /* RNLanguages.xcodeproj */, 475D1F8D20B7413500879A77 /* RNFirebase.xcodeproj */, 9EF083381F3B538A00876A8F /* ReactNativeConfig.xcodeproj */, B2DEA0A41E49E32000FA28D6 /* RCTHttpServer.xcodeproj */, @@ -878,7 +869,6 @@ 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 305F194186D848FDB07AF34C /* RNFS.xcodeproj */, - 46E2F6052EB44C698C680894 /* RNI18n.xcodeproj */, F090E261B9854867A728CE4F /* RealmReact.xcodeproj */, 38E1A2C8D0734EE99E2B16CE /* TcpSockets.xcodeproj */, 439B6B4B407A4E2AACAFE5BE /* RCTStatus.xcodeproj */, @@ -985,6 +975,15 @@ name = Frameworks; sourceTree = ""; }; + ABC194DD2210099B00EB06E6 /* Products */ = { + isa = PBXGroup; + children = ( + ABC194E22210099C00EB06E6 /* libRNLanguages.a */, + ABC194E42210099C00EB06E6 /* libRNLanguages-tvOS.a */, + ); + name = Products; + sourceTree = ""; + }; ADBDB9201DFEBF0600ED6528 /* Products */ = { isa = PBXGroup; children = ( @@ -1024,7 +1023,6 @@ children = ( 146834041AC3E56700842450 /* libReact.a */, 674B3D9595A047AB8D518F4E /* libRNFS.a */, - 52F6ED6465184513A082652B /* libRNI18n.a */, DF1CD4C3D1254774ACCAE4E8 /* libBVLinearGradient.a */, 5535217F57E44D77AA9CF083 /* libRCTOrientation.a */, 11632AA0A5F84F029DD91797 /* libRNVectorIcons.a */, @@ -1226,8 +1224,8 @@ ProjectRef = 305F194186D848FDB07AF34C /* RNFS.xcodeproj */; }, { - ProductGroup = 20B7D1041D3F74CD00B70F14 /* Products */; - ProjectRef = 46E2F6052EB44C698C680894 /* RNI18n.xcodeproj */; + ProductGroup = ABC194DD2210099B00EB06E6 /* Products */; + ProjectRef = ABC194DC2210099B00EB06E6 /* RNLanguages.xcodeproj */; }, { ProductGroup = 475D1EEE20B73EE000879A77 /* Products */; @@ -1332,13 +1330,6 @@ remoteRef = 20A5C9521D927137002C4965 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 20B7D10E1D3F74CD00B70F14 /* libRNI18n.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRNI18n.a; - remoteRef = 20B7D10D1D3F74CD00B70F14 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 20B7D11A1D3F74CD00B70F14 /* libRNFS.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1465,6 +1456,20 @@ remoteRef = 9EF083601F3B538B00876A8F /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + ABC194E22210099C00EB06E6 /* libRNLanguages.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRNLanguages.a; + remoteRef = ABC194E12210099C00EB06E6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + ABC194E42210099C00EB06E6 /* libRNLanguages-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libRNLanguages-tvOS.a"; + remoteRef = ABC194E32210099C00EB06E6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1633,13 +1638,6 @@ remoteRef = C93242541FE1C68C00FE7099 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - C9B824E91FC713C800D277C6 /* libRNI18n-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRNI18n-tvOS.a"; - remoteRef = C9B824E81FC713C800D277C6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; CE4E319E1D8693090033ED64 /* libRCTImageResizer.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1894,7 +1892,7 @@ "$(SRCROOT)/../node_modules/react-native/React/**", "$(SRCROOT)/../node_modules/react-native-camera/ios", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-i18n/RNI18n", + "$(SRCROOT)/../node_modules/react-native-languages/RNLanguages", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", "$(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation/**", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", @@ -1959,7 +1957,7 @@ "$(SRCROOT)/../node_modules/react-native/React/**", "$(SRCROOT)/../node_modules/react-native-camera/ios", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-i18n/RNI18n", + "$(SRCROOT)/../node_modules/react-native-languages/RNLanguages", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", "$(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation/**", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", @@ -2055,7 +2053,7 @@ "$(SRCROOT)/../node_modules/react-native/React/**", "$(SRCROOT)/../node_modules/react-native-camera/ios", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-i18n/RNI18n", + "$(SRCROOT)/../node_modules/react-native-languages/RNLanguages", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", "$(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation/**", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", @@ -2124,7 +2122,7 @@ "$(SRCROOT)/../node_modules/react-native/React/**", "$(SRCROOT)/../node_modules/react-native-camera/ios", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-i18n/RNI18n", + "$(SRCROOT)/../node_modules/react-native-languages/RNLanguages", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", "$(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation/**", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", diff --git a/mobile_files/package.json.orig b/mobile_files/package.json.orig index 096fd07b78..056248846e 100644 --- a/mobile_files/package.json.orig +++ b/mobile_files/package.json.orig @@ -24,6 +24,7 @@ "events": "1.1.1", "homoglyph-finder": "1.1.1", "identicon.js": "git+https://github.com/status-im/identicon.js.git#v1.2.1-status", + "i18n-js": "^3.1.0", "js-sha3": "^0.8.0", "level-filesystem": "1.2.0", "process": "0.11.10", @@ -42,11 +43,11 @@ "react-native-firebase": "git+https://github.com/status-im/react-native-firebase.git#v5.0.0-rc1-status", "react-native-fs": "2.11.15", "react-native-http-bridge": "0.6.1", - "react-native-i18n": "2.0.15", "react-native-image-crop-picker": "0.18.1", "react-native-image-resizer": "git+https://github.com/status-im/react-native-image-resizer.git#1.0.0-1-status", "react-native-invertible-scroll-view": "1.1.0", "react-native-keychain": "git+https://github.com/status-im/react-native-keychain.git#v.3.0.0-status", + "react-native-languages": "^3.0.2", "react-native-level-fs": "3.0.1", "react-native-os": "git+https://github.com/status-im/react-native-os.git#v1.1.0-1-status", "react-native-qrcode": "0.2.7", diff --git a/mobile_files/yarn.lock b/mobile_files/yarn.lock index f2041b1216..c93dd3e645 100644 --- a/mobile_files/yarn.lock +++ b/mobile_files/yarn.lock @@ -3861,10 +3861,10 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -i18n-js@3.0.11: - version "3.0.11" - resolved "https://registry.yarnpkg.com/i18n-js/-/i18n-js-3.0.11.tgz#f9e96bdb641c5b9d6be12759d7c422089987ef02" - integrity sha512-v7dG3kYJTQTyox3NqDabPDE/ZotWntyMI9kh4cYi+XlCSnsIR+KBTS2opPyObL8WndnklcLzbNU92FP/mLge3Q== +i18n-js@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/i18n-js/-/i18n-js-3.1.0.tgz#4ec474b2b7ba8175284a0003804c7bf713991919" + integrity sha512-xkpkBgf7anfmoRnJFdTqSQuv3phuP2DHEakWbNJUQMZxaLf146dcYWscOyN6wlG6R2WgS6AE7y664yiAaXXDwg== iconv-lite@0.4.23: version "0.4.23" @@ -5918,13 +5918,6 @@ react-native-http-bridge@0.6.1: resolved "https://registry.yarnpkg.com/react-native-http-bridge/-/react-native-http-bridge-0.6.1.tgz#1b85688174870e9b009692e1a6cdc5f5396c5ca4" integrity sha512-XnPVdaYkKIC8bRGmADVLhgDO0Evnya3rOExVEzxk6pBJjNUewWljkGHt//OTpb4t7Te6oDqQAwa+gfVtzhRU1A== -react-native-i18n@2.0.15: - version "2.0.15" - resolved "https://registry.yarnpkg.com/react-native-i18n/-/react-native-i18n-2.0.15.tgz#09b5a9836116fa7dbd0054c46e2d1014c1ef3c65" - integrity sha512-V8VwUP0TLda3oJvgt5tdnFaOV7WXPhTjCTLO7sXI3C2SHggSbD4bCUryMzNJhesimJidH21V2Owvj4zAylHoQQ== - dependencies: - i18n-js "3.0.11" - react-native-image-crop-picker@0.18.1: version "0.18.1" resolved "https://registry.yarnpkg.com/react-native-image-crop-picker/-/react-native-image-crop-picker-0.18.1.tgz#ebdbe72def5afb6c69aa6e2ad72fd3a7de8ee408" @@ -5948,6 +5941,11 @@ react-native-invertible-scroll-view@1.1.0: version "3.0.0-rc.3" resolved "git+https://github.com/status-im/react-native-keychain.git#43e5512cabb8ee064fd9e503be943dcf2c7d7669" +react-native-languages@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/react-native-languages/-/react-native-languages-3.0.2.tgz#c2c4c5050974fe4b50f7372051ca1f9824c1c778" + integrity sha512-LGsTfixFM6hXDhcFJI6mrtrNBsGPSvXT9RtZQ0tlqmGFKmMyZW6eQgJ7kLw8lISD2FIGl4jJwY06EAJpbMsNxg== + react-native-level-fs@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/react-native-level-fs/-/react-native-level-fs-3.0.1.tgz#f3054614c2bc1a379dcb3d3ee51b6a1b66123283" diff --git a/react-native/src/desktop/status_im/react_native/js_dependencies.cljs b/react-native/src/desktop/status_im/react_native/js_dependencies.cljs index 2706233c79..1fa911391c 100644 --- a/react-native/src/desktop/status_im/react_native/js_dependencies.cljs +++ b/react-native/src/desktop/status_im/react_native/js_dependencies.cljs @@ -11,7 +11,8 @@ (def secure-random (.-generateSecureRandom (js/require "react-native-securerandom"))) (def EventEmmiter (js/require "react-native/Libraries/vendor/emitter/EventEmitter")) (def fetch (.-default (js/require "react-native-fetch-polyfill"))) -(def i18n (js/require "react-native-i18n")) +(def i18n (js/require "i18n-js")) +(def react-native-languages (.-default (js/require "react-native-languages"))) (def desktop-linking (.-DesktopLinking (.-NativeModules react-native))) (def desktop-menu (js/require "react-native-desktop-menu")) (def desktop-config (js/require "react-native-desktop-config")) diff --git a/react-native/src/mobile/status_im/react_native/js_dependencies.cljs b/react-native/src/mobile/status_im/react_native/js_dependencies.cljs index 5fe9e647dd..f2ce3e5207 100644 --- a/react-native/src/mobile/status_im/react_native/js_dependencies.cljs +++ b/react-native/src/mobile/status_im/react_native/js_dependencies.cljs @@ -12,7 +12,8 @@ (def secure-random (.-generateSecureRandom (js/require "react-native-securerandom"))) (def EventEmmiter (js/require "react-native/Libraries/vendor/emitter/EventEmitter")) (def fetch (.-default (js/require "react-native-fetch-polyfill"))) -(def i18n (.-default (js/require "react-native-i18n"))) +(def i18n (js/require "i18n-js")) +(def react-native-languages (.-default (js/require "react-native-languages"))) (def camera (js/require "react-native-camera")) (def dialogs (js/require "react-native-dialogs")) (def dismiss-keyboard (js/require "dismissKeyboard")) diff --git a/scripts/build-desktop.sh b/scripts/build-desktop.sh index 78c771acb9..24f899ccdd 100755 --- a/scripts/build-desktop.sh +++ b/scripts/build-desktop.sh @@ -22,7 +22,7 @@ else fi external_modules_dir=( \ - 'node_modules/react-native-i18n/desktop' \ + 'node_modules/react-native-languages/desktop' \ 'node_modules/react-native-config/desktop' \ 'node_modules/react-native-fs/desktop' \ 'node_modules/react-native-http-bridge/desktop' \ diff --git a/src/status_im/android/core.cljs b/src/status_im/android/core.cljs index b44c2d8724..3820a97092 100644 --- a/src/status_im/android/core.cljs +++ b/src/status_im/android/core.cljs @@ -11,12 +11,16 @@ [status-im.native-module.core :as status] [status-im.notifications.core :as notifications] [status-im.core :as core] + [status-im.react-native.js-dependencies :as rn-dependencies] [status-im.utils.snoopy :as snoopy] [taoensso.timbre :as log])) (defn app-state-change-handler [state] (dispatch [:app-state-change state])) +(defn on-languages-change [event] + (set! (.-locale rn-dependencies/i18n) (.-language event))) + (defn app-root [props] (let [keyboard-height (subscribe [:get :keyboard-height])] (reagent/create-class @@ -37,14 +41,16 @@ (when (zero? @keyboard-height) (dispatch [:set :keyboard-height 0])))) (.hide react/splash-screen) - (.addEventListener react/app-state "change" app-state-change-handler)) + (.addEventListener react/app-state "change" app-state-change-handler) + (.addEventListener rn-dependencies/react-native-languages "change" on-languages-change)) :component-did-mount (fn [this] (dispatch [:set-initial-props (reagent/props this)])) :component-will-unmount (fn [] (.stop react/http-bridge) - (.removeEventListener react/app-state "change" app-state-change-handler)) + (.removeEventListener react/app-state "change" app-state-change-handler) + (.removeEventListener rn-dependencies/react-native-languages "change" on-languages-change)) :display-name "root" :reagent-render views/main}))) diff --git a/src/status_im/i18n.cljs b/src/status_im/i18n.cljs index cdf8b2d02a..ee1d8a7b33 100644 --- a/src/status_im/i18n.cljs +++ b/src/status_im/i18n.cljs @@ -7,6 +7,7 @@ [clojure.set :as set] [status-im.utils.types :as types])) +(set! (.-locale rn-dependencies/i18n) (.-language rn-dependencies/react-native-languages)) (set! (.-fallbacks rn-dependencies/i18n) true) (set! (.-defaultSeparator rn-dependencies/i18n) "/") diff --git a/src/status_im/ios/core.cljs b/src/status_im/ios/core.cljs index 64ff991d24..22089df52b 100644 --- a/src/status_im/ios/core.cljs +++ b/src/status_im/ios/core.cljs @@ -6,6 +6,7 @@ status-im.ui.screens.events status-im.ui.screens.subs status-im.data-store.core + [status-im.react-native.js-dependencies :as rn-dependencies] [status-im.ui.screens.views :as views] [status-im.ui.components.react :as react] [status-im.notifications.core :as notifications] @@ -15,6 +16,9 @@ (defn app-state-change-handler [state] (dispatch [:app-state-change state])) +(defn on-languages-change [event] + (set! (.-locale rn-dependencies/i18n) (.-language event))) + (defn app-root [props] (let [keyboard-height (subscribe [:get :keyboard-height])] (reagent/create-class @@ -32,14 +36,16 @@ #(when-not (= 0 @keyboard-height) (dispatch [:set :keyboard-height 0]))) (.hide react/splash-screen) - (.addEventListener react/app-state "change" app-state-change-handler)) + (.addEventListener react/app-state "change" app-state-change-handler) + (.addEventListener rn-dependencies/react-native-languages "change" on-languages-change)) :component-did-mount (fn [this] (dispatch [:set-initial-props (reagent/props this)])) :component-will-unmount (fn [] (.stop react/http-bridge) - (.removeEventListener react/app-state "change" app-state-change-handler)) + (.removeEventListener react/app-state "change" app-state-change-handler) + (.removeEventListener rn-dependencies/react-native-languages "change" on-languages-change)) :display-name "root" :reagent-render views/main}))) diff --git a/test/cljs/status_im/react_native/js_dependencies.cljs b/test/cljs/status_im/react_native/js_dependencies.cljs index 569bce7da1..74e85c8789 100644 --- a/test/cljs/status_im/react_native/js_dependencies.cljs +++ b/test/cljs/status_im/react_native/js_dependencies.cljs @@ -9,6 +9,7 @@ (def fs #js {}) (def http-bridge #js {}) (def i18n #js {:locale "en"}) +(def react-native-languages #js {:language "en", :addEventListener (fn []), :removeEventListener (fn [])}) (def image-crop-picker #js {}) (def image-resizer #js {}) (def linear-gradient #js {})