Skip to content

Commit

Permalink
Merge pull request #47206 from FitseTLT/fix-lack-of-translation-to-wo…
Browse files Browse the repository at this point in the history
…rkspace-name-changed-actioin

Fix - System message for changed workspace name is not translated to Spanish
  • Loading branch information
robertjchen authored Aug 19, 2024
2 parents 212750d + 7bc6451 commit 2e796ad
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3623,6 +3623,9 @@ export default {
public_announce: 'Public Announce',
},
},
workspaceActions: {
renamedWorkspaceNameAction: ({oldName, newName}) => `updated the name of this workspace from ${oldName} to ${newName}`,
},
roomMembersPage: {
memberNotFound: 'Member not found. To invite a new member to the room, please use the invite button above.',
notAuthorized: `You don't have access to this page. If you're trying to join this room, just ask a room member to add you. Something else? Reach out to ${CONST.EMAIL.CONCIERGE}`,
Expand Down
3 changes: 3 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3676,6 +3676,9 @@ export default {
public_announce: 'Anuncio Público',
},
},
workspaceActions: {
renamedWorkspaceNameAction: ({oldName, newName}) => `actualizó el nombre de este espacio de trabajo de ${oldName} a ${newName}`,
},
roomMembersPage: {
memberNotFound: 'Miembro no encontrado. Para invitar a un nuevo miembro a la sala de chat, por favor, utiliza el botón invitar que está más arriba.',
notAuthorized: `No tienes acceso a esta página. Si estás intentando unirte a esta sala, pide a un miembro de la sala que te añada. ¿Necesitas algo más? Comunícate con ${CONST.EMAIL.CONCIERGE}`,
Expand Down
7 changes: 7 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4392,6 +4392,12 @@ function getIOUForwardedMessage(reportID: string) {
return Localize.translateLocal('iou.forwardedAmount', {amount: getFormattedAmount(reportID)});
}

function getWorkspaceNameUpdatedMessage(action: ReportAction) {
const {oldName, newName} = ReportActionsUtils.getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME>) ?? {};
const message = oldName && newName ? Localize.translateLocal('workspaceActions.renamedWorkspaceNameAction', {oldName, newName}) : ReportActionsUtils.getReportActionText(action);
return message;
}

/**
* @param iouReportID - the report ID of the IOU report the action belongs to
* @param type - IOUReportAction type. Can be oneOf(create, decline, cancel, pay, split)
Expand Down Expand Up @@ -7789,6 +7795,7 @@ export {
getIOUReportActionMessage,
getIOUApprovedMessage,
getIOUForwardedMessage,
getWorkspaceNameUpdatedMessage,
getIOUSubmittedMessage,
getIcons,
getIconsForParticipants,
Expand Down
2 changes: 2 additions & 0 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ function getOptionData({
}
} else if (ReportActionsUtils.isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.UPDATE_ROOM_DESCRIPTION)) {
result.alternateText = `${lastActorDisplayName} ${ReportActionsUtils.getUpdateRoomDescriptionMessage(lastAction)}`;
} else if (ReportActionsUtils.isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME)) {
result.alternateText = ReportUtils.getWorkspaceNameUpdatedMessage(lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.LEAVE_POLICY) {
result.alternateText = Localize.translateLocal('workspace.invite.leftWorkspace');
} else if (lastAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && lastActorDisplayName && lastMessageTextFromReport) {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ const ContextMenuActions: ContextMenuAction[] = [
} else if (ReportActionsUtils.isMemberChangeAction(reportAction)) {
const logMessage = ReportActionsUtils.getMemberChangeMessageFragment(reportAction).html ?? '';
setClipboardMessage(logMessage);
} else if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME) {
Clipboard.setString(ReportUtils.getWorkspaceNameUpdatedMessage(reportAction));
} else if (ReportActionsUtils.isReimbursementQueuedAction(reportAction)) {
Clipboard.setString(ReportUtils.getReimbursementQueuedActionMessage(reportAction, reportID, false));
} else if (ReportActionsUtils.isActionableMentionWhisper(reportAction)) {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,8 @@ function ReportActionItem({
children = <ReportActionItemBasicMessage message={ReportActionsUtils.getDismissedViolationMessageText(ReportActionsUtils.getOriginalMessage(action))} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_TAG) {
children = <ReportActionItemBasicMessage message={PolicyUtils.getCleanedTagName(ReportActionsUtils.getReportActionMessage(action)?.text ?? '')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME) {
children = <ReportActionItemBasicMessage message={ReportUtils.getWorkspaceNameUpdatedMessage(action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_EMPLOYEE) {
children = <ReportActionItemBasicMessage message={ReportActionsUtils.getPolicyChangeLogAddEmployeeMessage(action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_EMPLOYEE) {
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 @@ -245,6 +245,12 @@ type OriginalMessageChangeLog = {
/** ID of the report */
reportID?: number;

/** Old name of the workspace */
oldName?: string;

/** New name of the workspace */
newName?: string;

/** Email of user */
email?: string;

Expand Down

0 comments on commit 2e796ad

Please sign in to comment.