From 20813ac77eb3e68a1fd40fb0fd8d7cf61a7c3358 Mon Sep 17 00:00:00 2001 From: Davide Date: Sun, 17 Nov 2024 18:48:29 +0100 Subject: [PATCH] Parametrize app name in strings --- .../Views/Migration/MigrateContentView+List.swift | 2 +- .../Views/Migration/MigrateContentView+Table.swift | 2 +- .../Sources/UILibrary/L10n/SwiftGen+Strings.swift | 12 ++++++++---- .../UILibrary/Resources/en.lproj/Localizable.strings | 4 ++-- .../Sources/UILibrary/Theme/UI/Theme+Modifiers.swift | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateContentView+List.swift b/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateContentView+List.swift index 33961b9ef..84bef0b43 100644 --- a/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateContentView+List.swift +++ b/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateContentView+List.swift @@ -67,7 +67,7 @@ private extension MigrateContentView.ListView { } var messageView: some View { - Text(Strings.Views.Migrate.Sections.Main.header) + Text(Strings.Views.Migrate.Sections.Main.header(Strings.Unlocalized.appName)) .padding([.top, .leading, .trailing]) } diff --git a/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateContentView+Table.swift b/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateContentView+Table.swift index 0d5793f45..30a70499b 100644 --- a/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateContentView+Table.swift +++ b/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateContentView+Table.swift @@ -61,7 +61,7 @@ private extension MigrateContentView.TableView { } var messageView: some View { - Text(Strings.Views.Migrate.Sections.Main.header) + Text(Strings.Views.Migrate.Sections.Main.header(Strings.Unlocalized.appName)) .padding([.top, .leading, .trailing]) } diff --git a/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift b/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift index 1dd8b4055..0a895e0ef 100644 --- a/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift +++ b/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift @@ -612,8 +612,10 @@ public enum Strings { 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") + /// %@ is locked + public static func reason(_ p1: Any) -> String { + return Strings.tr("Localizable", "theme.lock_screen.reason", String(describing: p1), fallback: "%@ is locked") + } } } public enum Ui { @@ -744,8 +746,10 @@ public enum Strings { } public enum Sections { public enum Main { - /// Select below the profiles from old versions of Passepartout that you want to import. In case your profiles are stored on iCloud, they may take a while to synchronize. If you do not see them now, please come back later. - public static let header = Strings.tr("Localizable", "views.migrate.sections.main.header", fallback: "Select below the profiles from old versions of Passepartout that you want to import. In case your profiles are stored on iCloud, they may take a while to synchronize. If you do not see them now, please come back later.") + /// Select below the profiles from old versions of %@ that you want to import. In case your profiles are stored on iCloud, they may take a while to synchronize. If you do not see them now, please come back later. + public static func header(_ p1: Any) -> String { + return Strings.tr("Localizable", "views.migrate.sections.main.header", String(describing: p1), fallback: "Select below the profiles from old versions of %@ that you want to import. In case your profiles are stored on iCloud, they may take a while to synchronize. If you do not see them now, please come back later.") + } } } } diff --git a/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings b/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings index 8f6794c2f..a61a333bf 100644 --- a/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings @@ -163,7 +163,7 @@ "views.migrate.no_profiles" = "Nothing to migrate"; "views.migrate.items.discard" = "Discard"; "views.migrate.items.migrate" = "Proceed"; -"views.migrate.sections.main.header" = "Select below the profiles from old versions of Passepartout that you want to import. In case your profiles are stored on iCloud, they may take a while to synchronize. If you do not see them now, please come back later."; +"views.migrate.sections.main.header" = "Select below the profiles from old versions of %@ that you want to import. In case your profiles are stored on iCloud, they may take a while to synchronize. If you do not see them now, please come back later."; "views.migrate.alerts.delete.message" = "Do you want to discard these profiles? You will not be able to recover them later.\n\n%@"; "views.donate.title" = "Make a donation"; @@ -258,7 +258,7 @@ "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"; +"theme.lock_screen.reason" = "%@ is locked"; // MARK: - Components diff --git a/Passepartout/Library/Sources/UILibrary/Theme/UI/Theme+Modifiers.swift b/Passepartout/Library/Sources/UILibrary/Theme/UI/Theme+Modifiers.swift index 8e07b9922..9ebfce503 100644 --- a/Passepartout/Library/Sources/UILibrary/Theme/UI/Theme+Modifiers.swift +++ b/Passepartout/Library/Sources/UILibrary/Theme/UI/Theme+Modifiers.swift @@ -586,7 +586,7 @@ struct ThemeLockScreenModifier: ViewModifier where LockedContent: do { let isAuthorized = try await context.evaluatePolicy( policy, - localizedReason: Strings.Theme.LockScreen.reason + localizedReason: Strings.Theme.LockScreen.reason(Strings.Unlocalized.appName) ) return isAuthorized } catch {