Sprinkle in some localizations on Notificaiton-Screen (IOS-14)

This commit is contained in:
Nathan Mattes 2023-06-30 12:02:16 +02:00
parent fedde3e159
commit 67e3078df9
6 changed files with 70 additions and 12 deletions

View File

@ -742,6 +742,22 @@
"open_in_mastodon": "Open in Mastodon",
"open_in_browser": "Open in Browser"
}
},
"notifications": {
"title": "Notifications",
"policy": {
"title": "Get Notifications from",
"anyone": "Anyone",
"followers": "People who follow you",
"follow": "People you follow",
"noone": "No one"
},
"alert": {
"mentions_and_replies": "Mentions & Replies",
"boosts": "Boosts",
"favorites": "Favorites",
"new_followers": "New Followers"
}
}
},
"report": {

View File

@ -1,6 +1,7 @@
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
import UIKit
import MastodonLocalization
class NotificationSettingTableViewCell: UITableViewCell {
static let reuseIdentifier = "NotificationSettingTableViewCell"
@ -13,8 +14,7 @@ class NotificationSettingTableViewCell: UITableViewCell {
break
case .policy:
var content = UIListContentConfiguration.valueCell()
//TODO: @zeitschlag Localization
content.text = "Get Notifications from"
content.text = L10n.Scene.Settings.Notifications.Policy.title
content.secondaryText = viewModel.selectedPolicy.title
contentConfiguration = content

View File

@ -1,6 +1,7 @@
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
import Foundation
import MastodonLocalization
struct NotificationSettingsSection: Hashable {
let entries: [NotificationSettingEntry]
@ -20,13 +21,13 @@ enum NotificationPolicy: Hashable {
var title: String {
switch self {
case .anyone:
return "Anyone"
return L10n.Scene.Settings.Notifications.Policy.anyone
case .followers:
return "People who follow you"
return L10n.Scene.Settings.Notifications.Policy.followers
case .follow:
return "People you follow"
return L10n.Scene.Settings.Notifications.Policy.follow
case .noone:
return "No one"
return L10n.Scene.Settings.Notifications.Policy.noone
}
}
}
@ -41,13 +42,13 @@ enum NotificationAlert: Hashable, CaseIterable {
switch self {
case .mentionsAndReplies:
return "Mentions & Replies"
return L10n.Scene.Settings.Notifications.Alert.mentionsAndReplies
case .boosts:
return "Boosts"
return L10n.Scene.Settings.Notifications.Alert.boosts
case .favorites:
return "Favorites"
return L10n.Scene.Settings.Notifications.Alert.favorites
case .newFollowers:
return "New Followers"
return L10n.Scene.Settings.Notifications.Alert.newFollowers
}
}
}

View File

@ -1,6 +1,7 @@
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
import UIKit
import MastodonLocalization
protocol NotificationSettingsViewControllerDelegate: AnyObject {
func showPolicyList(_ viewController: UIViewController, viewModel: NotificationSettingsViewModel)
@ -66,7 +67,7 @@ class NotificationSettingsViewController: UIViewController {
view.addSubview(tableView)
tableView.pinToParent()
title = "Notifications"
title = L10n.Scene.Settings.Notifications.title
}
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
@ -90,7 +91,10 @@ extension NotificationSettingsViewController: UITableViewDelegate {
let entry = sections[indexPath.section].entries[indexPath.row]
if case let .policy = entry {
switch entry {
case .alert(_):
break
case .policy:
delegate?.showPolicyList(self, viewModel: viewModel)
}

View File

@ -1466,6 +1466,32 @@ public enum L10n {
/// Close Settings Window
public static let closeSettingsWindow = L10n.tr("Localizable", "Scene.Settings.Keyboard.CloseSettingsWindow", fallback: "Close Settings Window")
}
public enum Notifications {
/// Notifications
public static let title = L10n.tr("Localizable", "Scene.Settings.Notifications.Title", fallback: "Notifications")
public enum Alert {
/// Boosts
public static let boosts = L10n.tr("Localizable", "Scene.Settings.Notifications.Alert.Boosts", fallback: "Boosts")
/// Favorites
public static let favorites = L10n.tr("Localizable", "Scene.Settings.Notifications.Alert.Favorites", fallback: "Favorites")
/// Mentions & Replies
public static let mentionsAndReplies = L10n.tr("Localizable", "Scene.Settings.Notifications.Alert.MentionsAndReplies", fallback: "Mentions & Replies")
/// New Followers
public static let newFollowers = L10n.tr("Localizable", "Scene.Settings.Notifications.Alert.NewFollowers", fallback: "New Followers")
}
public enum Policy {
/// Anyone
public static let anyone = L10n.tr("Localizable", "Scene.Settings.Notifications.Policy.Anyone", fallback: "Anyone")
/// People you follow
public static let follow = L10n.tr("Localizable", "Scene.Settings.Notifications.Policy.Follow", fallback: "People you follow")
/// People who follow you
public static let followers = L10n.tr("Localizable", "Scene.Settings.Notifications.Policy.Followers", fallback: "People who follow you")
/// No one
public static let noone = L10n.tr("Localizable", "Scene.Settings.Notifications.Policy.Noone", fallback: "No one")
/// Get Notifications from
public static let title = L10n.tr("Localizable", "Scene.Settings.Notifications.Policy.Title", fallback: "Get Notifications from")
}
}
public enum Overview {
/// About Mastodon
public static let aboutMastodon = L10n.tr("Localizable", "Scene.Settings.Overview.AboutMastodon", fallback: "About Mastodon")

View File

@ -547,6 +547,17 @@ uploaded to Mastodon.";
"Scene.Settings.General.Links.OpenInMastodon" = "Open in Mastodon";
"Scene.Settings.General.Links.OpenInBrowser" = "Open in Browser";
"Scene.Settings.Notifications.Title" = "Notifications";
"Scene.Settings.Notifications.Policy.Title" = "Get Notifications from";
"Scene.Settings.Notifications.Policy.Anyone" = "Anyone";
"Scene.Settings.Notifications.Policy.Followers" = "People who follow you";
"Scene.Settings.Notifications.Policy.Follow" = "People you follow";
"Scene.Settings.Notifications.Policy.Noone" = "No one";
"Scene.Settings.Notifications.Alert.MentionsAndReplies" = "Mentions & Replies";
"Scene.Settings.Notifications.Alert.Boosts" = "Boosts";
"Scene.Settings.Notifications.Alert.Favorites" = "Favorites";
"Scene.Settings.Notifications.Alert.NewFollowers" = "New Followers";
"Scene.SuggestionAccount.FollowAll" = "Follow all";
"Scene.SuggestionAccount.Title" = "Popular on Mastodon";
"Scene.Thread.BackTitle" = "Post";