Consolidate transaction result strings

## Issue
Accumulation of so many strings for a "successful tip" that it is getting annoying to re-translate them for minor changes.

## Change
- Consolidate and re-use strings.
- Make the tip string currency-agnostic so we don't have to touch it again. The amount and currency is moved to the `subMessage`.
- Fix spacing being incorrectly enforced through i18n (it should be done via code/css).
This commit is contained in:
infinite-persistence 2022-03-30 18:17:39 +08:00 committed by Thomas Zarebczan
parent 99d730d0e3
commit e9e232f008
4 changed files with 23 additions and 48 deletions

View file

@ -861,13 +861,6 @@
"Insufficient credits": "Insufficient credits",
"Error abandoning your claim/support": "Error abandoning your claim/support",
"Error unlocking your tip": "Error unlocking your tip",
"You deposited %lbc% as a support!": "You deposited %lbc% as a support!",
"You deposited %amount% LBRY Credits as a support!": "You deposited %amount% LBRY Credits as a support!",
"You sent $%amount% as a tip to %tipChannelName%, I'm sure they appreciate it!": "You sent $%amount% as a tip to %tipChannelName%, I'm sure they appreciate it!",
"You sent %tipAmount% LBRY Credits as a tip to %tipChannelName%, I'm sure they appreciate it!": "You sent %tipAmount% LBRY Credits as a tip to %tipChannelName%, I'm sure they appreciate it!",
"You sent %lbc% as a tip, Mahalo!": "You sent %lbc% as a tip, Mahalo!",
"You sent %amount% LBRY Credits as a tip, Mahalo!": "You sent %amount% LBRY Credits as a tip, Mahalo!",
"You sent %amount% LBRY Credits": "You sent %amount% LBRY Credits",
"No stats found": "No stats found",
"Sorry about that. Contact %SITE_HELP_EMAIL% if you continue to have issues.": "Sorry about that. Contact %SITE_HELP_EMAIL% if you continue to have issues.",
"You are not able to see this channel's stats. Make sure you are signed in with the correct email and have data sharing turned on.": "You are not able to see this channel's stats. Make sure you are signed in with the correct email and have data sharing turned on.",
@ -1028,6 +1021,10 @@
"To address: ": "To address: ",
"Confirm Transaction": "Confirm Transaction",
"Once the transaction is sent, it cannot be reversed.": "Once the transaction is sent, it cannot be reversed.",
"Sending": "Sending",
"From": "From",
"Only creators that verify cash accounts can receive tips": "Only creators that verify cash accounts can receive tips",
"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",
"Buy Credits": "Buy Credits",
@ -1068,19 +1065,12 @@
"Send a $%displayAmount% Tip": "Send a $%displayAmount% Tip",
"Send a %displayAmount% Credit Tip": "Send a %displayAmount% Credit Tip",
"Boost": "Boost",
"Boosting": "Boosting",
"Tipping Credit": "Tipping Credit",
"Tipping Fiat (USD)": "Tipping Fiat (USD)",
"Send Revocable Support": "Send Revocable Support",
"Send a %amount% Tip": "Send a %amount% Tip",
"Channel to show support as": "Channel to show support as",
"This refundable boost will improve the discoverability of this %claimTypeText% while active. ": "This refundable boost will improve the discoverability of this %claimTypeText% while active. ",
"Show this channel your appreciation by sending a donation in USD. ": "Show this channel your appreciation by sending a donation in USD. ",
"Boost transaction successful.": "Boost transaction successful.",
"Boost transaction failed.": "Boost transaction failed.",
"Tip successfully sent. I'm sure they appreciate it!": "Tip successfully sent. I'm sure they appreciate it!",
"Tip transaction failed.": "Tip transaction failed.",
"Add a Card": "Add a Card",
"To Tip Creators": "To Tip Creators",
"Show this channel your appreciation by sending a donation of Credits. ": "Show this channel your appreciation by sending a donation of Credits. ",
"Buy or swap more LBRY Credits": "Buy or swap more LBRY Credits",
"Buy or Swap": "Buy or Swap",
"Support This %claimTypeText%": "Support This %claimTypeText%",
@ -1904,7 +1894,7 @@
"Create or Schedule a New Stream": "Create or Schedule a New Stream",
"You can upload your own recording or select a replay when your stream is over": "You can upload your own recording or select a replay when your stream is over",
"Edit / Update": "Edit / Update",
"This channel isn't staking enough Credits for inline image previews.": "This channel isn't staking enough Credits for inline image previews.",
"Odysee Premium required to enable image previews": "Odysee Premium required to enable image previews",
"This channel isn't staking enough Credits for link previews.": "This channel isn't staking enough Credits for link previews.",
"Latest": "Latest",
"Channel Not Found": "Channel Not Found",
@ -1979,9 +1969,7 @@
"System": "System",
"Supporting content requires %lbc%": "Supporting content requires %lbc%",
"With %lbc%, you can send tips to your favorite creators, or help boost their content for more people to see.": "With %lbc%, you can send tips to your favorite creators, or help boost their content for more people to see.",
"Show this channel your appreciation by sending a donation in USD.": "Show this channel your appreciation by sending a donation in USD.",
"This refundable boost will improve the discoverability of this %claimTypeText% while active.": "This refundable boost will improve the discoverability of this %claimTypeText% while active.",
"Show this channel your appreciation by sending a donation of Credits.": "Show this channel your appreciation by sending a donation of Credits.",
"Add card to tip creators in USD": "Add card to tip creators in USD",
"Add a credit card to tip creators in their local currency.": "Add a credit card to tip creators in their local currency.",
"Add Card": "Add Card",
@ -2132,6 +2120,7 @@
"Scheduled streams hidden, you can re-enable them in settings.": "Scheduled streams hidden, you can re-enable them in settings.",
"Customize Homepage": "Customize Homepage",
"Customize --[Short label for \"Customize Homepage\"]--": "Customize",
"This is currently an early-access feature for Premium members.": "This is currently an early-access feature for Premium members.",
"Sort and customize your homepage": "Sort and customize your homepage",
"Clean as a whistle! --[title for empty homepage]--": "Clean as a whistle!",
"Hidden": "Hidden",

View file

@ -298,10 +298,8 @@ export function CommentCreate(props: Props) {
}, 1500);
doToast({
message: __("You sent %tipAmount% Credits as a tip to %tipChannelName%, I'm sure they appreciate it!", {
tipAmount: tipAmount, // force show decimal places
tipChannelName,
}),
message: __("Tip successfully sent. I'm sure they appreciate it!"),
subMessage: `${tipAmount} LBC ⇒ ${tipChannelName}`, // force show decimal places
});
setSuccessTip({ txid, tipAmount });

View file

@ -117,25 +117,17 @@ export default function WalletSendTip(props: Props) {
} catch (e) {}
// icon to use or explainer text to show per tab
let explainerText = '',
confirmLabel = '';
let explainerText = '';
switch (activeTab) {
case TAB_BOOST:
explainerText = __(
'This refundable boost will improve the discoverability of this %claimTypeText% while active.',
{ claimTypeText }
);
confirmLabel = __('Boosting');
break;
case TAB_FIAT:
explainerText = __('Show this channel your appreciation by sending a donation in %currencyToUse%. ', {
currencyToUse: preferredCurrency,
});
confirmLabel = __('Tipping %currencyToUse%', { currencyToUse: preferredCurrency });
break;
case TAB_LBC:
explainerText = __('Show this channel your appreciation by sending a donation of Credits. ');
confirmLabel = __('Tipping Credit');
explainerText = __('Show this channel your appreciation by sending a donation.');
break;
}
@ -301,7 +293,7 @@ export default function WalletSendTip(props: Props) {
{/* short explainer under the button */}
<div className="section__subtitle">
{explainerText}
{explainerText}{' '}
{/* {activeTab === TAB_FIAT && !hasCardSaved && <Button navigate={`/$/${PAGES.SETTINGS_STRIPE_CARD}`} label={__('Add A Card')} button="link" />} */}
<Button
label={__('Learn more')}
@ -321,7 +313,7 @@ export default function WalletSendTip(props: Props) {
<div className="confirm__value">{channelName || title}</div>
<div className="confirm__label">{__('From --[the tip sender]--')}</div>
<div className="confirm__value">{(!incognito && activeChannelName) || __('Anonymous')}</div>
<div className="confirm__label">{confirmLabel}</div>
<div className="confirm__label">{__('Amount')}</div>
<div className="confirm__value">
{activeTab === TAB_FIAT ? (
<p>{`${fiatSymbolToUse} ${(Math.round(tipAmount * 100) / 100).toFixed(2)}`}</p>

View file

@ -289,7 +289,8 @@ export function doSendDraftTransaction(address, amount) {
});
dispatch(
doToast({
message: __('You sent %amount% LBRY Credits', { amount: amount }),
message: __("Tip successfully sent. I'm sure they appreciate it!"),
subMessage: `${amount} LBC`,
linkText: __('History'),
linkTarget: '/wallet',
})
@ -366,8 +367,9 @@ export function doSendTip(params, isSupport, successCallback, errorCallback, sho
dispatch(
doToast({
message: shouldSupport
? __('You deposited %amount% LBRY Credits as a support!', { amount: params.amount })
: __('You sent %amount% LBRY Credits as a tip, Mahalo!', { amount: params.amount }),
? __('Boost transaction successful.')
: __("Tip successfully sent. I'm sure they appreciate it!"),
subMessage: `${params.amount} LBC`,
linkText: __('History'),
linkTarget: '/wallet',
})
@ -742,18 +744,12 @@ export const doSendCashTip = (
'post'
)
.then((customerTipResponse) => {
const fiatIconToUse = preferredCurrency === 'USD' ? '$' : '€';
const fiatSymbol = preferredCurrency === 'USD' ? '$' : '€';
dispatch(
doToast({
message: __(
"You sent %fiatIconToUse%%tipAmount% as a tip to %tipChannelName%, I'm sure they appreciate it!",
{
tipAmount: tipParams.tipAmount,
tipChannelName: tipParams.tipChannelName,
fiatIconToUse,
}
),
message: __("Tip successfully sent. I'm sure they appreciate it!"),
subMessage: `${fiatSymbol}${tipParams.tipAmount}${tipParams.tipChannelName}`,
})
);