From 9a365703c5dd97739fca3b4ba79bbb320f5fe740 Mon Sep 17 00:00:00 2001 From: Davide Date: Wed, 30 Oct 2024 15:20:18 +0100 Subject: [PATCH] Refactor Theme strings Fixes #784 --- .../Sources/AppUI/L10n/SwiftGen+Strings.swift | 10 ++++++---- .../AppUI/Resources/en.lproj/Localizable.strings | 13 +++++++------ .../Library/Sources/AppUI/Theme/Theme+UI.swift | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Passepartout/Library/Sources/AppUI/L10n/SwiftGen+Strings.swift b/Passepartout/Library/Sources/AppUI/L10n/SwiftGen+Strings.swift index 96b1707e..2e2b6e34 100644 --- a/Passepartout/Library/Sources/AppUI/L10n/SwiftGen+Strings.swift +++ b/Passepartout/Library/Sources/AppUI/L10n/SwiftGen+Strings.swift @@ -510,11 +510,17 @@ public enum Strings { } public enum Theme { public enum Confirmation { + /// Cancel + public static let cancel = Strings.tr("Localizable", "theme.confirmation.cancel", fallback: "Cancel") /// Are you sure you want to proceed with this operation? public static let message = Strings.tr("Localizable", "theme.confirmation.message", fallback: "Are you sure you want to proceed with this operation?") /// Confirm public static let ok = Strings.tr("Localizable", "theme.confirmation.ok", fallback: "Confirm") } + public enum LockScreen { + /// Passepartout is locked + public static let reason = Strings.tr("Localizable", "theme.lock_screen.reason", fallback: "Passepartout is locked") + } } public enum Ui { public enum ConnectionStatus { @@ -663,10 +669,6 @@ public enum Strings { public static let keepsInMenu = Strings.tr("Localizable", "views.settings.rows.keeps_in_menu", fallback: "Keep in menu bar") /// Lock in background public static let locksInBackground = Strings.tr("Localizable", "views.settings.rows.locks_in_background", fallback: "Lock in background") - public enum LocksInBackground { - /// Passepartout is locked - public static let message = Strings.tr("Localizable", "views.settings.rows.locks_in_background.message", fallback: "Passepartout is locked") - } } public enum Sections { public enum Icloud { diff --git a/Passepartout/Library/Sources/AppUI/Resources/en.lproj/Localizable.strings b/Passepartout/Library/Sources/AppUI/Resources/en.lproj/Localizable.strings index 29ba54d6..5e8cd52e 100644 --- a/Passepartout/Library/Sources/AppUI/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Library/Sources/AppUI/Resources/en.lproj/Localizable.strings @@ -112,11 +112,6 @@ "placeholders.username" = "username"; "placeholders.secret" = "secret"; -// MARK: - Theme - -"theme.confirmation.ok" = "Confirm"; -"theme.confirmation.message" = "Are you sure you want to proceed with this operation?"; - // MARK: - Views "views.profiles.rows.not_installed" = "Select a profile"; @@ -137,7 +132,6 @@ "views.settings.sections.icloud.footer" = "To erase the iCloud store securely, do so on all your synced devices. This will not affect local profiles."; "views.settings.rows.keeps_in_menu" = "Keep in menu bar"; "views.settings.rows.locks_in_background" = "Lock in background"; -"views.settings.rows.locks_in_background.message" = "Passepartout is locked"; "views.settings.rows.erase_icloud" = "Erase iCloud store"; "views.about.title" = "About"; @@ -241,6 +235,13 @@ "app_menu.items.launch_on_login" = "Launch on Login"; "app_menu.items.quit" = "Quit %@"; +// MARK: - Theme + +"theme.confirmation.ok" = "Confirm"; +"theme.confirmation.cancel" = "Cancel"; +"theme.confirmation.message" = "Are you sure you want to proceed with this operation?"; +"theme.lock_screen.reason" = "Passepartout is locked"; + // MARK: - Components "ui.connection_status.on_demand_suffix" = " (on-demand)"; diff --git a/Passepartout/Library/Sources/AppUI/Theme/Theme+UI.swift b/Passepartout/Library/Sources/AppUI/Theme/Theme+UI.swift index 3d137fd2..a5cad484 100644 --- a/Passepartout/Library/Sources/AppUI/Theme/Theme+UI.swift +++ b/Passepartout/Library/Sources/AppUI/Theme/Theme+UI.swift @@ -156,7 +156,7 @@ struct ThemeConfirmationModifier: ViewModifier { content .confirmationDialog(title, isPresented: $isPresented, titleVisibility: .visible) { Button(Strings.Theme.Confirmation.ok, role: isDestructive ? .destructive : nil, action: action) - Text(Strings.Global.cancel) + Text(Strings.Theme.Confirmation.cancel) } message: { Text(Strings.Theme.Confirmation.message) } @@ -349,7 +349,7 @@ struct ThemeLockScreenModifier: ViewModifier { do { let isAuthorized = try await context.evaluatePolicy( policy, - localizedReason: Strings.Views.Settings.Rows.LocksInBackground.message + localizedReason: Strings.Theme.LockScreen.reason ) return isAuthorized } catch {