Skip to content
6 changes: 6 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}")`,
Expand Down
14 changes: 10 additions & 4 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down
37 changes: 36 additions & 1 deletion src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -64,6 +66,17 @@ Onyx.connect({
},
});

let preferredLocale: DeepValueOf<typeof CONST.LOCALES> = CONST.LOCALES.DEFAULT;
Onyx.connect({
key: ONYXKEYS.NVP_PREFERRED_LOCALE,
callback: (value) => {
if (!value) {
return;
}
preferredLocale = value;
},
});

let allReports: OnyxCollection<Report>;
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
Expand Down Expand Up @@ -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);
}

Expand Down