From b77d07e0676337203c8dee47eed5153e543fbcbe Mon Sep 17 00:00:00 2001 From: Kaede Akino Date: Wed, 23 Sep 2026 19:14:38 +0800 Subject: [PATCH] Refine UI copywriting --- Frameworks/Resources/Localizable.xcstrings | 66 ++++++++++++------- .../HostEditor/MobileHostEditor.swift | 8 ++- .../KnownHosts/MobileKnownHostsView.swift | 4 +- .../Snippets/MobileSnippetsView.swift | 2 + TFI/Features/Vault/MobileVaultView.swift | 2 +- TFITests/MobileCardTests.swift | 4 +- .../KnownHosts/KnownHostsPageView.swift | 14 ++-- TFM/Features/Sidebar/WindowSidebarView.swift | 2 +- TFM/Features/Snippets/SnippetsPageView.swift | 6 +- TFM/UI/Components/WindowToolbar.swift | 2 +- 10 files changed, 72 insertions(+), 38 deletions(-) diff --git a/Frameworks/Resources/Localizable.xcstrings b/Frameworks/Resources/Localizable.xcstrings index 9577acd9..8fbb6f91 100644 --- a/Frameworks/Resources/Localizable.xcstrings +++ b/Frameworks/Resources/Localizable.xcstrings @@ -2892,18 +2892,18 @@ } } }, - "Add Host Key" : { + "Add Known Host" : { "localizations" : { "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "添加主机密钥" + "value" : "添加已知主机" } }, "zh-Hant" : { "stringUnit" : { "state" : "translated", - "value" : "新增主機金鑰" + "value" : "新增已知主機" } } } @@ -8322,6 +8322,22 @@ } } }, + "Delete %lld Known Hosts?" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "删除%lld个已知主机?" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "刪除%lld個已知主機?" + } + } + } + }, "Delete %lld Snippets" : { "extractionState" : "stale", "localizations" : { @@ -8506,22 +8522,6 @@ } } }, - "Delete Host Keys?" : { - "localizations" : { - "zh-Hans" : { - "stringUnit" : { - "state" : "translated", - "value" : "删除主机密钥?" - } - }, - "zh-Hant" : { - "stringUnit" : { - "state" : "translated", - "value" : "刪除主機金鑰?" - } - } - } - }, "Delete Host?" : { "extractionState" : "manual", "localizations" : { @@ -10237,18 +10237,18 @@ } } }, - "Edit Host Key" : { + "Edit Known Host" : { "localizations" : { "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "编辑主机密钥" + "value" : "编辑已知主机" } }, "zh-Hant" : { "stringUnit" : { "state" : "translated", - "value" : "編輯主機金鑰" + "value" : "編輯已知主機" } } } @@ -29027,18 +29027,34 @@ } } }, - "This permanently removes all connection history without deleting any Hosts." : { + "This action cannot be undone." : { "localizations" : { "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "这将永久清除所有连接历史,但不会删除任何主机。" + "value" : "此操作无法撤销。" } }, "zh-Hant" : { "stringUnit" : { "state" : "translated", - "value" : "這將永久清除所有連線歷史,但不會刪除任何主機。" + "value" : "此操作無法復原。" + } + } + } + }, + "This permanently removes all connection history." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "这将永久清除所有连接历史。" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "這將永久清除所有連線歷史。" } } } diff --git a/TFI/Features/HostEditor/MobileHostEditor.swift b/TFI/Features/HostEditor/MobileHostEditor.swift index f46c651d..2f98c761 100644 --- a/TFI/Features/HostEditor/MobileHostEditor.swift +++ b/TFI/Features/HostEditor/MobileHostEditor.swift @@ -40,9 +40,15 @@ struct MobileHostEditor: View { _selectedProtocol = State(initialValue: host.sshEnabled ? .ssh : .telnet) } + var editorTitle: String { + app.library.host(original.id) == nil + ? String(localized: "Add Host") + : String(localized: "Edit Host") + } + var body: some View { MobileEditorSheet( - title: String(localized: "Host"), + title: editorTitle, isDirty: draft != original || !customIdentity.sshUsername.isEmpty || !customIdentity.sshPassword.isEmpty || customIdentity.sshKeyID != nil || !customIdentity.telnetUsername.isEmpty || !customIdentity.telnetPassword.isEmpty diff --git a/TFI/Features/KnownHosts/MobileKnownHostsView.swift b/TFI/Features/KnownHosts/MobileKnownHostsView.swift index 390135ce..b1fe9f4a 100644 --- a/TFI/Features/KnownHosts/MobileKnownHostsView.swift +++ b/TFI/Features/KnownHosts/MobileKnownHostsView.swift @@ -66,7 +66,7 @@ struct MobileKnownHostsView: View { .navigationTitle("Known Hosts") .toolbar { ToolbarItem(placement: .primaryAction) { - Button("Add Host Key", systemImage: "plus") { + Button("Add Known Host", systemImage: "plus") { editing = KnownHostEntry(hostname: "") } } @@ -100,7 +100,7 @@ struct MobileKnownHostEditor: View { } var editorTitle: String { - isNew ? String(localized: "Add Host Key") : String(localized: "Edit Host Key") + isNew ? String(localized: "Add Known Host") : String(localized: "Edit Known Host") } var body: some View { diff --git a/TFI/Features/Snippets/MobileSnippetsView.swift b/TFI/Features/Snippets/MobileSnippetsView.swift index cbff024e..0474fc2e 100644 --- a/TFI/Features/Snippets/MobileSnippetsView.swift +++ b/TFI/Features/Snippets/MobileSnippetsView.swift @@ -135,6 +135,8 @@ struct MobileSnippetsView: View { ) { Button("Delete Snippet", role: .destructive, action: deleteSnippet) Button("Cancel", role: .cancel) { deletingSnippetID = nil } + } message: { + Text("This action cannot be undone.") } .confirmationDialog( packageDeletionTitle, diff --git a/TFI/Features/Vault/MobileVaultView.swift b/TFI/Features/Vault/MobileVaultView.swift index 28b9214d..e89937b8 100644 --- a/TFI/Features/Vault/MobileVaultView.swift +++ b/TFI/Features/Vault/MobileVaultView.swift @@ -122,7 +122,7 @@ struct MobileConnectionHistoryView: View { } Button("Cancel", role: .cancel) {} } message: { - Text("This permanently removes all connection history without deleting any Hosts.") + Text("This permanently removes all connection history.") } } diff --git a/TFITests/MobileCardTests.swift b/TFITests/MobileCardTests.swift index 9440f667..82831018 100644 --- a/TFITests/MobileCardTests.swift +++ b/TFITests/MobileCardTests.swift @@ -105,9 +105,9 @@ struct MobileCardTests { let edit = MobileKnownHostEditor(app: app, entry: saved) #expect(add.isNew) - #expect(add.editorTitle == String(localized: "Add Host Key")) + #expect(add.editorTitle == String(localized: "Add Known Host")) #expect(!edit.isNew) - #expect(edit.editorTitle == String(localized: "Edit Host Key")) + #expect(edit.editorTitle == String(localized: "Edit Known Host")) } @Test func hostSectionsFoldNestedGroupsKeepEmptyGroupsAndLeaveSearchAvailable() throws { diff --git a/TFM/Features/KnownHosts/KnownHostsPageView.swift b/TFM/Features/KnownHosts/KnownHostsPageView.swift index 48a421ed..95fd0f50 100644 --- a/TFM/Features/KnownHosts/KnownHostsPageView.swift +++ b/TFM/Features/KnownHosts/KnownHostsPageView.swift @@ -76,14 +76,14 @@ struct KnownHostsPageView: ManagedCardPage { Text("Import trusted server keys or add a fingerprint manually.") } actions: { Button("Import Known Hosts") { window.openVaultWork(.sshImport(knownHostsOnly: true), on: .knownHosts) } - Button("Add Host Key") { window.openVaultWork(.knownHostEditor(nil), on: .knownHosts) } + Button("Add Known Host") { window.openVaultWork(.knownHostEditor(nil), on: .knownHosts) } } } func managedNoResultsState() -> some View { ContentUnavailableView.search(text: state.query) } var managedPresentation: ManagedCardDeletionPresentation { ManagedCardDeletionPresentation( deleting: $state.deleting, error: $state.error, ids: app.knownHosts.entries.map(\.id), - confirmationTitle: "Delete Host Keys?", errorTitle: "Known Hosts Operation Failed", + confirmationTitle: deletionTitle, errorTitle: "Known Hosts Operation Failed", explanation: Text("The next connection will ask you to verify the server key again."), prune: { window.pruneVaultSelections(in: app.hostLibrary) }, delete: { @@ -93,6 +93,12 @@ struct KnownHostsPageView: ManagedCardPage { }) } + private var deletionTitle: LocalizedStringKey { + state.deleting.count == 1 + ? "Delete Known Host?" + : "Delete \(state.deleting.count) Known Hosts?" + } + private func select(_ entry: KnownHostEntry, action: @escaping () -> Void) { guard let route = window.vaultWorkRoute, case .knownHostEditor(let editingID) = route else { action() @@ -182,7 +188,7 @@ struct KnownHostEditorView: View { var body: some View { VaultDetailScaffold( - title: entryID == nil ? "Add Host Key" : "Edit Host Key", symbol: "touchid", + title: entryID == nil ? "Add Known Host" : "Edit Known Host", symbol: "touchid", close: cancelEditing, closeLabel: "Cancel" ) { Form { @@ -234,7 +240,7 @@ struct KnownHostEditorView: View { guard let editingToken else { return } editingSession.unregister(editingToken) } - .confirmationDialog("Delete Host Keys?", isPresented: $confirmsDeletion, titleVisibility: .visible) { + .confirmationDialog("Delete Known Host?", isPresented: $confirmsDeletion, titleVisibility: .visible) { Button("Delete", role: .destructive, action: delete) Button("Cancel", role: .cancel) {} } message: { diff --git a/TFM/Features/Sidebar/WindowSidebarView.swift b/TFM/Features/Sidebar/WindowSidebarView.swift index 6d276c09..1217b183 100644 --- a/TFM/Features/Sidebar/WindowSidebarView.swift +++ b/TFM/Features/Sidebar/WindowSidebarView.swift @@ -1261,7 +1261,7 @@ private struct ConnectionHistorySidebar: View { } Button("Cancel", role: .cancel) {} } message: { - Text("This permanently removes all connection history without deleting any Hosts.") + Text("This permanently removes all connection history.") } } diff --git a/TFM/Features/Snippets/SnippetsPageView.swift b/TFM/Features/Snippets/SnippetsPageView.swift index a16b94d9..536431ee 100644 --- a/TFM/Features/Snippets/SnippetsPageView.swift +++ b/TFM/Features/Snippets/SnippetsPageView.swift @@ -428,7 +428,9 @@ struct SnippetsPagePresentation: ManagedCardPresentationModifier { : Text("This package tree contains \(count) snippets.") case .executeDestructive(let batch): return Text(actions.executionMessage(batch.snippets)) - case .deleteSnippets, nil: + case .deleteSnippets: + return Text("This action cannot be undone.") + case nil: return Text("") } } @@ -605,6 +607,8 @@ struct SnippetEditorSheet: View { .confirmationDialog("Delete Snippet?", isPresented: $confirmsDeletion, titleVisibility: .visible) { Button("Delete Snippet", role: .destructive, action: delete) Button("Cancel", role: .cancel) {} + } message: { + Text("This action cannot be undone.") } } diff --git a/TFM/UI/Components/WindowToolbar.swift b/TFM/UI/Components/WindowToolbar.swift index 224ff5cb..9efde920 100644 --- a/TFM/UI/Components/WindowToolbar.swift +++ b/TFM/UI/Components/WindowToolbar.swift @@ -781,7 +781,7 @@ extension WindowModel { ] case .knownHosts: return [ - WindowToolbarCreationAction(id: "known-host", title: "Add Host Key", symbol: "plus") { + WindowToolbarCreationAction(id: "known-host", title: "Add Known Host", symbol: "plus") { self.openVaultWork(.knownHostEditor(nil), on: .knownHosts) }, WindowToolbarCreationAction(