Localization (IOS-241)

This commit is contained in:
Nathan Mattes 2024-07-23 12:05:34 +02:00
parent 25f15d256e
commit 9e8de739ec
6 changed files with 101 additions and 24 deletions

View File

@ -477,7 +477,15 @@
"title": "Home", "title": "Home",
"timeline_menu": { "timeline_menu": {
"following": "Following", "following": "Following",
"local_community": "Local" "local_community": "Local",
"lists": {
"title": "Lists",
"empty_message": "You don't have any Lists"
},
"hashtags": {
"title": "Followed Hashtags",
"empty_message": "You don't follow any Hashtags"
}
}, },
"timeline_pill": { "timeline_pill": {
"offline": "Offline", "offline": "Offline",
@ -744,6 +752,25 @@
"silence": "Your account has been limited.", "silence": "Your account has been limited.",
"suspend": "Your account has been suspended.", "suspend": "Your account has been suspended.",
"learn_more": "Learn More" "learn_more": "Learn More"
},
"policy": {
"title": "Filter Notifications from…",
"not_following": {
"title": "People you don't follow",
"subtitle": "Until you manually approve them"
},
"no_follower": {
"title": "People not following you",
"subtitle": "Including people who have been following you fewer than 3 days"
},
"new_account": {
"title": "New accounts",
"subtitle": "Created within the past 30 days"
},
"private_mentions": {
"title": "Unsolicited private mentions",
"subtitle": "Filtered unless its in reply to your own mention or if you follow the sender"
}
} }
}, },
"thread": { "thread": {

View File

@ -752,6 +752,25 @@
"silence": "Your account has been limited.", "silence": "Your account has been limited.",
"suspend": "Your account has been suspended.", "suspend": "Your account has been suspended.",
"learn_more": "Learn More" "learn_more": "Learn More"
},
"policy": {
"title": "Filter Notifications from…",
"not_following": {
"title": "People you don't follow",
"subtitle": "Until you manually approve them"
},
"no_follower": {
"title": "People not following you",
"subtitle": "Including people who have been following you fewer than 3 days"
},
"new_account": {
"title": "New accounts",
"subtitle": "Created within the past 30 days"
},
"private_mentions": {
"title": "Unsolicited private mentions",
"subtitle": "Filtered unless its in reply to your own mention or if you follow the sender"
}
} }
}, },
"thread": { "thread": {

View File

@ -1,6 +1,7 @@
// Copyright © 2024 Mastodon gGmbH. All rights reserved. // Copyright © 2024 Mastodon gGmbH. All rights reserved.
import UIKit import UIKit
import MastodonLocalization
class NotificationPolicyHeaderView: UIView { class NotificationPolicyHeaderView: UIView {
let titleLabel: UILabel let titleLabel: UILabel
@ -11,8 +12,7 @@ class NotificationPolicyHeaderView: UIView {
titleLabel = UILabel() titleLabel = UILabel()
titleLabel.translatesAutoresizingMaskIntoConstraints = false titleLabel.translatesAutoresizingMaskIntoConstraints = false
titleLabel.font = UIFontMetrics(forTextStyle: .title3).scaledFont(for: .systemFont(ofSize: 20, weight: .bold)) titleLabel.font = UIFontMetrics(forTextStyle: .title3).scaledFont(for: .systemFont(ofSize: 20, weight: .bold))
// TODO: Localization titleLabel.text = L10n.Scene.Notification.Policy.title
titleLabel.text = "Filter Notifications from..."
let buttonImageConfiguration = UIImage let buttonImageConfiguration = UIImage

View File

@ -17,30 +17,28 @@ enum NotificationFilterItem: Hashable, CaseIterable {
case privateMentions case privateMentions
var title: String { var title: String {
// TODO: Localization
switch self { switch self {
case .notFollowing: case .notFollowing:
return "People you don't follow" return L10n.Scene.Notification.Policy.NotFollowing.title
case .noFollower: case .noFollower:
return "People not following you" return L10n.Scene.Notification.Policy.NoFollower.title
case .newAccount: case .newAccount:
return "New accounts" return L10n.Scene.Notification.Policy.NewAccount.title
case .privateMentions: case .privateMentions:
return "Unsolicited private mentions" return L10n.Scene.Notification.Policy.PrivateMentions.title
} }
} }
var subtitle: String { var subtitle: String {
// TODO: Localization
switch self { switch self {
case .notFollowing: case .notFollowing:
return "Until you manually approve them" return L10n.Scene.Notification.Policy.NotFollowing.subtitle
case .noFollower: case .noFollower:
return "Including people who have been following you fewer than 3 days" return L10n.Scene.Notification.Policy.NoFollower.subtitle
case .newAccount: case .newAccount:
return "Created within the past 30 days" return L10n.Scene.Notification.Policy.NewAccount.subtitle
case .privateMentions: case .privateMentions:
return "Filtered unless its in reply to your own mention or if you follow the sender" return L10n.Scene.Notification.Policy.PrivateMentions.subtitle
} }
} }
} }
@ -147,9 +145,6 @@ class NotificationPolicyViewController: UIViewController {
@objc private func save(_ sender: UIButton) { @objc private func save(_ sender: UIButton) {
guard let authenticationBox = viewModel.appContext.authenticationService.mastodonAuthenticationBoxes.first else { return } guard let authenticationBox = viewModel.appContext.authenticationService.mastodonAuthenticationBoxes.first else { return }
//TODO: Check if this really works. Garbage collection and stuff
self.dismiss(animated:true)
Task { [weak self] in Task { [weak self] in
guard let self else { return } guard let self else { return }
@ -166,11 +161,10 @@ class NotificationPolicyViewController: UIViewController {
NotificationCenter.default.post(name: .notificationFilteringChanged, object: nil) NotificationCenter.default.post(name: .notificationFilteringChanged, object: nil)
} catch { } catch {}
//TODO: Error Handling
}
} }
dismiss(animated:true)
} }
@objc private func cancel(_ sender: UIBarButtonItem) { @objc private func cancel(_ sender: UIBarButtonItem) {

View File

@ -925,6 +925,34 @@ public enum L10n {
/// request to follow you /// request to follow you
public static let requestToFollowYou = L10n.tr("Localizable", "Scene.Notification.NotificationDescription.RequestToFollowYou", fallback: "request to follow you") public static let requestToFollowYou = L10n.tr("Localizable", "Scene.Notification.NotificationDescription.RequestToFollowYou", fallback: "request to follow you")
} }
public enum Policy {
/// Filter Notifications from
public static let title = L10n.tr("Localizable", "Scene.Notification.Policy.Title", fallback: "Filter Notifications from…")
public enum NewAccount {
/// Created within the past 30 days
public static let subtitle = L10n.tr("Localizable", "Scene.Notification.Policy.NewAccount.Subtitle", fallback: "Created within the past 30 days")
/// New accounts
public static let title = L10n.tr("Localizable", "Scene.Notification.Policy.NewAccount.Title", fallback: "New accounts")
}
public enum NoFollower {
/// Including people who have been following you fewer than 3 days
public static let subtitle = L10n.tr("Localizable", "Scene.Notification.Policy.NoFollower.Subtitle", fallback: "Including people who have been following you fewer than 3 days")
/// People not following you
public static let title = L10n.tr("Localizable", "Scene.Notification.Policy.NoFollower.Title", fallback: "People not following you")
}
public enum NotFollowing {
/// Until you manually approve them
public static let subtitle = L10n.tr("Localizable", "Scene.Notification.Policy.NotFollowing.Subtitle", fallback: "Until you manually approve them")
/// People you don't follow
public static let title = L10n.tr("Localizable", "Scene.Notification.Policy.NotFollowing.Title", fallback: "People you don't follow")
}
public enum PrivateMentions {
/// Filtered unless its in reply to your own mention or if you follow the sender
public static let subtitle = L10n.tr("Localizable", "Scene.Notification.Policy.PrivateMentions.Subtitle", fallback: "Filtered unless its in reply to your own mention or if you follow the sender")
/// Unsolicited private mentions
public static let title = L10n.tr("Localizable", "Scene.Notification.Policy.PrivateMentions.Title", fallback: "Unsolicited private mentions")
}
}
public enum Title { public enum Title {
/// Everything /// Everything
public static let everything = L10n.tr("Localizable", "Scene.Notification.Title.Everything", fallback: "Everything") public static let everything = L10n.tr("Localizable", "Scene.Notification.Title.Everything", fallback: "Everything")

View File

@ -304,11 +304,11 @@ uploaded to Mastodon.";
"Scene.Following.Footer" = "Follows from other servers are not displayed."; "Scene.Following.Footer" = "Follows from other servers are not displayed.";
"Scene.Following.Title" = "following"; "Scene.Following.Title" = "following";
"Scene.HomeTimeline.TimelineMenu.Following" = "Following"; "Scene.HomeTimeline.TimelineMenu.Following" = "Following";
"Scene.HomeTimeline.TimelineMenu.LocalCommunity" = "Local";
"Scene.HomeTimeline.TimelineMenu.Lists.Title" = "Lists";
"Scene.HomeTimeline.TimelineMenu.Lists.EmptyMessage" = "You don't have any Lists";
"Scene.HomeTimeline.TimelineMenu.Hashtags.Title" = "Followed Hashtags";
"Scene.HomeTimeline.TimelineMenu.Hashtags.EmptyMessage" = "You don't follow any Hashtags"; "Scene.HomeTimeline.TimelineMenu.Hashtags.EmptyMessage" = "You don't follow any Hashtags";
"Scene.HomeTimeline.TimelineMenu.Hashtags.Title" = "Followed Hashtags";
"Scene.HomeTimeline.TimelineMenu.Lists.EmptyMessage" = "You don't have any Lists";
"Scene.HomeTimeline.TimelineMenu.Lists.Title" = "Lists";
"Scene.HomeTimeline.TimelineMenu.LocalCommunity" = "Local";
"Scene.HomeTimeline.TimelinePill.NewPosts" = "New Posts"; "Scene.HomeTimeline.TimelinePill.NewPosts" = "New Posts";
"Scene.HomeTimeline.TimelinePill.Offline" = "Offline"; "Scene.HomeTimeline.TimelinePill.Offline" = "Offline";
"Scene.HomeTimeline.TimelinePill.PostSent" = "Post Sent"; "Scene.HomeTimeline.TimelinePill.PostSent" = "Post Sent";
@ -328,6 +328,15 @@ uploaded to Mastodon.";
"Scene.Notification.NotificationDescription.PollHasEnded" = "poll has ended"; "Scene.Notification.NotificationDescription.PollHasEnded" = "poll has ended";
"Scene.Notification.NotificationDescription.RebloggedYourPost" = "boosted your post"; "Scene.Notification.NotificationDescription.RebloggedYourPost" = "boosted your post";
"Scene.Notification.NotificationDescription.RequestToFollowYou" = "request to follow you"; "Scene.Notification.NotificationDescription.RequestToFollowYou" = "request to follow you";
"Scene.Notification.Policy.NewAccount.Subtitle" = "Created within the past 30 days";
"Scene.Notification.Policy.NewAccount.Title" = "New accounts";
"Scene.Notification.Policy.NoFollower.Subtitle" = "Including people who have been following you fewer than 3 days";
"Scene.Notification.Policy.NoFollower.Title" = "People not following you";
"Scene.Notification.Policy.NotFollowing.Subtitle" = "Until you manually approve them";
"Scene.Notification.Policy.NotFollowing.Title" = "People you don't follow";
"Scene.Notification.Policy.PrivateMentions.Subtitle" = "Filtered unless its in reply to your own mention or if you follow the sender";
"Scene.Notification.Policy.PrivateMentions.Title" = "Unsolicited private mentions";
"Scene.Notification.Policy.Title" = "Filter Notifications from…";
"Scene.Notification.Title.Everything" = "Everything"; "Scene.Notification.Title.Everything" = "Everything";
"Scene.Notification.Title.Mentions" = "Mentions"; "Scene.Notification.Title.Mentions" = "Mentions";
"Scene.Notification.Warning.DeleteStatuses" = "Some of your posts have been removed."; "Scene.Notification.Warning.DeleteStatuses" = "Some of your posts have been removed.";
@ -621,4 +630,4 @@ If you disagree with the policy for **%@**, you can go back and pick a different
"Widget.MultipleFollowers.ConfigurationDescription" = "Show number of followers for multiple accounts."; "Widget.MultipleFollowers.ConfigurationDescription" = "Show number of followers for multiple accounts.";
"Widget.MultipleFollowers.ConfigurationDisplayName" = "Multiple followers"; "Widget.MultipleFollowers.ConfigurationDisplayName" = "Multiple followers";
"Widget.MultipleFollowers.MockUser.AccountName" = "another@follower.social"; "Widget.MultipleFollowers.MockUser.AccountName" = "another@follower.social";
"Widget.MultipleFollowers.MockUser.DisplayName" = "Another follower"; "Widget.MultipleFollowers.MockUser.DisplayName" = "Another follower";