Bläddra i källkod

FIx localizations for enum cases. Thanks @dnzxy

dsnallfot 1 år sedan
förälder
incheckning
90eb588aef

+ 9 - 0
Trio/Sources/Modules/Adjustments/AdjustmentsStateModel+Extensions/AdjustmentsStateModel+Overrides.swift

@@ -1,6 +1,7 @@
 import Combine
 import CoreData
 import Foundation
+import SwiftUICore
 
 extension Adjustments.StateModel {
     // MARK: - Enact Overrides
@@ -374,10 +375,18 @@ enum IsfAndOrCrOptions: String, CaseIterable {
     case isf = "ISF"
     case cr = "CR"
     case nothing = "None"
+
+    var localized: LocalizedStringKey {
+        LocalizedStringKey(rawValue)
+    }
 }
 
 enum DisableSmbOptions: String, CaseIterable {
     case dontDisable = "Don't Disable"
     case disable = "Disable"
     case disableOnSchedule = "Disable on Schedule"
+
+    var localized: LocalizedStringKey {
+        LocalizedStringKey(rawValue)
+    }
 }

+ 2 - 2
Trio/Sources/Modules/Adjustments/View/Overrides/AddOverrideForm.swift

@@ -124,7 +124,7 @@ struct AddOverrideForm: View {
                 // Picker for ISF/CR settings
                 Picker("Also Inversely Change", selection: $selectedIsfCrOption) {
                     ForEach(IsfAndOrCrOptions.allCases, id: \.self) { option in
-                        Text(option.rawValue).tag(option)
+                        Text(option.localized).tag(option)
                     }
                 }
                 .pickerStyle(MenuPickerStyle())
@@ -188,7 +188,7 @@ struct AddOverrideForm: View {
                 // Picker for ISF/CR settings
                 Picker("Disable SMBs", selection: $selectedDisableSmbOption) {
                     ForEach(DisableSmbOptions.allCases, id: \.self) { option in
-                        Text(option.rawValue).tag(option)
+                        Text(option.localized).tag(option)
                     }
                 }
                 .pickerStyle(MenuPickerStyle())

+ 2 - 2
Trio/Sources/Modules/Adjustments/View/Overrides/EditOverrideForm.swift

@@ -187,7 +187,7 @@ struct EditOverrideForm: View {
                 // Picker for ISF/CR settings
                 Picker("Also Change", selection: $selectedIsfCrOption) {
                     ForEach(IsfAndOrCrOptions.allCases, id: \.self) { option in
-                        Text(option.rawValue).tag(option)
+                        Text(option.localized).tag(option)
                     }
                 }
                 .pickerStyle(MenuPickerStyle())
@@ -257,7 +257,7 @@ struct EditOverrideForm: View {
                 // Picker for Disable SMB settings
                 Picker("Disable SMBs", selection: $selectedDisableSmbOption) {
                     ForEach(DisableSmbOptions.allCases, id: \.self) { option in
-                        Text(option.rawValue).tag(option)
+                        Text(option.localized).tag(option)
                     }
                 }
                 .pickerStyle(MenuPickerStyle())