From 4fa9a00517c1fe30e49f898a9a572c06073a9d8f Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Tue, 20 Feb 2024 15:06:00 +0530 Subject: [PATCH 1/6] Handle translation for system messages --- src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ src/libs/ReportUtils.ts | 4 ++-- src/pages/home/report/ReportActionItem.js | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index da7a1d0b7586..fd38d0563b70 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -668,6 +668,8 @@ export default { hold: 'Hold', holdRequest: 'Hold Request', unholdRequest: 'Unhold Request', + heldRequest: (comment) => `held this money request with the comment: ${comment}`, + unheldRequest: 'unheld this money request', explainHold: "Explain why you're holding this request.", reason: 'Reason', holdReasonRequired: 'A reason is required when holding.', diff --git a/src/languages/es.ts b/src/languages/es.ts index 23cf8be8c30c..e2522c2db585 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -662,6 +662,8 @@ export default { enableWallet: 'Habilitar Billetera', holdRequest: 'Bloquear solicitud de dinero', unholdRequest: 'Desbloquear solicitud de dinero', + heldRequest: (comment) => `celebró esta solicitud de dinero con el comentario: ${comment}`, + unheldRequest: 'esta solicitud de dinero no retenida', explainHold: 'Explica la razón para bloquear esta solicitud.', reason: 'Razón', holdReasonRequired: 'Se requiere una razón para bloquear.', diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index d0c3bf3e8c03..92601608b1ff 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3519,7 +3519,7 @@ function buildOptimisticHoldReportAction(comment: string, created = DateUtils.ge { type: CONST.REPORT.MESSAGE.TYPE.TEXT, style: 'normal', - text: `held this money request with the comment: ${comment}`, + text: Localize.translateLocal('iou.heldRequest', {comment}), }, { type: CONST.REPORT.MESSAGE.TYPE.COMMENT, @@ -3554,7 +3554,7 @@ function buildOptimisticUnHoldReportAction(created = DateUtils.getDBTime()): Opt { type: CONST.REPORT.MESSAGE.TYPE.TEXT, style: 'normal', - text: `unheld this money request`, + text: Localize.translateLocal('iou.unheldRequest'), }, ], person: [ diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 39a5fcaa4ee0..d9da97d73260 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -466,6 +466,10 @@ function ReportActionItem(props) { children = ; } else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.MARKEDREIMBURSED) { children = ; + } else if (props.action.actionName === 'HOLD') { + children = ; + } else if (props.action.actionName === 'UNHOLD') { + children = ; } else { const hasBeenFlagged = !_.contains([CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING], moderationDecision) && From 566e65f01b4f1b110860028a22af16669d5165f1 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Tue, 20 Feb 2024 15:06:14 +0530 Subject: [PATCH 2/6] Handle translation for form label --- src/pages/iou/HoldReasonPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/HoldReasonPage.tsx b/src/pages/iou/HoldReasonPage.tsx index da3b98583630..25f318089c2e 100644 --- a/src/pages/iou/HoldReasonPage.tsx +++ b/src/pages/iou/HoldReasonPage.tsx @@ -84,7 +84,7 @@ function HoldReasonPage({route}: HoldReasonPageProps) { valueType="string" name="comment" defaultValue={undefined} - label="Reason" + label={translate('iou.reason')} accessibilityLabel={translate('iou.reason')} autoFocus /> From 1b55ecb98bd0779efc0f0f0d57583364fa0d43c3 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Tue, 20 Feb 2024 22:36:29 +0530 Subject: [PATCH 3/6] Update copy and refactor --- src/languages/en.ts | 3 ++- src/languages/es.ts | 5 +++-- src/languages/types.ts | 3 +++ src/pages/home/report/ReportActionItem.js | 6 +++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index fd38d0563b70..5d28b96ea258 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -26,6 +26,7 @@ import type { FormattedMaxLengthParams, GoBackMessageParams, GoToRoomParams, + HeldRequestParams, InstantSummaryParams, LocalTimeParams, LoggedInAsParams, @@ -668,7 +669,7 @@ export default { hold: 'Hold', holdRequest: 'Hold Request', unholdRequest: 'Unhold Request', - heldRequest: (comment) => `held this money request with the comment: ${comment}`, + heldRequest: ({comment}: HeldRequestParams) => `held this money request with the comment: ${comment}`, unheldRequest: 'unheld this money request', explainHold: "Explain why you're holding this request.", reason: 'Reason', diff --git a/src/languages/es.ts b/src/languages/es.ts index e2522c2db585..6f2a588f17ed 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -25,6 +25,7 @@ import type { FormattedMaxLengthParams, GoBackMessageParams, GoToRoomParams, + HeldRequestParams, InstantSummaryParams, LocalTimeParams, LoggedInAsParams, @@ -662,8 +663,8 @@ export default { enableWallet: 'Habilitar Billetera', holdRequest: 'Bloquear solicitud de dinero', unholdRequest: 'Desbloquear solicitud de dinero', - heldRequest: (comment) => `celebró esta solicitud de dinero con el comentario: ${comment}`, - unheldRequest: 'esta solicitud de dinero no retenida', + heldRequest: ({comment}: HeldRequestParams) => `bloqueó esta solicitud con el comentario: ${comment}`, + unheldRequest: 'desbloqueó esta solicitud', explainHold: 'Explica la razón para bloquear esta solicitud.', reason: 'Razón', holdReasonRequired: 'Se requiere una razón para bloquear.', diff --git a/src/languages/types.ts b/src/languages/types.ts index f7e580819fdf..6a67217a6129 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -293,6 +293,8 @@ type ElectronicFundsParams = {percentage: string; amount: string}; type LogSizeParams = {size: number}; +type HeldRequestParams = {comment: string}; + export type { AdminCanceledRequestParams, ApprovedAmountParams, @@ -395,4 +397,5 @@ export type { WelcomeToRoomParams, ZipCodeExampleFormatParams, LogSizeParams, + HeldRequestParams, }; diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index d9da97d73260..2f173e89dcdd 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -466,9 +466,9 @@ function ReportActionItem(props) { children = ; } else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.MARKEDREIMBURSED) { children = ; - } else if (props.action.actionName === 'HOLD') { - children = ; - } else if (props.action.actionName === 'UNHOLD') { + } else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) { + children = ; + } else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) { children = ; } else { const hasBeenFlagged = From 9cabc2c8d8319a335f607c02b0f6cc8acad5b5e1 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Tue, 20 Feb 2024 22:56:25 +0530 Subject: [PATCH 4/6] Use lodash --- src/pages/home/report/ReportActionItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 2f173e89dcdd..8b7d7de0b0e5 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -467,7 +467,7 @@ function ReportActionItem(props) { } else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.MARKEDREIMBURSED) { children = ; } else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) { - children = ; + children = ; } else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) { children = ; } else { From 652edda63175de57b9d7346f830f4ef6b8218875 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Tue, 20 Feb 2024 23:00:37 +0530 Subject: [PATCH 5/6] Update copy --- src/languages/en.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 5d28b96ea258..ca7f9a9dfc77 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -669,8 +669,8 @@ export default { hold: 'Hold', holdRequest: 'Hold Request', unholdRequest: 'Unhold Request', - heldRequest: ({comment}: HeldRequestParams) => `held this money request with the comment: ${comment}`, - unheldRequest: 'unheld this money request', + heldRequest: ({comment}: HeldRequestParams) => `held this request with the comment: ${comment}`, + unheldRequest: 'unheld this request', explainHold: "Explain why you're holding this request.", reason: 'Reason', holdReasonRequired: 'A reason is required when holding.', From b336cd3b4c258d23071fb47305bc279c7adac477 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Tue, 20 Feb 2024 23:18:18 +0530 Subject: [PATCH 6/6] Update copy --- src/languages/en.ts | 4 ++-- src/languages/es.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index ca7f9a9dfc77..0553d6470ddc 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -667,8 +667,8 @@ export default { waitingOnEnabledWallet: ({submitterDisplayName}: WaitingOnBankAccountParams) => `Started settling up, payment is held until ${submitterDisplayName} enables their Wallet`, enableWallet: 'Enable Wallet', hold: 'Hold', - holdRequest: 'Hold Request', - unholdRequest: 'Unhold Request', + holdRequest: 'Hold request', + unholdRequest: 'Unhold request', heldRequest: ({comment}: HeldRequestParams) => `held this request with the comment: ${comment}`, unheldRequest: 'unheld this request', explainHold: "Explain why you're holding this request.", diff --git a/src/languages/es.ts b/src/languages/es.ts index 6f2a588f17ed..2a2eb96bd488 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -661,8 +661,8 @@ export default { }, waitingOnEnabledWallet: ({submitterDisplayName}: WaitingOnBankAccountParams) => `Inició el pago, pero no se procesará hasta que ${submitterDisplayName} active su Billetera`, enableWallet: 'Habilitar Billetera', - holdRequest: 'Bloquear solicitud de dinero', - unholdRequest: 'Desbloquear solicitud de dinero', + holdRequest: 'Bloquear solicitud', + unholdRequest: 'Desbloquear solicitud', heldRequest: ({comment}: HeldRequestParams) => `bloqueó esta solicitud con el comentario: ${comment}`, unheldRequest: 'desbloqueó esta solicitud', explainHold: 'Explica la razón para bloquear esta solicitud.',