From 9a0448f0a0dcf454574a68b5845ad8d0aa2f5a45 Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Thu, 9 May 2024 22:36:15 +0200 Subject: [PATCH] Add localization (IOS-264) --- .../StringsConvertor/input/Base.lproj/app.json | 9 +++++++++ Localization/app.json | 9 +++++++++ Mastodon.xcodeproj/project.pbxproj | 12 ++---------- .../Cell/AccountWarningNotificationCell.swift | 15 ++++++++------- .../Notification/NotificationItem.swift | 0 .../Notification/NotificationSection.swift | 0 .../MastodonLocalization/Generated/Strings.swift | 16 ++++++++++++++++ .../Resources/Base.lproj/Localizable.strings | 7 +++++++ 8 files changed, 51 insertions(+), 17 deletions(-) rename Mastodon/{Diffable => Scene}/Notification/NotificationItem.swift (100%) rename Mastodon/{Diffable => Scene}/Notification/NotificationSection.swift (100%) diff --git a/Localization/StringsConvertor/input/Base.lproj/app.json b/Localization/StringsConvertor/input/Base.lproj/app.json index c54b4f821..c67ac5a45 100644 --- a/Localization/StringsConvertor/input/Base.lproj/app.json +++ b/Localization/StringsConvertor/input/Base.lproj/app.json @@ -729,6 +729,15 @@ "accepted": "Accepted", "reject": "reject", "rejected": "Rejected" + }, + "warning": { + "none": "Your account has received a moderation warning.", + "disable": "Your account has been disabled.", + "mark_statuses_as_sensitive": "Some of your posts have been marked as sensitive.", + "delete_statuses": "Some of your posts have been removed.", + "sensitive": "Your posts will be marked as sensitive from now on.", + "silence": "Your account has been limited.", + "suspend": "Your account has been suspended." } }, "thread": { diff --git a/Localization/app.json b/Localization/app.json index c54b4f821..c67ac5a45 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -729,6 +729,15 @@ "accepted": "Accepted", "reject": "reject", "rejected": "Rejected" + }, + "warning": { + "none": "Your account has received a moderation warning.", + "disable": "Your account has been disabled.", + "mark_statuses_as_sensitive": "Some of your posts have been marked as sensitive.", + "delete_statuses": "Some of your posts have been removed.", + "sensitive": "Your posts will be marked as sensitive from now on.", + "silence": "Your account has been limited.", + "suspend": "Your account has been suspended." } }, "thread": { diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj index 9f08c1bd2..db1d5ebc9 100644 --- a/Mastodon.xcodeproj/project.pbxproj +++ b/Mastodon.xcodeproj/project.pbxproj @@ -1568,7 +1568,6 @@ DB0617F927855B460030EE79 /* Profile */, DB4F097926A039C400D62E92 /* Status */, DB65C63527A2AF52008BAC2E /* Report */, - DB0617F727855B010030EE79 /* Notification */, DB4F097726A039A200D62E92 /* Search */, ); path = Diffable; @@ -1924,15 +1923,6 @@ path = Onboarding; sourceTree = ""; }; - DB0617F727855B010030EE79 /* Notification */ = { - isa = PBXGroup; - children = ( - 2D35237926256D920031AF25 /* NotificationSection.swift */, - 2D7867182625B77500211898 /* NotificationItem.swift */, - ); - path = Notification; - sourceTree = ""; - }; DB0617F827855B170030EE79 /* User */ = { isa = PBXGroup; children = ( @@ -2657,6 +2647,8 @@ D80F627E2B5C32E400877059 /* NotificationView */, DB9D6BF725E4F5690051B173 /* NotificationViewController.swift */, 2D607AD726242FC500B70763 /* NotificationViewModel.swift */, + 2D35237926256D920031AF25 /* NotificationSection.swift */, + 2D7867182625B77500211898 /* NotificationItem.swift */, ); path = Notification; sourceTree = ""; diff --git a/Mastodon/Scene/Notification/Cell/AccountWarningNotificationCell.swift b/Mastodon/Scene/Notification/Cell/AccountWarningNotificationCell.swift index 384ef00fd..1d7ab0b60 100644 --- a/Mastodon/Scene/Notification/Cell/AccountWarningNotificationCell.swift +++ b/Mastodon/Scene/Notification/Cell/AccountWarningNotificationCell.swift @@ -3,6 +3,7 @@ import UIKit import MastodonSDK import MastodonAsset +import MastodonLocalization class AccountWarningNotificationCell: UITableViewCell { public static let reuseIdentifier = "AccountWarningNotificationCell" @@ -69,19 +70,19 @@ extension Mastodon.Entity.AccountWarning.Action { var description: String { switch self { case .none: - return "Your account has received a moderation warning." + return L10n.Scene.Notification.Warning.none case .disable: - return "Your account has been disabled." + return L10n.Scene.Notification.Warning.disable case .markStatusesAsSensitive: - return "Some of your posts have been marked as sensitive." + return L10n.Scene.Notification.Warning.markStatusesAsSensitive case .deleteStatuses: - return "Some of your posts have been removed." + return L10n.Scene.Notification.Warning.deleteStatuses case .sensitive: - return "Your posts will be marked as sensitive from now on." + return L10n.Scene.Notification.Warning.sensitive case .silence: - return "Your account has been limited." + return L10n.Scene.Notification.Warning.silence case .suspend: - return "Your account has been suspended." + return L10n.Scene.Notification.Warning.suspend } } } diff --git a/Mastodon/Diffable/Notification/NotificationItem.swift b/Mastodon/Scene/Notification/NotificationItem.swift similarity index 100% rename from Mastodon/Diffable/Notification/NotificationItem.swift rename to Mastodon/Scene/Notification/NotificationItem.swift diff --git a/Mastodon/Diffable/Notification/NotificationSection.swift b/Mastodon/Scene/Notification/NotificationSection.swift similarity index 100% rename from Mastodon/Diffable/Notification/NotificationSection.swift rename to Mastodon/Scene/Notification/NotificationSection.swift diff --git a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift index 877174a02..dbf90d2ab 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift +++ b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift @@ -909,6 +909,22 @@ public enum L10n { /// Mentions public static let mentions = L10n.tr("Localizable", "Scene.Notification.Title.Mentions", fallback: "Mentions") } + public enum Warning { + /// Some of your posts have been removed. + public static let deleteStatuses = L10n.tr("Localizable", "Scene.Notification.Warning.DeleteStatuses", fallback: "Some of your posts have been removed.") + /// Your account has been disabled. + public static let disable = L10n.tr("Localizable", "Scene.Notification.Warning.Disable", fallback: "Your account has been disabled.") + /// Some of your posts have been marked as sensitive. + public static let markStatusesAsSensitive = L10n.tr("Localizable", "Scene.Notification.Warning.MarkStatusesAsSensitive", fallback: "Some of your posts have been marked as sensitive.") + /// Your account has received a moderation warning. + public static let `none` = L10n.tr("Localizable", "Scene.Notification.Warning.None", fallback: "Your account has received a moderation warning.") + /// Your posts will be marked as sensitive from now on. + public static let sensitive = L10n.tr("Localizable", "Scene.Notification.Warning.Sensitive", fallback: "Your posts will be marked as sensitive from now on.") + /// Your account has been limited. + public static let silence = L10n.tr("Localizable", "Scene.Notification.Warning.Silence", fallback: "Your account has been limited.") + /// Your account has been suspended. + public static let suspend = L10n.tr("Localizable", "Scene.Notification.Warning.Suspend", fallback: "Your account has been suspended.") + } } public enum Preview { public enum Keyboard { diff --git a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings index cbc90e3fd..d104c223b 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings +++ b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings @@ -323,6 +323,13 @@ uploaded to Mastodon."; "Scene.Notification.NotificationDescription.RequestToFollowYou" = "request to follow you"; "Scene.Notification.Title.Everything" = "Everything"; "Scene.Notification.Title.Mentions" = "Mentions"; +"Scene.Notification.Warning.DeleteStatuses" = "Some of your posts have been removed."; +"Scene.Notification.Warning.Disable" = "Your account has been disabled."; +"Scene.Notification.Warning.MarkStatusesAsSensitive" = "Some of your posts have been marked as sensitive."; +"Scene.Notification.Warning.None" = "Your account has received a moderation warning."; +"Scene.Notification.Warning.Sensitive" = "Your posts will be marked as sensitive from now on."; +"Scene.Notification.Warning.Silence" = "Your account has been limited."; +"Scene.Notification.Warning.Suspend" = "Your account has been suspended."; "Scene.Preview.Keyboard.ClosePreview" = "Close Preview"; "Scene.Preview.Keyboard.ShowNext" = "Show Next"; "Scene.Preview.Keyboard.ShowPrevious" = "Show Previous";