From 184d5d1ec3c44b4649dfcc3602b2ab38c73b7f8e Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Thu, 5 Dec 2019 13:16:43 +0100 Subject: [PATCH] i18n (#80) * i18n all the strings * assign file content * download and save language files * load language on startup * load language setting correctly when app launches * fix i18n calls in constants * pin lbryinc commit --- package-lock.json | 4 +- package.json | 2 +- src/component/AppNavigator.js | 6 +- src/component/address/view.js | 4 +- src/component/categoryList/index.js | 4 - src/component/categoryList/view.js | 39 ------ src/component/channelIconItem/view.js | 2 +- src/component/channelRewardsDriver/view.js | 4 +- src/component/channelSelector/view.js | 28 ++-- src/component/claimList/view.js | 4 +- src/component/customRewardCard/view.js | 10 +- src/component/drawerContent/view.js | 12 +- src/component/fileDownloadButton/view.js | 16 +-- src/component/fileItem/view.js | 2 +- src/component/fileItemMedia/view.js | 1 + src/component/fileListItem/view.js | 2 +- src/component/filePrice/view.js | 13 +- src/component/fileRewardsDriver/view.js | 2 +- src/component/modalPicker/view.js | 2 +- .../modalSuggestedSubscriptions/view.js | 2 +- src/component/modalTagSelector/view.js | 5 +- src/component/nsfwOverlay/view.js | 2 +- src/component/publishRewardsDriver/view.js | 4 +- src/component/rewardCard/view.js | 6 +- src/component/rewardEnrolment/view.js | 16 ++- src/component/rewardSummary/index.js | 20 --- src/component/rewardSummary/view.js | 82 ----------- src/component/searchInput/index.js | 19 --- src/component/searchInput/view.js | 41 ------ src/component/storageStatsCard/view.js | 14 +- src/component/suggestedSubscriptions/view.js | 2 +- src/component/tagSearch/view.js | 2 +- .../internal/transaction-list-item.js | 10 +- src/component/transactionList/view.js | 2 +- src/component/transactionListRecent/view.js | 16 +-- src/component/uriBar/view.js | 2 +- src/component/walletAddress/view.js | 11 +- src/component/walletBalance/view.js | 4 +- src/component/walletSend/view.js | 18 +-- src/component/walletSignIn/view.js | 15 +- src/component/walletSyncDriver/view.js | 24 ++-- src/i18n.js | 79 +++++++++++ src/index.js | 6 +- src/page/about/view.js | 38 ++--- src/page/channel/view.js | 12 +- src/page/channelCreator/view.js | 44 +++--- src/page/discover/view.js | 29 ++-- src/page/downloads/view.js | 4 +- src/page/file/view.js | 37 ++--- src/page/firstRun/index.js | 4 +- .../firstRun/internal/email-collect-page.js | 8 +- .../firstRun/internal/email-verify-page.js | 4 +- .../firstRun/internal/skip-account-page.js | 9 +- src/page/firstRun/internal/wallet-page.js | 16 ++- src/page/firstRun/internal/welcome-page.js | 12 +- src/page/firstRun/view.js | 73 ++++++++-- src/page/publish/view.js | 113 ++++++++------- src/page/publishes/view.js | 2 +- src/page/rewards/view.js | 10 +- src/page/search/view.js | 2 +- src/page/settings/index.js | 4 +- src/page/settings/view.js | 130 +++++++++++++++--- src/page/splash/index.js | 2 +- src/page/splash/view.js | 60 ++++---- src/page/subscriptions/view.js | 16 ++- src/page/tag/view.js | 6 +- src/page/transactionHistory/view.js | 6 +- src/page/trending/view.js | 16 +-- .../internal/email-verify-page.js | 14 +- .../internal/manual-verify-page.js | 7 +- .../internal/phone-verify-page.js | 10 +- .../verification/internal/sync-verify-page.js | 20 +-- src/styles/channelSelector.js | 4 + src/styles/settings.js | 22 +++ 74 files changed, 703 insertions(+), 590 deletions(-) delete mode 100644 src/component/categoryList/index.js delete mode 100644 src/component/categoryList/view.js delete mode 100644 src/component/rewardSummary/index.js delete mode 100644 src/component/rewardSummary/view.js delete mode 100644 src/component/searchInput/index.js delete mode 100644 src/component/searchInput/view.js create mode 100644 src/i18n.js diff --git a/package-lock.json b/package-lock.json index b3eae37..b980cec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5649,8 +5649,8 @@ } }, "lbryinc": { - "version": "github:lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166", - "from": "github:lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166", + "version": "github:lbryio/lbryinc#9ffb883cc11e36d55a729c65b70c405a4a56d35e", + "from": "github:lbryio/lbryinc#9ffb883cc11e36d55a729c65b70c405a4a56d35e", "requires": { "reselect": "^3.0.0" } diff --git a/package.json b/package.json index 5bc262a..2bf1512 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@expo/vector-icons": "^8.1.0", "gfycat-style-urls": "^1.0.3", "lbry-redux": "lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11", - "lbryinc": "lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166", + "lbryinc": "lbryio/lbryinc#9ffb883cc11e36d55a729c65b70c405a4a56d35e", "lodash": ">=4.17.11", "merge": ">=1.2.1", "moment": "^2.22.1", diff --git a/src/component/AppNavigator.js b/src/component/AppNavigator.js index 2d37527..e496631 100644 --- a/src/component/AppNavigator.js +++ b/src/component/AppNavigator.js @@ -364,7 +364,7 @@ class AppWithNavigationState extends React.Component { this.setState({ verifyPending: false }); NativeModules.Firebase.track('email_verified', { email: user.primary_email }); - ToastAndroid.show('Your email address was successfully verified.', ToastAndroid.LONG); + ToastAndroid.show(__('Your email address was successfully verified.'), ToastAndroid.LONG); // get user settings after email verification this.getUserSettings(); @@ -401,7 +401,7 @@ class AppWithNavigationState extends React.Component { this.setState({ emailVerifyDone: true }); const message = emailVerifyErrorMessage ? String(emailVerifyErrorMessage) - : 'Your email address was successfully verified.'; + : __('Your email address was successfully verified.'); if (!emailVerifyErrorMessage) { AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL); } @@ -476,7 +476,7 @@ class AppWithNavigationState extends React.Component { try { dispatch(doUserEmailVerify(verification.token, verification.recaptcha)); } catch (error) { - const message = 'Invalid Verification Token'; + const message = __('Invalid Verification Token'); dispatch(doUserEmailVerifyFailure(message)); dispatch(doToast({ message })); } diff --git a/src/component/address/view.js b/src/component/address/view.js index 36fe8f0..0f66b77 100644 --- a/src/component/address/view.js +++ b/src/component/address/view.js @@ -15,7 +15,7 @@ export default class Address extends React.PureComponent { return ( - + {address || ''}