From 40ddc4085db8f524bf1ed98d0a8ec0649d9f1964 Mon Sep 17 00:00:00 2001 From: Rayane Djouah <77965000+rayane-djouah@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:42:53 +0000 Subject: [PATCH 1/3] Fix translation of copy requested money action messages --- src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ src/languages/types.ts | 3 +++ .../home/report/ContextMenu/ContextMenuActions.js | 12 ++++++++++++ 4 files changed, 19 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index f52848589663..33af8ce86cf5 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -71,6 +71,7 @@ import type { SetTheRequestParams, UpdatedTheRequestParams, RemovedTheRequestParams, + RequestedAmountMessageParams, } from './types'; import * as ReportActionsUtils from '../libs/ReportActionsUtils'; @@ -510,6 +511,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}`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 8610f41308e1..9037249b633e 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -71,6 +71,7 @@ import type { SetTheRequestParams, UpdatedTheRequestParams, RemovedTheRequestParams, + RequestedAmountMessageParams, } from './types'; /* eslint-disable max-len */ @@ -511,6 +512,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}`, diff --git a/src/languages/types.ts b/src/languages/types.ts index 059d944fd4ba..4723b88d2531 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -102,6 +102,8 @@ type SettlePaypalMeParams = {formattedAmount: string}; type RequestAmountParams = {amount: number}; +type RequestedAmountMessageParams = {formattedAmount: string; comment: string}; + type SplitAmountParams = {amount: number}; type AmountEachParams = {amount: number}; @@ -217,6 +219,7 @@ export type { SettleExpensifyCardParams, SettlePaypalMeParams, RequestAmountParams, + RequestedAmountMessageParams, SplitAmountParams, AmountEachParams, PayerOwesAmountParams, diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index bac79e1863e5..62a710487892 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -21,6 +21,9 @@ import QuickEmojiReactions from '../../../../components/Reactions/QuickEmojiReac import MiniQuickEmojiReactions from '../../../../components/Reactions/MiniQuickEmojiReactions'; import Navigation from '../../../../libs/Navigation/Navigation'; import ROUTES from '../../../../ROUTES'; +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. @@ -199,6 +202,15 @@ export default [ } else if (ReportActionsUtils.isModifiedExpenseAction(reportAction)) { const modifyExpenseMessage = ReportUtils.getModifiedExpenseMessage(reportAction); Clipboard.setString(modifyExpenseMessage); + } else if (ReportActionsUtils.isMoneyRequestAction(reportAction)) { + const transaction = TransactionUtils.getTransaction(originalMessage.IOUTransactionID); + const {amount, currency, comment} = ReportUtils.getTransactionDetails(transaction); + const formattedAmount = CurrencyUtils.convertToDisplayString(amount, currency); + const message = Localize.translateLocal('iou.requestedAmount', { + formattedAmount, + comment, + }); + Clipboard.setString(message); } else if (content) { const parser = new ExpensiMark(); if (!Clipboard.canSetHtml()) { From 065439b044a2b4184162227f008bed29338215d4 Mon Sep 17 00:00:00 2001 From: Rayane Djouah <77965000+rayane-djouah@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:49:21 +0000 Subject: [PATCH 2/3] fix lint error --- src/pages/home/report/ContextMenu/ContextMenuActions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 62a710487892..799cad23157f 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -206,11 +206,11 @@ export default [ const transaction = TransactionUtils.getTransaction(originalMessage.IOUTransactionID); const {amount, currency, comment} = ReportUtils.getTransactionDetails(transaction); const formattedAmount = CurrencyUtils.convertToDisplayString(amount, currency); - const message = Localize.translateLocal('iou.requestedAmount', { + const displaymessage = Localize.translateLocal('iou.requestedAmount', { formattedAmount, comment, }); - Clipboard.setString(message); + Clipboard.setString(displaymessage); } else if (content) { const parser = new ExpensiMark(); if (!Clipboard.canSetHtml()) { From 361cd80a2bf560a13d10a5a978f16fd7725cbaf0 Mon Sep 17 00:00:00 2001 From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com> Date: Tue, 19 Sep 2023 03:42:23 +0200 Subject: [PATCH 3/3] fix lint error --- src/pages/home/report/ContextMenu/ContextMenuActions.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index c5bda755a5a9..173bda0e5221 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -203,6 +203,7 @@ export default [ 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);