diff --git a/src/languages/en.ts b/src/languages/en.ts index c863caae67ff..f52848589663 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -68,6 +68,9 @@ import type { OOOEventSummaryPartialDayParams, ParentNavigationSummaryParams, ManagerApprovedParams, + SetTheRequestParams, + UpdatedTheRequestParams, + RemovedTheRequestParams, } from './types'; import * as ReportActionsUtils from '../libs/ReportActionsUtils'; @@ -523,6 +526,11 @@ export default { paidUsingExpensifyWithAmount: ({amount}: PaidUsingExpensifyWithAmountParams) => `paid ${amount} using Expensify`, noReimbursableExpenses: 'This report has an invalid amount', pendingConversionMessage: "Total will update when you're back online", + changedTheRequest: 'changed the request', + setTheRequest: ({valueName, newValueToDisplay}: SetTheRequestParams) => `set the ${valueName} to ${newValueToDisplay}`, + removedTheRequest: ({valueName, oldValueToDisplay}: RemovedTheRequestParams) => `removed the ${valueName} (previously ${oldValueToDisplay})`, + updatedTheRequest: ({valueName, newValueToDisplay, oldValueToDisplay}: UpdatedTheRequestParams) => + `changed the ${valueName} to ${newValueToDisplay} (previously ${oldValueToDisplay})`, threadRequestReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `${formattedAmount} request${comment ? ` for ${comment}` : ''}`, threadSentMoneyReportName: ({formattedAmount, comment}: ThreadSentMoneyReportNameParams) => `${formattedAmount} sent${comment ? ` for ${comment}` : ''}`, error: { diff --git a/src/languages/es.ts b/src/languages/es.ts index fd98e3ef51fa..8610f41308e1 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -68,6 +68,9 @@ import type { OOOEventSummaryPartialDayParams, ParentNavigationSummaryParams, ManagerApprovedParams, + SetTheRequestParams, + UpdatedTheRequestParams, + RemovedTheRequestParams, } from './types'; /* eslint-disable max-len */ @@ -524,6 +527,12 @@ export default { paidUsingExpensifyWithAmount: ({amount}: PaidUsingExpensifyWithAmountParams) => `pagó ${amount} con Expensify`, noReimbursableExpenses: 'El importe de este informe no es válido', pendingConversionMessage: 'El total se actualizará cuando estés online', + changedTheRequest: 'cambió la solicitud', + setTheRequest: ({valueName, newValueToDisplay}: SetTheRequestParams) => `estableció ${valueName === 'comerciante' ? 'el' : 'la'} ${valueName} a ${newValueToDisplay}`, + removedTheRequest: ({valueName, oldValueToDisplay}: RemovedTheRequestParams) => + `eliminó ${valueName === 'comerciante' ? 'el' : 'la'} ${valueName} (previamente ${oldValueToDisplay})`, + updatedTheRequest: ({valueName, newValueToDisplay, oldValueToDisplay}: UpdatedTheRequestParams) => + `cambío ${valueName === 'comerciante' ? 'el' : 'la'} ${valueName} a ${newValueToDisplay} (previamente ${oldValueToDisplay})`, threadRequestReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `Solicitud de ${formattedAmount}${comment ? ` para ${comment}` : ''}`, threadSentMoneyReportName: ({formattedAmount, comment}: ThreadSentMoneyReportNameParams) => `${formattedAmount} enviado${comment ? ` para ${comment}` : ''}`, error: { diff --git a/src/languages/types.ts b/src/languages/types.ts index 50290fb5776c..059d944fd4ba 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -184,6 +184,12 @@ type OOOEventSummaryPartialDayParams = {summary: string; timePeriod: string; dat type ParentNavigationSummaryParams = {rootReportName: string; workspaceName: string}; +type SetTheRequestParams = {valueName: string; newValueToDisplay: string}; + +type RemovedTheRequestParams = {valueName: string; oldValueToDisplay: string}; + +type UpdatedTheRequestParams = {valueName: string; newValueToDisplay: string; oldValueToDisplay: string}; + export type { AddressLineParams, CharacterLimitParams, @@ -252,4 +258,7 @@ export type { OOOEventSummaryFullDayParams, OOOEventSummaryPartialDayParams, ParentNavigationSummaryParams, + SetTheRequestParams, + UpdatedTheRequestParams, + RemovedTheRequestParams, }; diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 53423e8deaf2..6167a04ada2f 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1478,14 +1478,15 @@ function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceip function getProperSchemaForModifiedExpenseMessage(newValue, oldValue, valueName, valueInQuotes) { const newValueToDisplay = valueInQuotes ? `"${newValue}"` : newValue; const oldValueToDisplay = valueInQuotes ? `"${oldValue}"` : oldValue; + const displayValueName = valueName.toLowerCase(); if (!oldValue) { - return `set the ${valueName} to ${newValueToDisplay}`; + return Localize.translateLocal('iou.setTheRequest', {valueName: displayValueName, newValueToDisplay}); } if (!newValue) { - return `removed the ${valueName} (previously ${oldValueToDisplay})`; + return Localize.translateLocal('iou.removedTheRequest', {valueName: displayValueName, oldValueToDisplay}); } - return `changed the ${valueName} to ${newValueToDisplay} (previously ${oldValueToDisplay})`; + return Localize.translateLocal('iou.updatedTheRequest', {valueName: displayValueName, newValueToDisplay, oldValueToDisplay}); } /** @@ -1497,7 +1498,7 @@ function getProperSchemaForModifiedExpenseMessage(newValue, oldValue, valueName, function getModifiedExpenseMessage(reportAction) { const reportActionOriginalMessage = lodashGet(reportAction, 'originalMessage', {}); if (_.isEmpty(reportActionOriginalMessage)) { - return `changed the request`; + return Localize.translateLocal('iou.changedTheRequest'); } const hasModifiedAmount = @@ -1512,12 +1513,12 @@ function getModifiedExpenseMessage(reportAction) { const currency = reportActionOriginalMessage.currency; const amount = CurrencyUtils.convertToDisplayString(reportActionOriginalMessage.amount, currency); - return getProperSchemaForModifiedExpenseMessage(amount, oldAmount, 'amount', false); + return getProperSchemaForModifiedExpenseMessage(amount, oldAmount, Localize.translateLocal('iou.amount'), false); } const hasModifiedComment = _.has(reportActionOriginalMessage, 'oldComment') && _.has(reportActionOriginalMessage, 'newComment'); if (hasModifiedComment) { - return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.newComment, reportActionOriginalMessage.oldComment, 'description', true); + return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.newComment, reportActionOriginalMessage.oldComment, Localize.translateLocal('common.description'), true); } const hasModifiedCreated = _.has(reportActionOriginalMessage, 'oldCreated') && _.has(reportActionOriginalMessage, 'created'); @@ -1525,12 +1526,12 @@ function getModifiedExpenseMessage(reportAction) { // Take only the YYYY-MM-DD value as the original date includes timestamp let formattedOldCreated = parseISO(reportActionOriginalMessage.oldCreated); formattedOldCreated = format(formattedOldCreated, CONST.DATE.FNS_FORMAT_STRING); - return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.created, formattedOldCreated, 'date', false); + return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.created, formattedOldCreated, Localize.translateLocal('common.date'), false); } const hasModifiedMerchant = _.has(reportActionOriginalMessage, 'oldMerchant') && _.has(reportActionOriginalMessage, 'merchant'); if (hasModifiedMerchant) { - return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.merchant, reportActionOriginalMessage.oldMerchant, 'merchant', true); + return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.merchant, reportActionOriginalMessage.oldMerchant, Localize.translateLocal('common.merchant'), true); } }