From b3bfa5101b14fd3351d470ee401a22642e664ff2 Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Wed, 24 Jul 2024 12:19:20 +0200 Subject: [PATCH] Sprinkle in some, you guessed it: Localization (IOS-241) --- Localization/StringsConvertor/input/Base.lproj/app.json | 6 ++++-- Localization/app.json | 6 ++++-- .../Cell/NotificationFilteringBannerTableViewCell.swift | 2 +- .../AccountNotificationTimelineViewController.swift | 5 +++-- .../Requests/NotificationRequestTableViewCell.swift | 6 ++---- .../NotificationRequestsTableViewController.swift | 2 +- .../Sources/MastodonLocalization/Generated/Strings.swift | 8 ++++++-- .../Resources/Base.lproj/Localizable.strings | 4 +++- 8 files changed, 24 insertions(+), 15 deletions(-) diff --git a/Localization/StringsConvertor/input/Base.lproj/app.json b/Localization/StringsConvertor/input/Base.lproj/app.json index d328f00a69..a799483709 100644 --- a/Localization/StringsConvertor/input/Base.lproj/app.json +++ b/Localization/StringsConvertor/input/Base.lproj/app.json @@ -753,8 +753,10 @@ "suspend": "Your account has been suspended.", "learn_more": "Learn More" }, - "filtered_notification_banner": { - "title": "Filtered Notifications" + "filtered_notification": { + "title": "Filtered Notifications", + "accept": "Accept", + "dismiss": "Dismiss", }, "policy": { "title": "Filter Notifications from…", diff --git a/Localization/app.json b/Localization/app.json index d328f00a69..a799483709 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -753,8 +753,10 @@ "suspend": "Your account has been suspended.", "learn_more": "Learn More" }, - "filtered_notification_banner": { - "title": "Filtered Notifications" + "filtered_notification": { + "title": "Filtered Notifications", + "accept": "Accept", + "dismiss": "Dismiss", }, "policy": { "title": "Filter Notifications from…", diff --git a/Mastodon/Scene/Notification/Cell/NotificationFilteringBannerTableViewCell.swift b/Mastodon/Scene/Notification/Cell/NotificationFilteringBannerTableViewCell.swift index e24ddd087b..7e65c0754a 100644 --- a/Mastodon/Scene/Notification/Cell/NotificationFilteringBannerTableViewCell.swift +++ b/Mastodon/Scene/Notification/Cell/NotificationFilteringBannerTableViewCell.swift @@ -30,7 +30,7 @@ class NotificationFilteringBannerTableViewCell: UITableViewCell { iconImageWrapperView.addSubview(iconImageView) titleLabel = UILabel() - titleLabel.text = L10n.Scene.Notification.FilteredNotificationBanner.title + titleLabel.text = L10n.Scene.Notification.FilteredNotification.title titleLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) subtitleLabel = UILabel() diff --git a/Mastodon/Scene/Notification/Notification Filtering/Requests/Account Notifications/AccountNotificationTimelineViewController.swift b/Mastodon/Scene/Notification/Notification Filtering/Requests/Account Notifications/AccountNotificationTimelineViewController.swift index 0118c25e29..dc0f946b5e 100644 --- a/Mastodon/Scene/Notification/Notification Filtering/Requests/Account Notifications/AccountNotificationTimelineViewController.swift +++ b/Mastodon/Scene/Notification/Notification Filtering/Requests/Account Notifications/AccountNotificationTimelineViewController.swift @@ -3,6 +3,7 @@ import UIKit import MastodonCore import MastodonSDK +import MastodonLocalization protocol AccountNotificationTimelineViewControllerDelegate: AnyObject { func acceptRequest(_ viewController: AccountNotificationTimelineViewController, request: Mastodon.Entity.NotificationRequest, completion: @escaping (() -> Void)) @@ -29,7 +30,7 @@ class AccountNotificationTimelineViewController: NotificationTimelineViewControl //TODO: Localization func menu() -> UIMenu { let menu = UIMenu(children: [ - UIAction(title: "Accept", image: UIImage(systemName: "checkmark")) { [weak self] _ in + UIAction(title: L10n.Scene.Notification.FilteredNotification.accept, image: UIImage(systemName: "checkmark")) { [weak self] _ in guard let self else { return } coordinator.showLoading() @@ -38,7 +39,7 @@ class AccountNotificationTimelineViewController: NotificationTimelineViewControl } coordinator.hideLoading() }, - UIAction(title: "Dismiss", image: UIImage(systemName: "speaker.slash")) { [weak self] _ in + UIAction(title: L10n.Scene.Notification.FilteredNotification.dismiss, image: UIImage(systemName: "speaker.slash")) { [weak self] _ in guard let self else { return } coordinator.showLoading() diff --git a/Mastodon/Scene/Notification/Notification Filtering/Requests/NotificationRequestTableViewCell.swift b/Mastodon/Scene/Notification/Notification Filtering/Requests/NotificationRequestTableViewCell.swift index 95b23e5066..ef60a00a21 100644 --- a/Mastodon/Scene/Notification/Notification Filtering/Requests/NotificationRequestTableViewCell.swift +++ b/Mastodon/Scene/Notification/Notification Filtering/Requests/NotificationRequestTableViewCell.swift @@ -57,8 +57,7 @@ class NotificationRequestTableViewCell: UITableViewCell { acceptNotificationRequestButton.translatesAutoresizingMaskIntoConstraints = false acceptNotificationRequestButton.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .semibold) acceptNotificationRequestButton.setTitleColor(.white, for: .normal) - //TODO: Localization - acceptNotificationRequestButton.setTitle("Accept", for: .normal) + acceptNotificationRequestButton.setTitle(L10n.Scene.Notification.FilteredNotification.accept, for: .normal) acceptNotificationRequestButton.setImage(UIImage(systemName: "checkmark"), for: .normal) acceptNotificationRequestButton.imageView?.contentMode = .scaleAspectFit acceptNotificationRequestButton.setBackgroundImage(.placeholder(color: Asset.Scene.Notification.confirmFollowRequestButtonBackground.color), for: .normal) @@ -83,8 +82,7 @@ class NotificationRequestTableViewCell: UITableViewCell { rejectNotificationRequestButton.translatesAutoresizingMaskIntoConstraints = false rejectNotificationRequestButton.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .semibold) rejectNotificationRequestButton.setTitleColor(.black, for: .normal) - //TODO: Localization - rejectNotificationRequestButton.setTitle("Dismiss", for: .normal) + rejectNotificationRequestButton.setTitle(L10n.Scene.Notification.FilteredNotification.dismiss, for: .normal) rejectNotificationRequestButton.setImage(UIImage(systemName: "speaker.slash"), for: .normal) rejectNotificationRequestButton.imageView?.contentMode = .scaleAspectFit rejectNotificationRequestButton.setInsets(forContentPadding: UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8), imageTitlePadding: 8) diff --git a/Mastodon/Scene/Notification/Notification Filtering/Requests/NotificationRequestsTableViewController.swift b/Mastodon/Scene/Notification/Notification Filtering/Requests/NotificationRequestsTableViewController.swift index 597535aeb0..edb8940c38 100644 --- a/Mastodon/Scene/Notification/Notification Filtering/Requests/NotificationRequestsTableViewController.swift +++ b/Mastodon/Scene/Notification/Notification Filtering/Requests/NotificationRequestsTableViewController.swift @@ -59,7 +59,7 @@ class NotificationRequestsTableViewController: UIViewController, NeedsDependency tableView.delegate = self self.dataSource = dataSource - title = L10n.Scene.Notification.FilteredNotificationBanner.title + title = L10n.Scene.Notification.FilteredNotification.title } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } diff --git a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift index 509431c5f7..ef5edbfdb2 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift +++ b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift @@ -895,9 +895,13 @@ public enum L10n { } } public enum Notification { - public enum FilteredNotificationBanner { + public enum FilteredNotification { + /// Accept + public static let accept = L10n.tr("Localizable", "Scene.Notification.FilteredNotification.Accept", fallback: "Accept") + /// Dismiss + public static let dismiss = L10n.tr("Localizable", "Scene.Notification.FilteredNotification.Dismiss", fallback: "Dismiss") /// Filtered Notifications - public static let title = L10n.tr("Localizable", "Scene.Notification.FilteredNotificationBanner.Title", fallback: "Filtered Notifications") + public static let title = L10n.tr("Localizable", "Scene.Notification.FilteredNotification.Title", fallback: "Filtered Notifications") } public enum FollowRequest { /// Accept diff --git a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings index 0c7b4bc42a..0e559e9395 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings +++ b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings @@ -316,7 +316,9 @@ uploaded to Mastodon."; "Scene.Login.ServerSearchField.Placeholder" = "Enter URL or search for your server"; "Scene.Login.Subtitle" = "Log in with the server where you created your account."; "Scene.Login.Title" = "Welcome Back"; -"Scene.Notification.FilteredNotificationBanner.Title" = "Filtered Notifications"; +"Scene.Notification.FilteredNotification.Accept" = "Accept"; +"Scene.Notification.FilteredNotification.Dismiss" = "Dismiss"; +"Scene.Notification.FilteredNotification.Title" = "Filtered Notifications"; "Scene.Notification.FollowRequest.Accept" = "Accept"; "Scene.Notification.FollowRequest.Accepted" = "Accepted"; "Scene.Notification.FollowRequest.Reject" = "reject";