Skip to content

Translate auto-reporting frequency changelogs #56188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ import type {
UnapproveWithIntegrationWarningParams,
UnshareParams,
UntilTimeParams,
UpdateAutoReportingFrequencyParams,
UpdatedTheDistanceMerchantParams,
UpdatedTheRequestParams,
UpdateRoleParams,
Expand Down Expand Up @@ -2709,6 +2710,15 @@ const translations = {
return 'Member';
}
},
frequency: {
manual: 'Manually',
instant: 'Instant',
immediate: 'Daily',
trip: 'By trip',
weekly: 'Weekly',
semimonthly: 'Twice a month',
monthly: 'Monthly',
},
planType: 'Plan type',
submitExpense: 'Submit your expenses below:',
defaultCategory: 'Default category',
Expand Down Expand Up @@ -5081,6 +5091,8 @@ const translations = {
leftWorkspace: ({nameOrEmail}: LeftWorkspaceParams) => `${nameOrEmail} left the workspace`,
removeMember: ({email, role}: AddEmployeeParams) => `removed ${role === 'member' || role === 'user' ? 'member' : 'admin'} ${email}`,
removedConnection: ({connectionName}: ConnectionNameParams) => `removed connection to ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`,
updateAutoReportingFrequency: ({oldFrequency, newFrequency}: UpdateAutoReportingFrequencyParams) =>
`updated the submission frequency to "${newFrequency}" (previously "${oldFrequency}")`,
},
},
},
Expand Down
12 changes: 12 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ import type {
UnapproveWithIntegrationWarningParams,
UnshareParams,
UntilTimeParams,
UpdateAutoReportingFrequencyParams,
UpdatedTheDistanceMerchantParams,
UpdatedTheRequestParams,
UpdateRoleParams,
Expand Down Expand Up @@ -2734,6 +2735,15 @@ const translations = {
return 'Miembro';
}
},
frequency: {
manual: 'Manualmente',
instant: 'Instantáneo',
immediate: 'Diaria',
trip: 'Por viaje',
weekly: 'Semanal',
semimonthly: 'Dos veces al mes',
monthly: 'Mensual',
},
planType: 'Tipo de plan',
submitExpense: 'Envía tus gastos a continuación:',
defaultCategory: 'Categoría predeterminada',
Expand Down Expand Up @@ -5133,6 +5143,8 @@ const translations = {
leftWorkspace: ({nameOrEmail}: LeftWorkspaceParams) => `${nameOrEmail} salió del espacio de trabajo`,
removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role === 'miembro' || role === 'user' ? 'miembro' : 'administrador'} ${email}`,
removedConnection: ({connectionName}: ConnectionNameParams) => `eliminó la conexión a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`,
updateAutoReportingFrequency: ({oldFrequency, newFrequency}: UpdateAutoReportingFrequencyParams) =>
`actualizó la frecuencia de envíos a "${newFrequency}" (previamente "${oldFrequency}")`,
},
},
},
Expand Down
6 changes: 6 additions & 0 deletions src/languages/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@ type ConnectionNameParams = {
connectionName: AllConnectionName;
};

type UpdateAutoReportingFrequencyParams = {
oldFrequency: string;
newFrequency: string;
};

type LastSyncDateParams = {
connectionName: string;
formattedDate: string;
Expand Down Expand Up @@ -810,6 +815,7 @@ export type {
UpdateRoleParams,
LeftWorkspaceParams,
RemoveMemberParams,
UpdateAutoReportingFrequencyParams,
DateParams,
FiltersAmountBetweenParams,
StatementPageTitleParams,
Expand Down
17 changes: 17 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,22 @@ function getPolicyChangeLogDeleteMemberMessage(reportAction: OnyxInputOrEntry<Re
return translateLocal('report.actions.type.removeMember', {email, role});
}

function isPolicyChangeLogUpdateAutoReportingFrequencyMessage(
reportAction: OnyxInputOrEntry<ReportAction>,
): reportAction is ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REPORTING_FREQUENCY> {
return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REPORTING_FREQUENCY);
}

function getPolicyChangeLogUpdateAutoReportingFrequencyMessage(reportAction: OnyxInputOrEntry<ReportAction>): string {
if (!isPolicyChangeLogUpdateAutoReportingFrequencyMessage(reportAction)) {
return '';
}
const originalMessage = getOriginalMessage(reportAction);
const oldFrequency = translateLocal(`workspace.common.frequency.${originalMessage?.oldFrequency}` as TranslationPaths);
const newFrequency = translateLocal(`workspace.common.frequency.${originalMessage?.newFrequency}` as TranslationPaths);
return translateLocal('report.actions.type.updateAutoReportingFrequency', {oldFrequency, newFrequency});
}

function getRemovedConnectionMessage(reportAction: OnyxEntry<ReportAction>): string {
if (!isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) {
return '';
Expand Down Expand Up @@ -2031,6 +2047,7 @@ export {
getPolicyChangeLogAddEmployeeMessage,
getPolicyChangeLogChangeRoleMessage,
getPolicyChangeLogDeleteMemberMessage,
getPolicyChangeLogUpdateAutoReportingFrequencyMessage,
getPolicyChangeLogEmployeeLeftMessage,
getRenamedAction,
isCardIssuedAction,
Expand Down
3 changes: 3 additions & 0 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
getPolicyChangeLogChangeRoleMessage,
getPolicyChangeLogDeleteMemberMessage,
getPolicyChangeLogEmployeeLeftMessage,
getPolicyChangeLogUpdateAutoReportingFrequencyMessage,
getRemovedConnectionMessage,
getRenamedAction,
getReportAction,
Expand Down Expand Up @@ -557,6 +558,8 @@ function getOptionData({
result.alternateText = getReportActionMessageText(lastAction) ?? '';
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION) {
result.alternateText = getRemovedConnectionMessage(lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REPORTING_FREQUENCY) {
result.alternateText = getPolicyChangeLogUpdateAutoReportingFrequencyMessage(lastAction);
} else {
result.alternateText =
lastMessageTextFromReport.length > 0
Expand Down
3 changes: 3 additions & 0 deletions src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
getPolicyChangeLogAddEmployeeMessage,
getPolicyChangeLogChangeRoleMessage,
getPolicyChangeLogDeleteMemberMessage,
getPolicyChangeLogUpdateAutoReportingFrequencyMessage,
getRemovedConnectionMessage,
getRenamedAction,
getReportActionMessageText,
Expand Down Expand Up @@ -544,6 +545,8 @@ const ContextMenuActions: ContextMenuAction[] = [
setClipboardMessage(getPolicyChangeLogChangeRoleMessage(reportAction));
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_EMPLOYEE) {
setClipboardMessage(getPolicyChangeLogDeleteMemberMessage(reportAction));
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REPORTING_FREQUENCY) {
setClipboardMessage(getPolicyChangeLogUpdateAutoReportingFrequencyMessage(reportAction));
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.DELETED_TRANSACTION) {
setClipboardMessage(getDeletedTransactionMessage(reportAction));
} else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED)) {
Expand Down
3 changes: 3 additions & 0 deletions src/pages/home/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
getPolicyChangeLogAddEmployeeMessage,
getPolicyChangeLogChangeRoleMessage,
getPolicyChangeLogDeleteMemberMessage,
getPolicyChangeLogUpdateAutoReportingFrequencyMessage,
getRemovedConnectionMessage,
getRemovedFromApprovalChainMessage,
getRenamedAction,
Expand Down Expand Up @@ -877,6 +878,8 @@ function PureReportActionItem({
children = <ReportActionItemBasicMessage message={getPolicyChangeLogChangeRoleMessage(action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_EMPLOYEE) {
children = <ReportActionItemBasicMessage message={getPolicyChangeLogDeleteMemberMessage(action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REPORTING_FREQUENCY) {
children = <ReportActionItemBasicMessage message={getPolicyChangeLogUpdateAutoReportingFrequencyMessage(action)} />;
} else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REMOVED_FROM_APPROVAL_CHAIN)) {
children = <ReportActionItemBasicMessage message={getRemovedFromApprovalChainMessage(action)} />;
} else if (
Expand Down
6 changes: 6 additions & 0 deletions src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ type OriginalMessageChangeLog = {

/** Name of connection */
connectionName?: AllConnectionName;

/** Old auto-reporting frequency */
oldFrequency?: string;

/** New auto-reporting frequency */
newFrequency?: string;
};

/** Model of `join policy changelog` report action */
Expand Down