Skip to content

Commit

Permalink
Sprinkle in some, you guessed it: Localization (IOS-241)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitschlag committed Jul 24, 2024
1 parent f3c035c commit b3bfa51
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 15 deletions.
6 changes: 4 additions & 2 deletions Localization/StringsConvertor/input/Base.lproj/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -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…",
Expand Down
6 changes: 4 additions & 2 deletions Localization/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -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…",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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()
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit b3bfa51

Please sign in to comment.