From 43226075525b3ba49a7a12d5893893dc4c1f27ae Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Tue, 19 Dec 2023 13:12:32 +0100 Subject: [PATCH] Localize Domain Block (IOS-5) --- Localization/app.json | 11 ++++++++++- .../Provider/DataSourceFacade+Status.swift | 14 +++++++------- .../Generated/Strings.swift | 18 ++++++++++++++++++ .../Resources/Base.lproj/Localizable.strings | 7 ++++++- .../MastodonUI/View/Menu/MastodonMenu.swift | 5 ++--- .../ViewModel/RelationshipViewModel.swift | 2 +- 6 files changed, 44 insertions(+), 13 deletions(-) diff --git a/Localization/app.json b/Localization/app.json index 734169df0..9d8ce91b4 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -222,10 +222,11 @@ "pending": "Pending", "block": "Block", "block_user": "Block %s", - "block_domain": "Block %s", + "block_domain": "Block domain %s", "unblock": "Unblock", "unblock_user": "Unblock %s", "blocked": "Blocked", + "domain_blocked": "Domain Blocked", "mute": "Mute", "mute_user": "Mute %s", "unmute": "Unmute", @@ -603,6 +604,14 @@ "confirm_hide_reblogs": { "title": "Hide Reblogs", "message": "Confirm to hide reblogs" + }, + "confirm_block_domain": { + "title": "Block domain", + "message": "Confirm to block domain %s" + }, + "confirm_unblock_domain": { + "title": "Unblock domain", + "message": "Confirm to unblock domain %s" } }, "accessibility": { diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift index ee55de483..c324da73b 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift @@ -399,16 +399,16 @@ extension DataSourceFacade { let message: String let actionTitle: String - #warning("Localization") if context.isBlocking { - title = "Unblock \(context.domain)" - message = "Really unblock \(context.domain)" - actionTitle = L10n.Common.Controls.Friendship.unblockUser(context.domain) + title = L10n.Scene.Profile.RelationshipActionAlert.ConfirmUnblockDomain.title + message = L10n.Scene.Profile.RelationshipActionAlert.ConfirmUnblockDomain.message(context.domain) + actionTitle = L10n.Common.Controls.Friendship.unblockDomain(context.domain) } else { - title = "Block \(context.domain)" - message = "Really block \(context.domain)" - actionTitle = L10n.Common.Controls.Friendship.blockUser(context.domain) + title = L10n.Scene.Profile.RelationshipActionAlert.ConfirmBlockDomain.title + message = L10n.Common.Alerts.BlockDomain.title(context.domain) + actionTitle = L10n.Common.Alerts.BlockDomain.blockEntireDomain } + let alertController = UIAlertController( title: title, message: message, diff --git a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift index 99c061f91..fae0ddc50 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift +++ b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift @@ -216,6 +216,8 @@ public enum L10n { public static func blockUser(_ p1: Any) -> String { return L10n.tr("Localizable", "Common.Controls.Friendship.BlockUser", String(describing: p1), fallback: "Block %@") } + /// Domain Blocked + public static let domainBlocked = L10n.tr("Localizable", "Common.Controls.Friendship.DomainBlocked", fallback: "Domain Blocked") /// Edit Info public static let editInfo = L10n.tr("Localizable", "Common.Controls.Friendship.EditInfo", fallback: "Edit Info") /// Follow @@ -241,6 +243,10 @@ public enum L10n { /// Unblock public static let unblock = L10n.tr("Localizable", "Common.Controls.Friendship.Unblock", fallback: "Unblock") /// Unblock %@ + public static func unblockDomain(_ p1: Any) -> String { + return L10n.tr("Localizable", "Common.Controls.Friendship.UnblockDomain", String(describing: p1), fallback: "Unblock %@") + } + /// Unblock %@ public static func unblockUser(_ p1: Any) -> String { return L10n.tr("Localizable", "Common.Controls.Friendship.UnblockUser", String(describing: p1), fallback: "Unblock %@") } @@ -953,6 +959,10 @@ public enum L10n { public static let followsYou = L10n.tr("Localizable", "Scene.Profile.Header.FollowsYou", fallback: "Follows You") } public enum RelationshipActionAlert { + public enum ConfirmBlockDomain { + /// Block Domain + public static let title = L10n.tr("Localizable", "Scene.Profile.RelationshipActionAlert.ConfirmBlockDomain.Title", fallback: "Block Domain") + } public enum ConfirmBlockUser { /// Confirm to block %@ public static func message(_ p1: Any) -> String { @@ -981,6 +991,14 @@ public enum L10n { /// Show Reblogs public static let title = L10n.tr("Localizable", "Scene.Profile.RelationshipActionAlert.ConfirmShowReblogs.Title", fallback: "Show Reblogs") } + public enum ConfirmUnblockDomain { + /// Confirm to unblock domain %@ + public static func message(_ p1: Any) -> String { + return L10n.tr("Localizable", "Scene.Profile.RelationshipActionAlert.ConfirmUnblockDomain.Message", String(describing: p1), fallback: "Confirm to unblock domain %@") + } + /// Unblock Domain + public static let title = L10n.tr("Localizable", "Scene.Profile.RelationshipActionAlert.ConfirmUnblockDomain.Title", fallback: "Unblock Domain") + } public enum ConfirmUnblockUser { /// Confirm to unblock %@ public static func message(_ p1: Any) -> String { diff --git a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings index 2faf5ebb7..bd1bfc949 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings +++ b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings @@ -73,6 +73,7 @@ Please check your internet connection."; "Common.Controls.Friendship.BlockDomain" = "Block %@"; "Common.Controls.Friendship.BlockUser" = "Block %@"; "Common.Controls.Friendship.Blocked" = "Blocked"; +"Common.Controls.Friendship.DomainBlocked" = "Domain Blocked"; "Common.Controls.Friendship.EditInfo" = "Edit Info"; "Common.Controls.Friendship.Follow" = "Follow"; "Common.Controls.Friendship.Following" = "Following"; @@ -85,6 +86,7 @@ Please check your internet connection."; "Common.Controls.Friendship.ShowReblogs" = "Show Reblogs"; "Common.Controls.Friendship.Unblock" = "Unblock"; "Common.Controls.Friendship.UnblockUser" = "Unblock %@"; +"Common.Controls.Friendship.UnblockDomain" = "Unblock %@"; "Common.Controls.Friendship.Unmute" = "Unmute"; "Common.Controls.Friendship.UnmuteUser" = "Unmute %@"; "Common.Controls.Keyboard.Common.ComposeNewPost" = "Compose New Post"; @@ -336,6 +338,9 @@ uploaded to Mastodon."; "Scene.Profile.Header.FollowsYou" = "Follows You"; "Scene.Profile.RelationshipActionAlert.ConfirmBlockUser.Message" = "Confirm to block %@"; "Scene.Profile.RelationshipActionAlert.ConfirmBlockUser.Title" = "Block Account"; +"Scene.Profile.RelationshipActionAlert.ConfirmBlockDomain.Title" = "Block Domain"; +"Scene.Profile.RelationshipActionAlert.ConfirmUnblockDomain.Message" = "Confirm to unblock domain %@"; +"Scene.Profile.RelationshipActionAlert.ConfirmUnblockDomain.Title" = "Unblock Domain"; "Scene.Profile.RelationshipActionAlert.ConfirmHideReblogs.Message" = "Confirm to hide reblogs"; "Scene.Profile.RelationshipActionAlert.ConfirmHideReblogs.Title" = "Hide Reblogs"; "Scene.Profile.RelationshipActionAlert.ConfirmMuteUser.Message" = "Confirm to mute %@"; @@ -563,4 +568,4 @@ uploaded to Mastodon."; "Widget.MultipleFollowers.ConfigurationDescription" = "Show number of followers for multiple accounts."; "Widget.MultipleFollowers.ConfigurationDisplayName" = "Multiple followers"; "Widget.MultipleFollowers.MockUser.AccountName" = "another@follower.social"; -"Widget.MultipleFollowers.MockUser.DisplayName" = "Another follower"; \ No newline at end of file +"Widget.MultipleFollowers.MockUser.DisplayName" = "Another follower"; diff --git a/MastodonSDK/Sources/MastodonUI/View/Menu/MastodonMenu.swift b/MastodonSDK/Sources/MastodonUI/View/Menu/MastodonMenu.swift index 08085d561..72f2877a9 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Menu/MastodonMenu.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Menu/MastodonMenu.swift @@ -202,12 +202,11 @@ extension MastodonMenu { case .blockDomain(let context): let title: String let image: UIImage? - //TODO: Add localization if context.isBlocking { - title = "Unblock \(context.domain)" + title = L10n.Common.Controls.Actions.unblockDomain(context.domain) image = UIImage(systemName: "hand.raised.slash.fill") } else { - title = "Block \(context.domain)" + title = L10n.Common.Controls.Actions.blockDomain(context.domain) image = UIImage(systemName: "hand.raised.fill") } let action = LabeledAction(title: title, image: image) { [weak delegate] in diff --git a/MastodonSDK/Sources/MastodonUI/ViewModel/RelationshipViewModel.swift b/MastodonSDK/Sources/MastodonUI/ViewModel/RelationshipViewModel.swift index e0c7060d1..b8a579199 100644 --- a/MastodonSDK/Sources/MastodonUI/ViewModel/RelationshipViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/ViewModel/RelationshipViewModel.swift @@ -94,7 +94,7 @@ public struct RelationshipActionOptionSet: OptionSet { case .editing: return L10n.Common.Controls.Actions.done case .updating: return " " case .showReblogs: return " " - case .domainBlocking: return "Unblock domain" + case .domainBlocking: return L10n.Common.Controls.Friendship.domainBlocked } } }