ソースを参照

Add missing localizations for swipe to delete alerts

dsnallfot 1 年間 前
コミット
da5e0254d1

+ 12 - 0
Trio/Sources/Localizations/Main/Localizable.xcstrings

@@ -2193,6 +2193,9 @@
         }
         }
       }
       }
     },
     },
+    " SMB" : {
+      "comment" : "Super Micro Bolus indicator in alert"
+    },
     " SMBs are disabled either by schedule or during the entire duration." : {
     " SMBs are disabled either by schedule or during the entire duration." : {
       "comment" : "Alert string. Keep spaces.",
       "comment" : "Alert string. Keep spaces.",
       "extractionState" : "manual",
       "extractionState" : "manual",
@@ -27226,6 +27229,9 @@
         }
         }
       }
       }
     },
     },
+    "All FPUs and the carbs of the meal will be deleted." : {
+      "comment" : "Alert message for deletion"
+    },
     "All FPUs of the meal will be deleted." : {
     "All FPUs of the meal will be deleted." : {
       "extractionState" : "manual",
       "extractionState" : "manual",
       "localizations" : {
       "localizations" : {
@@ -62757,6 +62763,9 @@
         }
         }
       }
       }
     },
     },
+    "Delete Carbs Equivalents?" : {
+      "comment" : "Alert title for deleting carb equivalents"
+    },
     "Delete Carbs?" : {
     "Delete Carbs?" : {
       "comment" : "Delete carbs from data table and Nightscout",
       "comment" : "Delete carbs from data table and Nightscout",
       "extractionState" : "manual",
       "extractionState" : "manual",
@@ -63812,6 +63821,9 @@
         }
         }
       }
       }
     },
     },
+    "Delete the Temp Target Preset \"%@\"?" : {
+      "comment" : "Delete confirmation title for the temporary target preset"
+    },
     "Delivery limits" : {
     "Delivery limits" : {
       "extractionState" : "manual",
       "extractionState" : "manual",
       "localizations" : {
       "localizations" : {

+ 8 - 1
Trio/Sources/Modules/Adjustments/View/TempTargets/AdjustmentsRootView+TempTargets.swift

@@ -96,7 +96,14 @@ extension Adjustments.RootView {
     }
     }
 
 
     private var deleteConfirmationTitle: String {
     private var deleteConfirmationTitle: String {
-        "Delete the Temp Target Preset \"\(selectedTempTarget?.name ?? "")\"?"
+        let presetName = selectedTempTarget?.name ?? ""
+        return String(
+            format: NSLocalizedString(
+                "Delete the Temp Target Preset \"%@\"?",
+                comment: "Delete confirmation title for temporary target presets"
+            ),
+            presetName
+        )
     }
     }
 
 
     private func deleteConfirmationButtons() -> some View {
     private func deleteConfirmationButtons() -> some View {

+ 17 - 6
Trio/Sources/Modules/DataTable/View/DataTableRootView.swift

@@ -367,7 +367,7 @@ extension DataTable {
                                 action: {
                                 action: {
                                     alertGlucoseToDelete = glucose
                                     alertGlucoseToDelete = glucose
 
 
-                                    alertTitle = "Delete Glucose?"
+                                    alertTitle = String(localized: "Delete Glucose?", comment: "Alert title for deleting glucose")
                                     alertMessage = Formatter.dateFormatter
                                     alertMessage = Formatter.dateFormatter
                                         .string(from: glucose.date ?? Date()) + ", " +
                                         .string(from: glucose.date ?? Date()) + ", " +
                                         (Formatter.decimalFormatterWithTwoFractionDigits.string(for: glucose.glucose) ?? "0")
                                         (Formatter.decimalFormatterWithTwoFractionDigits.string(for: glucose.glucose) ?? "0")
@@ -526,7 +526,7 @@ extension DataTable {
                         role: .none,
                         role: .none,
                         action: {
                         action: {
                             alertTreatmentToDelete = item
                             alertTreatmentToDelete = item
-                            alertTitle = "Delete Insulin?"
+                            alertTitle = String(localized: "Delete Insulin?", comment: "Alert title for deleting insulin")
                             alertMessage = Formatter.dateFormatter
                             alertMessage = Formatter.dateFormatter
                                 .string(from: item.timestamp ?? Date()) + ", " +
                                 .string(from: item.timestamp ?? Date()) + ", " +
                                 (Formatter.decimalFormatterWithTwoFractionDigits.string(from: item.bolus?.amount ?? 0) ?? "0") +
                                 (Formatter.decimalFormatterWithTwoFractionDigits.string(from: item.bolus?.amount ?? 0) ?? "0") +
@@ -534,7 +534,11 @@ extension DataTable {
 
 
                             if let bolus = item.bolus {
                             if let bolus = item.bolus {
                                 // Add text snippet, so that alert message is more descriptive for SMBs
                                 // Add text snippet, so that alert message is more descriptive for SMBs
-                                alertMessage += bolus.isSMB ? " SMB" : ""
+                                alertMessage += bolus.isSMB ? String(
+                                    localized: " SMB",
+                                    comment: "Super Micro Bolus indicator in delete alert"
+                                )
+                                    : ""
                             }
                             }
 
 
                             isRemoveHistoryItemAlertPresented = true
                             isRemoveHistoryItemAlertPresented = true
@@ -603,7 +607,7 @@ extension DataTable {
 
 
                         // meal is carb-only
                         // meal is carb-only
                         if meal.fpuID == nil {
                         if meal.fpuID == nil {
-                            alertTitle = "Delete Carbs?"
+                            alertTitle = String(localized: "Delete Carbs?", comment: "Alert title for deleting carbs")
                             alertMessage = Formatter.dateFormatter
                             alertMessage = Formatter.dateFormatter
                                 .string(from: meal.date ?? Date()) + ", " +
                                 .string(from: meal.date ?? Date()) + ", " +
                                 (Formatter.decimalFormatterWithTwoFractionDigits.string(for: meal.carbs) ?? "0") +
                                 (Formatter.decimalFormatterWithTwoFractionDigits.string(for: meal.carbs) ?? "0") +
@@ -611,8 +615,15 @@ extension DataTable {
                         }
                         }
                         // meal is complex-meal or fpu-only
                         // meal is complex-meal or fpu-only
                         else {
                         else {
-                            alertTitle = meal.isFPU ? "Delete Carbs Equivalents?" : "Delete Carbs?"
-                            alertMessage = "All FPUs and the carbs of the meal will be deleted."
+                            alertTitle = meal.isFPU ? String(
+                                localized: "Delete Carbs Equivalents?",
+                                comment: "Alert title for deleting carb equivalents"
+                            )
+                                : String(localized: "Delete Carbs?", comment: "Alert title for deleting carbs")
+                            alertMessage = String(
+                                localized: "All FPUs and the carbs of the meal will be deleted.",
+                                comment: "Alert message for meal deletion"
+                            )
                         }
                         }
 
 
                         isRemoveHistoryItemAlertPresented = true
                         isRemoveHistoryItemAlertPresented = true