diff --git a/src/languages/en.ts b/src/languages/en.ts index 8016342f090..f2038765525 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4868,6 +4868,12 @@ const translations = { `changed the maximum expense amount for violations to ${newValue} (previously ${oldValue})`, updateMaxExpenseAge: ({oldValue, newValue}: UpdatedPolicyFieldWithNewAndOldValueParams) => `updated "Max expense age (days)" to "${newValue}" (previously "${oldValue === 'false' ? CONST.POLICY.DEFAULT_MAX_EXPENSE_AGE : oldValue}")`, + updateMonthlyOffset: ({oldValue, newValue}: UpdatedPolicyFieldWithNewAndOldValueParams) => { + if (!oldValue) { + return `set the monthly report submission date to "${newValue}"`; + } + return `updated the monthly report submission date to "${newValue}" (previously "${oldValue}")`; + }, updateDefaultBillable: ({oldValue, newValue}: UpdatedPolicyFieldWithNewAndOldValueParams) => `updated "Re-bill expenses to clients" to "${newValue}" (previously "${oldValue}")`, updateDefaultTitleEnforced: ({value}: UpdatedPolicyFieldWithValueParam) => `turned "Enforce default report titles" ${value ? 'on' : 'off'}`, renamedWorkspaceNameAction: ({oldName, newName}: RenamedRoomActionParams) => `updated the name of this workspace to "${newName}" (previously "${oldName}")`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 0d82fb9fe39..4d33e351f3f 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1589,10 +1589,10 @@ const translations = { lastDayOfMonth: 'Último día del mes', lastBusinessDayOfMonth: 'Último día hábil del mes', ordinals: { - one: '.º', - two: '.º', - few: '.º', - other: '.º', + one: 'º', + two: 'º', + few: 'º', + other: 'º', /* eslint-disable @typescript-eslint/naming-convention */ '1': 'Primero', '2': 'Segundo', @@ -4923,6 +4923,12 @@ const translations = { `actualizó "Antigüedad máxima de gastos (días)" a "${newValue}" (previamente "${oldValue === 'false' ? CONST.POLICY.DEFAULT_MAX_EXPENSE_AGE : oldValue}")`, updateDefaultBillable: ({oldValue, newValue}: UpdatedPolicyFieldWithNewAndOldValueParams) => `actualizó "Volver a facturar gastos a clientes" a "${newValue}" (previamente "${oldValue}")`, + updateMonthlyOffset: ({oldValue, newValue}: UpdatedPolicyFieldWithNewAndOldValueParams) => { + if (!oldValue) { + return `establecer la fecha de envío del informe mensual a "${newValue}"`; + } + return `actualizar la fecha de envío del informe mensual a "${newValue}" (previamente "${oldValue}")`; + }, updateDefaultTitleEnforced: ({value}: UpdatedPolicyFieldWithValueParam) => `cambió "Requerir título predeterminado de informe" a ${value ? 'activado' : 'desactivado'}`, updateWorkspaceDescription: ({newDescription, oldDescription}: UpdatedPolicyDescriptionParams) => !oldDescription diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 0cd32556da1..481d366e2ae 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -16,12 +16,14 @@ import type Report from '@src/types/onyx/Report'; import type ReportAction from '@src/types/onyx/ReportAction'; import type {Message, OldDotReportAction, OriginalMessage, ReportActions} from '@src/types/onyx/ReportAction'; import type ReportActionName from '@src/types/onyx/ReportActionName'; +import type DeepValueOf from '@src/types/utils/DeepValueOf'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import {convertToDisplayString} from './CurrencyUtils'; import DateUtils from './DateUtils'; import {getEnvironmentURL} from './Environment/Environment'; import getBase62ReportID from './getBase62ReportID'; import isReportMessageAttachment from './isReportMessageAttachment'; +import {toLocaleOrdinal} from './LocaleDigitUtils'; import {formatPhoneNumber} from './LocalePhoneNumber'; import {formatMessageElementList, translateLocal} from './Localize'; import Log from './Log'; @@ -64,6 +66,17 @@ Onyx.connect({ }, }); +let preferredLocale: DeepValueOf = CONST.LOCALES.DEFAULT; +Onyx.connect({ + key: ONYXKEYS.NVP_PREFERRED_LOCALE, + callback: (value) => { + if (!value) { + return; + } + preferredLocale = value; + }, +}); + let allReports: OnyxCollection; Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, @@ -2006,7 +2019,29 @@ function getWorkspaceUpdateFieldMessage(action: ReportAction): string { newValue, }); } - + if ( + updatedField && + updatedField === CONST.POLICY.COLLECTION_KEYS.AUTOREPORTING_OFFSET && + (typeof oldValue === 'string' || typeof oldValue === 'number') && + (typeof newValue === 'string' || typeof newValue === 'number') + ) { + const getAutoReportingOffsetToDisplay = (autoReportingOffset: string | number) => { + if (autoReportingOffset === CONST.POLICY.AUTO_REPORTING_OFFSET.LAST_DAY_OF_MONTH) { + return translateLocal('workflowsPage.frequencies.lastDayOfMonth'); + } + if (autoReportingOffset === CONST.POLICY.AUTO_REPORTING_OFFSET.LAST_BUSINESS_DAY_OF_MONTH) { + return translateLocal('workflowsPage.frequencies.lastBusinessDayOfMonth'); + } + if (typeof autoReportingOffset === 'number') { + return toLocaleOrdinal(preferredLocale, autoReportingOffset, false); + } + return ''; + }; + return translateLocal('workspaceActions.updateMonthlyOffset', { + newValue: getAutoReportingOffsetToDisplay(newValue), + oldValue: getAutoReportingOffsetToDisplay(oldValue), + }); + } return getReportActionText(action); }