added more LocalizedStringKeys from tvos target, fixed some german translations

This commit is contained in:
Dominic Drees 2025-04-24 00:56:04 +02:00
parent 26161a5fc6
commit 044d0c803b
3 changed files with 26 additions and 10 deletions

View file

@ -774,7 +774,7 @@
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Info"
"value" : "Infos"
}
}
}
@ -1054,7 +1054,7 @@
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Medienplayer"
"value" : "Video Wiedergabe"
}
}
}

View file

@ -11,8 +11,24 @@ enum SettingDestination: Hashable {
case general, media, modules, trackers, data, logs, info
}
extension LocalizedStringKey {
var stringKey: String? {
Mirror(reflecting: self).children.first(where: { $0.label == "key" })?.value as? String
}
}
struct Setting: Identifiable, Hashable {
let id: Int
let title: String
let title: LocalizedStringKey
let destination: SettingDestination
func hash(into hasher: inout Hasher) {
hasher.combine(id)
hasher.combine(title.stringKey)
hasher.combine(destination)
}
static func ==(lhs: Setting, rhs: Setting) -> Bool {
return lhs.id == rhs.id && lhs.title.stringKey == rhs.title.stringKey && lhs.destination == rhs.destination
}
}

View file

@ -12,13 +12,13 @@ struct SettingsView: View {
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "BETA"
private let settings: [Setting] = [
Setting(id: 1, title: "General Preferences", destination: .general),
Setting(id: 2, title: "Media Player", destination: .media),
Setting(id: 3, title: "Modules", destination: .modules),
Setting(id: 4, title: "Trackers", destination: .trackers),
Setting(id: 5, title: "Data", destination: .data),
Setting(id: 6, title: "Logs", destination: .logs),
Setting(id: 7, title: "Info", destination: .info)
Setting(id: 1, title: LocalizedStringKey("General Preferences"), destination: .general),
Setting(id: 2, title: LocalizedStringKey("Media Player"), destination: .media),
Setting(id: 3, title: LocalizedStringKey("Modules"), destination: .modules),
Setting(id: 4, title: LocalizedStringKey("Trackers"), destination: .trackers),
Setting(id: 5, title: LocalizedStringKey("Data"), destination: .data),
Setting(id: 6, title: LocalizedStringKey("Logs"), destination: .logs),
Setting(id: 7, title: LocalizedStringKey("Info"), destination: .info)
]
var body: some View {