Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: App does not translate copy to clipboard text for requested money action #27142

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import type {
SetTheRequestParams,
UpdatedTheRequestParams,
RemovedTheRequestParams,
RequestedAmountMessageParams,
TagSelectionParams,
TranslationBase,
} from './types';
Expand Down Expand Up @@ -520,6 +521,7 @@ export default {
payElsewhere: 'Pay elsewhere',
settlePaypalMe: ({formattedAmount}: SettlePaypalMeParams) => `Pay ${formattedAmount} with PayPal.me`,
requestAmount: ({amount}: RequestAmountParams) => `request ${amount}`,
requestedAmount: ({formattedAmount, comment}: RequestedAmountMessageParams) => `requested ${formattedAmount}${comment ? ` for ${comment}` : ''}`,
splitAmount: ({amount}: SplitAmountParams) => `split ${amount}`,
amountEach: ({amount}: AmountEachParams) => `${amount} each`,
payerOwesAmount: ({payer, amount}: PayerOwesAmountParams) => `${payer} owes ${amount}`,
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import type {
SetTheRequestParams,
UpdatedTheRequestParams,
RemovedTheRequestParams,
RequestedAmountMessageParams,
TagSelectionParams,
EnglishTranslation,
} from './types';
Expand Down Expand Up @@ -512,6 +513,7 @@ export default {
payElsewhere: 'Pagar de otra forma',
settlePaypalMe: ({formattedAmount}: SettlePaypalMeParams) => `Pagar ${formattedAmount} con PayPal.me`,
requestAmount: ({amount}: RequestAmountParams) => `solicitar ${amount}`,
requestedAmount: ({formattedAmount, comment}: RequestedAmountMessageParams) => `solicité ${formattedAmount}${comment ? ` para ${comment}` : ''}`,
splitAmount: ({amount}: SplitAmountParams) => `dividir ${amount}`,
amountEach: ({amount}: AmountEachParams) => `${amount} cada uno`,
payerOwesAmount: ({payer, amount}: PayerOwesAmountParams) => `${payer} debe ${amount}`,
Expand Down
3 changes: 3 additions & 0 deletions src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ type SettlePaypalMeParams = {formattedAmount: string};

type RequestAmountParams = {amount: number};

type RequestedAmountMessageParams = {formattedAmount: string; comment: string};

type SplitAmountParams = {amount: number};

type AmountEachParams = {amount: number};
Expand Down Expand Up @@ -262,6 +264,7 @@ export type {
SettleExpensifyCardParams,
SettlePaypalMeParams,
RequestAmountParams,
RequestedAmountMessageParams,
SplitAmountParams,
AmountEachParams,
PayerOwesAmountParams,
Expand Down
13 changes: 13 additions & 0 deletions src/pages/home/report/ContextMenu/ContextMenuActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import MiniQuickEmojiReactions from '../../../../components/Reactions/MiniQuickE
import Navigation from '../../../../libs/Navigation/Navigation';
import ROUTES from '../../../../ROUTES';
import * as Task from '../../../../libs/actions/Task';
import * as Localize from '../../../../libs/Localize';
import * as TransactionUtils from '../../../../libs/TransactionUtils';
import * as CurrencyUtils from '../../../../libs/CurrencyUtils';

/**
* Gets the HTML version of the message in an action.
Expand Down Expand Up @@ -199,6 +202,16 @@ export default [
} else if (ReportActionsUtils.isModifiedExpenseAction(reportAction)) {
const modifyExpenseMessage = ReportUtils.getModifiedExpenseMessage(reportAction);
Clipboard.setString(modifyExpenseMessage);
} else if (ReportActionsUtils.isMoneyRequestAction(reportAction)) {
const originalMessage = _.get(reportAction, 'originalMessage', {});
const transaction = TransactionUtils.getTransaction(originalMessage.IOUTransactionID);
const {amount, currency, comment} = ReportUtils.getTransactionDetails(transaction);
const formattedAmount = CurrencyUtils.convertToDisplayString(amount, currency);
const displaymessage = Localize.translateLocal('iou.requestedAmount', {
formattedAmount,
comment,
});
Clipboard.setString(displaymessage);
} else if (content) {
const parser = new ExpensiMark();
if (!Clipboard.canSetHtml()) {
Expand Down
Loading