From 30bc3c14a87f324d5c3b60ef67220f2976941052 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Wed, 4 Jun 2025 09:14:07 -0700 Subject: [PATCH] Fix button label for save dialog --- _locales/en/messages.json | 4 ++++ app/main.ts | 14 +++++++++++++- ts/state/ducks/conversations.ts | 17 +++++++++++++---- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 602771dc1f..c779a1ccda 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -8414,6 +8414,10 @@ "messageformat": "Don't share personal information with people you don't know", "description": "Third list item in profile name warning modal for group conversations" }, + "icu:SaveMultiDialog__title": { + "messageformat": "Save attachments", + "description": "Title of the dialog to save multiple attachments" + }, "icu:WhatsNew__modal-title": { "messageformat": "What's New", "description": "Title for the whats new modal" diff --git a/app/main.ts b/app/main.ts index 4de224345d..0dc0ccd35a 100644 --- a/app/main.ts +++ b/app/main.ts @@ -3122,7 +3122,15 @@ ipc.handle( 'show-open-folder-dialog', async ( _event, - { useMainWindow }: { useMainWindow: boolean } = { useMainWindow: false } + { + useMainWindow, + buttonLabel, + title, + }: { + useMainWindow: boolean; + buttonLabel?: string; + title?: string; + } = { useMainWindow: false } ) => { let canceled: boolean; let selectedDirPaths: ReadonlyArray; @@ -3138,12 +3146,16 @@ ipc.handle( { defaultPath: app.getPath('downloads'), properties: ['openDirectory', 'createDirectory'], + buttonLabel, + title, } )); } else { ({ canceled, filePaths: selectedDirPaths } = await dialog.showOpenDialog({ defaultPath: app.getPath('downloads'), properties: ['openDirectory', 'createDirectory'], + buttonLabel, + title, })); } diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index 25631470c4..e5b7464d0c 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -29,6 +29,7 @@ import { drop } from '../../util/drop'; import type { DurationInSeconds } from '../../util/durations'; import * as universalExpireTimer from '../../util/universalExpireTimer'; import * as Attachment from '../../types/Attachment'; +import type { LocalizerType } from '../../types/I18N'; import { AttachmentDownloadUrgency } from '../../types/AttachmentDownload'; import { isFileDangerous } from '../../util/isFileDangerous'; import { getLocalAttachmentUrl } from '../../util/getLocalAttachmentUrl'; @@ -4121,11 +4122,17 @@ function saveAttachment( }; } -const showSaveMultiDialog = (): Promise<{ +const showSaveMultiDialog = ( + i18n: LocalizerType +): Promise<{ canceled: boolean; dirPath?: string; }> => { - return ipcRenderer.invoke('show-open-folder-dialog', { useMainWindow: true }); + return ipcRenderer.invoke('show-open-folder-dialog', { + useMainWindow: true, + title: i18n('icu:SaveMultiDialog__title'), + buttonLabel: i18n('icu:save'), + }); }; export type SaveAttachmentsActionCreatorType = ReadonlyDeep< @@ -4140,7 +4147,7 @@ function saveAttachments( attachments: ReadonlyArray, timestamp = Date.now() ): ThunkAction { - return async dispatch => { + return async (dispatch, getState) => { // check if any of the attachments could be dangerous for (const attachment of attachments) { const { fileName = '' } = attachment; @@ -4157,7 +4164,9 @@ function saveAttachments( } } - const { canceled, dirPath } = await showSaveMultiDialog(); + const { canceled, dirPath } = await showSaveMultiDialog( + getIntl(getState()) + ); if (canceled || !dirPath) { return; }