Skip to content

Commit

Permalink
Merge pull request #27142 from rayane-djouah/fix-app-does-not-transla…
Browse files Browse the repository at this point in the history
…te-copy-to-clipboard-text-for-requested

Fix: App does not translate copy to clipboard text for requested money action
  • Loading branch information
roryabraham authored Sep 19, 2023
2 parents bba5dee + 361cd80 commit d53d633
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import type {
SetTheRequestParams,
UpdatedTheRequestParams,
RemovedTheRequestParams,
RequestedAmountMessageParams,
TagSelectionParams,
TranslationBase,
} from './types';
Expand Down Expand Up @@ -515,6 +516,7 @@ export default {
settleExpensify: ({formattedAmount}: SettleExpensifyCardParams) => `Pay ${formattedAmount} with Expensify`,
payElsewhere: 'Pay elsewhere',
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 @@ -69,6 +69,7 @@ import type {
SetTheRequestParams,
UpdatedTheRequestParams,
RemovedTheRequestParams,
RequestedAmountMessageParams,
TagSelectionParams,
EnglishTranslation,
} from './types';
Expand Down Expand Up @@ -507,6 +508,7 @@ export default {
settleExpensify: ({formattedAmount}: SettleExpensifyCardParams) => `Pagar ${formattedAmount} con Expensify`,
payElsewhere: 'Pagar de otra forma',
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 @@ -102,6 +102,8 @@ type SettleExpensifyCardParams = {

type RequestAmountParams = {amount: number};

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

type SplitAmountParams = {amount: number};

type AmountEachParams = {amount: number};
Expand Down Expand Up @@ -257,6 +259,7 @@ export type {
RequestCountParams,
SettleExpensifyCardParams,
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

0 comments on commit d53d633

Please sign in to comment.