Localization. Localization everywhere! (IOS-20)

This commit is contained in:
Nathan Mattes 2023-10-09 17:31:39 +02:00
parent 41c0a61de2
commit b8eea23108
8 changed files with 43 additions and 18 deletions

View File

@ -726,8 +726,14 @@
"privacy_policy": "Privacy Policy",
"clear_media_storage": "Clear Media Storage"
},
"about_instance": {
"message_admin": "Message Admin"
"server_details": {
"about": "About",
"rules": "Rules"
"about_instance": {
"title": "Adminstrator"
"message_admin": "Message Admin"
}
},
"general": {
"title": "General",

View File

@ -2,6 +2,7 @@
import UIKit
import MastodonSDK
import MastodonLocalization
import MetaTextKit
enum ServerDetailsTab: Int, CaseIterable {
@ -10,16 +11,13 @@ enum ServerDetailsTab: Int, CaseIterable {
var title: String {
switch self {
//TODO: Add localization @zeitschlag
case .about: return "About"
case .rules: return "Rules"
case .about: return L10n.Scene.Settings.ServerDetails.about
case .rules: return L10n.Scene.Settings.ServerDetails.rules
}
}
}
protocol ServerDetailsViewControllerDelegate: AnyObject {
}
protocol ServerDetailsViewControllerDelegate: AnyObject {}
class ServerDetailsViewController: UIViewController {

View File

@ -2,9 +2,14 @@
import Foundation
import MastodonSDK
import MastodonLocalization
enum AboutInstanceSection: Hashable {
case main
enum AboutInstanceSection: Int, Hashable {
case main = 0
var title: String {
return L10n.Scene.Settings.ServerDetails.AboutInstance.title
}
}
enum AboutInstanceItem: Hashable {

View File

@ -9,6 +9,8 @@ class AboutInstanceTableViewDataSource: UITableViewDiffableDataSource<AboutInsta
}
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return "Administrator".uppercased()
guard let section = AboutInstanceSection(rawValue: section) else { return nil }
return section.title.uppercased()
}
}

View File

@ -14,7 +14,7 @@ class ContactAdminTableViewCell: UITableViewCell {
configuration.textProperties.color = Asset.Colors.Brand.blurple.color
configuration.image = UIImage(systemName: "envelope")
configuration.imageProperties.tintColor = Asset.Colors.Brand.blurple.color
configuration.text = L10n.Scene.Settings.AboutInstance.messageAdmin
configuration.text = L10n.Scene.Settings.ServerDetails.AboutInstance.messageAdmin
contentConfiguration = configuration
}

View File

@ -1416,10 +1416,6 @@ public enum L10n {
}
}
public enum Settings {
public enum AboutInstance {
/// Message Admin
public static let messageAdmin = L10n.tr("Localizable", "Scene.Settings.AboutInstance.MessageAdmin", fallback: "Message Admin")
}
public enum AboutMastodon {
/// Clear Media Storage
public static let clearMediaStorage = L10n.tr("Localizable", "Scene.Settings.AboutMastodon.ClearMediaStorage", fallback: "Clear Media Storage")
@ -1598,6 +1594,18 @@ public enum L10n {
public static let title = L10n.tr("Localizable", "Scene.Settings.Section.SpicyZone.Title", fallback: "The Spicy Zone")
}
}
public enum ServerDetails {
/// About
public static let about = L10n.tr("Localizable", "Scene.Settings.ServerDetails.About", fallback: "About")
/// Rules
public static let rules = L10n.tr("Localizable", "Scene.Settings.ServerDetails.Rules", fallback: "Rules")
public enum AboutInstance {
/// Message Admin
public static let messageAdmin = L10n.tr("Localizable", "Scene.Settings.ServerDetails.AboutInstance.MessageAdmin", fallback: "Message Admin")
/// Administrator
public static let title = L10n.tr("Localizable", "Scene.Settings.ServerDetails.AboutInstance.Title", fallback: "Administrator")
}
}
}
public enum SuggestionAccount {
/// Follow all

View File

@ -537,7 +537,10 @@ uploaded to Mastodon.";
"Scene.Settings.AboutMastodon.PrivacyPolicy" = "Privacy Policy";
"Scene.Settings.AboutMastodon.ClearMediaStorage" = "Clear Media Storage";
"Scene.Settings.AboutInstance.MessageAdmin" = "Message Admin";
"Scene.Settings.ServerDetails.About" = "About";
"Scene.Settings.ServerDetails.Rules" = "Rules";
"Scene.Settings.ServerDetails.AboutInstance.Title" = "Administrator";
"Scene.Settings.ServerDetails.AboutInstance.MessageAdmin" = "Message Admin";
"Scene.Settings.General.Title" = "General";
"Scene.Settings.General.Appearance.SectionTitle" = "Appearance";

View File

@ -537,7 +537,10 @@ uploaded to Mastodon.";
"Scene.Settings.AboutMastodon.PrivacyPolicy" = "Privacy Policy";
"Scene.Settings.AboutMastodon.ClearMediaStorage" = "Clear Media Storage";
"Scene.Settings.AboutInstance.MessageAdmin" = "Message Admin";
"Scene.Settings.ServerDetails.About" = "About";
"Scene.Settings.ServerDetails.Rules" = "Rules";
"Scene.Settings.ServerDetails.AboutInstance.Title" = "Administrator";
"Scene.Settings.ServerDetails.AboutInstance.MessageAdmin" = "Message Admin";
"Scene.Settings.General.Title" = "General";
"Scene.Settings.General.Appearance.SectionTitle" = "Appearance";