From e21db9d58e86f641b2a7a3a1c9ff5e468308ad57 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Thu, 31 Mar 2022 12:33:54 +0800 Subject: [PATCH 1/5] Sidebar: add option to not localize certain strings I think we want to keep Premium as a product name (consistent for all languages). It was popping up in the `window.new_strings` because the current code localizes every link. --- ui/component/sideNavigation/view.jsx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/ui/component/sideNavigation/view.jsx b/ui/component/sideNavigation/view.jsx index 051b165b0..f662de6a9 100644 --- a/ui/component/sideNavigation/view.jsx +++ b/ui/component/sideNavigation/view.jsx @@ -22,15 +22,16 @@ const touch = isTouch(); type SideNavLink = { title: string, + icon: string, link?: string, route?: string, onClick?: () => any, - icon: string, extra?: Node, hideForUnauth?: boolean, + noI18n?: boolean, }; -const GO_LIVE = { +const GO_LIVE: SideNavLink = { title: 'Go Live', link: `/$/${PAGES.LIVESTREAM}`, icon: ICONS.VIDEO, @@ -56,7 +57,7 @@ const RECENT_FROM_FOLLOWING = { icon: ICONS.SUBSCRIBE, }; -const NOTIFICATIONS = { +const NOTIFICATIONS: SideNavLink = { title: 'Notifications', link: `/$/${PAGES.NOTIFICATIONS}`, icon: ICONS.NOTIFICATION, @@ -64,32 +65,33 @@ const NOTIFICATIONS = { hideForUnauth: true, }; -const WATCH_LATER = { +const WATCH_LATER: SideNavLink = { title: 'Watch Later', link: `/$/${PAGES.LIST}/watchlater`, icon: ICONS.TIME, hideForUnauth: true, }; -const FAVORITES = { +const FAVORITES: SideNavLink = { title: 'Favorites', link: `/$/${PAGES.LIST}/favorites`, icon: ICONS.STAR, hideForUnauth: true, }; -const PLAYLISTS = { +const PLAYLISTS: SideNavLink = { title: 'Lists', link: `/$/${PAGES.LISTS}`, icon: ICONS.STACK, hideForUnauth: true, }; -const PREMIUM = { +const PREMIUM: SideNavLink = { title: 'Premium', link: `/$/${PAGES.ODYSEE_MEMBERSHIP}`, icon: ICONS.UPGRADE, hideForUnauth: true, + noI18n: true, }; const UNAUTH_LINKS: Array = [ @@ -115,7 +117,7 @@ const UNAUTH_LINKS: Array = [ }, ]; -const WILD_WEST = { +const WILD_WEST: SideNavLink = { title: 'Wild West', link: `/$/${PAGES.WILD_WEST}`, icon: ICONS.WILD_WEST, @@ -298,7 +300,7 @@ function SideNavigation(props: Props) { } function getLink(props: SideNavLink) { - const { hideForUnauth, route, link, ...passedProps } = props; + const { hideForUnauth, route, link, noI18n, ...passedProps } = props; const { title, icon, extra } = passedProps; if (hideForUnauth && !email) { @@ -311,8 +313,8 @@ function SideNavigation(props: Props) { {...passedProps} icon={icon} navigate={route || link} - label={__(title)} - title={__(title)} + label={noI18n ? title : __(title)} + title={noI18n ? title : __(title)} className={classnames('navigation-link', { 'navigation-link--pulse': icon === ICONS.LIBRARY && pulseLibrary, 'navigation-link--highlighted': icon === ICONS.NOTIFICATION && unseenCount > 0, From aa5e4d6c132cef6cceb998268892e8a88950036d Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Thu, 31 Mar 2022 12:46:20 +0800 Subject: [PATCH 2/5] Fix double translation No need for the macro when `` is used. --- ui/component/walletSpendableBalanceHelp/view.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/component/walletSpendableBalanceHelp/view.jsx b/ui/component/walletSpendableBalanceHelp/view.jsx index a83c61347..495707467 100644 --- a/ui/component/walletSpendableBalanceHelp/view.jsx +++ b/ui/component/walletSpendableBalanceHelp/view.jsx @@ -13,9 +13,9 @@ function WalletSpendableBalanceHelp(props: Props) { ); return !balance ? null : inline ? ( - {getMessage(__('%balance% available.'))} + {getMessage('%balance% available.')} ) : ( -
{getMessage(__('Your immediately spendable balance is %balance%.'))}
+
{getMessage('Your immediately spendable balance is %balance%.')}
); } From fae8c6dff480c9599257d9515ac32097a17f1670 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Thu, 31 Mar 2022 13:07:55 +0800 Subject: [PATCH 3/5] Don't translate product names ...at least, that is the current decision. --- ui/page/odyseeMembership/view.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/page/odyseeMembership/view.jsx b/ui/page/odyseeMembership/view.jsx index f3ec0fb9b..3ae993af4 100644 --- a/ui/page/odyseeMembership/view.jsx +++ b/ui/page/odyseeMembership/view.jsx @@ -512,7 +512,7 @@ const OdyseeMembershipPage = (props: Props) => {
{/* plan title */}

- {__(membershipOption.Membership.name)} + {membershipOption.Membership.name}

From c232981f0c174e0e00ab6192a14b65d69e20c00d Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Thu, 31 Mar 2022 17:13:34 +0800 Subject: [PATCH 4/5] Catch up on string changes --- static/app-strings.json | 6 ++---- ui/page/settingsStripeCard/view.jsx | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/static/app-strings.json b/static/app-strings.json index d42bd5acc..8b6120eaa 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1983,6 +1983,7 @@ "Manage Card": "Manage Card", "Card Details": "Card Details", "Remove Card": "Remove Card", + "Currency To Use": "Currency To Use", "Sorry, there was an error in processing your payment!": "Sorry, there was an error in processing your payment!", "Congratulations! Your account has been connected with Odysee.": "Congratulations! Your account has been connected with Odysee.", "Although your account is connected it still requires verification to begin receiving tips.": "Although your account is connected it still requires verification to begin receiving tips.", @@ -2202,7 +2203,7 @@ "You currently have no active memberships": "You currently have no active memberships", "Canceled Memberships": "Canceled Memberships", "You currently have no canceled memberships": "You currently have no canceled memberships", - "You are purchasing a %monthly_yearly% %plan% membership that is active immediately and will renew %monthly_yearly% at a price of %price%.": "You are purchasing a %monthly_yearly% %plan% membership that is active immediately and will renew %monthly_yearly% at a price of %price%.", + "You are purchasing a %monthly_yearly_bolded% %plan% membership that is active immediately and will renew %monthly_yearly% at a price of %price%.": "You are purchasing a %monthly_yearly_bolded% %plan% membership that is active immediately and will renew %monthly_yearly% at a price of %price%.", "monthly": "monthly", "yearly": "yearly", "You can cancel Premium at any time (no refunds) and you can also close this window and choose a different membership option.": "You can cancel Premium at any time (no refunds) and you can also close this window and choose a different membership option.", @@ -2223,13 +2224,10 @@ "You are cancelling your Odysee Premium. You will still have access to all the paid features until the point of the expiration of your current membership, at which point you will not be charged again and your membership will no longer be active. At this time, there is no way to subscribe to another membership if you cancel and there are no refunds.": "You are cancelling your Odysee Premium. You will still have access to all the paid features until the point of the expiration of your current membership, at which point you will not be charged again and your membership will no longer be active. At this time, there is no way to subscribe to another membership if you cancel and there are no refunds.", "Sorry, there was an error, please contact support or try again later": "Sorry, there was an error, please contact support or try again later", "Please save a card as a payment method so you can join Odysee Premium": "Please save a card as a payment method so you can join Odysee Premium", - "After the card is added, click Back": "After the card is added, click Back", "Registered On": "Registered On", "Auto-Renews On": "Auto-Renews On", "Canceled On": "Canceled On", "Still Valid Until": "Still Valid Until", - "Membership Period Options": "Membership Period Options", - "%yearly_cost% USD For A One Year Membership (%monthly_cost% Per Month)": "%yearly_cost% USD For A One Year Membership (%monthly_cost% Per Month)", "Active channel": "Active channel", "--end--": "--end--" } diff --git a/ui/page/settingsStripeCard/view.jsx b/ui/page/settingsStripeCard/view.jsx index 50ff7af09..1c45456ec 100644 --- a/ui/page/settingsStripeCard/view.jsx +++ b/ui/page/settingsStripeCard/view.jsx @@ -497,7 +497,7 @@ class SettingsStripeCard extends React.Component { > {['USD', 'EUR'].map((currency) => ( ))} From 071b86fa06330a54c30f54e22a5c9a4fc003de97 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Thu, 31 Mar 2022 17:43:41 +0800 Subject: [PATCH 5/5] Make "Send a xxx tip" currency-agnostic so we don't need to re-translate again --- static/app-strings.json | 5 ++--- ui/component/walletSendTip/view.jsx | 9 ++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/static/app-strings.json b/static/app-strings.json index 8b6120eaa..b87647d2f 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -24,7 +24,6 @@ "Following --[button label indicating a channel has been followed]--": "Following", "The tags you follow will change what's trending for you.": "The tags you follow will change what's trending for you.", "Tags": "Tags", - "Send a tip": "Send a tip", "Share": "Share", "Play": "Play", "Shuffle Play": "Shuffle Play", @@ -1024,6 +1023,7 @@ "Sending": "Sending", "From": "From", "Only creators that verify cash accounts can receive tips": "Only creators that verify cash accounts can receive tips", + "Send a tip directly from your attached card": "Send a tip directly from your attached card", "Amount must be at least one dollar": "Amount must be at least one dollar", "Update Your Password": "Update Your Password", "Your Wallet is Empty": "Your Wallet is Empty", @@ -1062,8 +1062,7 @@ "Boost This %claimTypeText%": "Boost This %claimTypeText%", "Boost Your %claimTypeText%": "Boost Your %claimTypeText%", "Tip This %claimTypeText%": "Tip This %claimTypeText%", - "Send a $%displayAmount% Tip": "Send a $%displayAmount% Tip", - "Send a %displayAmount% Credit Tip": "Send a %displayAmount% Credit Tip", + "Send a %amount% tip": "Send a %amount% tip", "Boost": "Boost", "Boost transaction successful.": "Boost transaction successful.", "Boost transaction failed.": "Boost transaction failed.", diff --git a/ui/component/walletSendTip/view.jsx b/ui/component/walletSendTip/view.jsx index 3549b0634..ddde0cae8 100644 --- a/ui/component/walletSendTip/view.jsx +++ b/ui/component/walletSendTip/view.jsx @@ -1,5 +1,6 @@ // @flow import { Form } from 'component/common/form'; +import LbcMessage from 'component/common/lbc-message'; import { Lbryio } from 'lbryinc'; import { parseURI } from 'util/lbryURI'; import * as ICONS from 'constants/icons'; @@ -235,9 +236,11 @@ export default function WalletSendTip(props: Props) { case TAB_BOOST: return titleText; case TAB_FIAT: - return __('Send a %fiatSymbolToUse%%displayAmount% Tip', { displayAmount, fiatSymbolToUse }); + return __('Send a %amount% tip', { amount: `${fiatSymbolToUse}${displayAmount}` }); case TAB_LBC: - return __('Send a %displayAmount% Credit Tip', { displayAmount }); + return __('Send a %amount% tip', { amount: `${displayAmount} LBC` }); + default: + return titleText; } } @@ -351,7 +354,7 @@ export default function WalletSendTip(props: Props) { button="primary" type="submit" disabled={fetchingChannels || isPending || tipError || !tipAmount || disableSubmitButton} - label={customText || buildButtonText()} + label={{customText || buildButtonText()}} /> {fetchingChannels && {__('Loading your channels...')}}