Преглед изворни кода

Update strings and sync with dev (#113)

Jon B Mårtensson пре 2 година
родитељ
комит
e054547cbe

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
FreeAPS/Resources/javascript/bundle/determine-basal.js


+ 9 - 9
FreeAPS/Sources/Localizations/Main/en.lproj/Localizable.strings

@@ -1298,8 +1298,11 @@ Enact a temp Basal or a temp target */
 /* */
 "Insulin Sensitivity" = "Insulin Sensitivity";
 
-/* Formuala displayed in Bolus info pop-up*/
-"(Eventual Glucose - Target) / ISF =" = "(Eventual Glucose - Target) / ISF =";
+/* Formula displayed in Bolus info pop-up. Make translation short! */
+"(Eventual Glucose - Target) / ISF" = "(Eventual Glucose - Target) / ISF";
+
+/* */
+"Formula =" = "Formula =";
 
 /* Bolus pop-up footer */
 "Carbs and previous insulin are included in the glucose prediction, but if the Eventual Glucose is lower than the Target Glucose, a bolus will not be recommended." = "Carbs and previous insulin are included in the glucose prediction, but if the Eventual Glucose is lower than the Target Glucose, a bolus will not be recommended.";
@@ -1308,13 +1311,10 @@ Enact a temp Basal or a temp target */
 "Hide" = "Hide";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
-"Predicted Glucose, " = "Predicted Glucose, ";
-
-/* Bolus pop-up / Alert string. Make translations concise! */
-"is predicted below threshold " = "is predicted below threshold ";
+"Eventual Glucose > Target Glucose, but glucose, " = "Eventual Glucose > Target Glucose, but glucose, ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
-"is below Threshold of " = "is below Threshold of ";
+"is predicted below Threshold of " = "is predicted below Threshold of ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
 "Eventual Glucose > Target Glucose, but glucose is climbing slower than expected. Expected: " = "Eventual Glucose > Target Glucose, but glucose is climbing slower than expected. Expected: ";
@@ -1323,7 +1323,7 @@ Enact a temp Basal or a temp target */
 ". Climbing: " = ". Climbing: ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
-"Eventual Glucose > Target Glucose, but glucose is falling slower than expected. Expected: " = "Eventual Glucose > Target Glucose, but glucose is falling slower than expected. Expected: ";
+"Eventual Glucose > Target Glucose, but glucose is falling faster than expected. Expected: " = "Eventual Glucose > Target Glucose, but glucose is falling faster than expected. Expected: ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
 ". Falling: " = ". Falling: ";
@@ -1335,7 +1335,7 @@ Enact a temp Basal or a temp target */
 ". Changing: " = ". Changing: ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
-"Minimum predicted Glucose is " = "Minimum predicted Glucose is ";
+"Eventual Glucose > Target Glucose, but glucose is predicted to drop down to " = "Glucose is predicted to drop to";
 
 /* Add insulin without bolusing alert */
 " without bolusing" = " without bolusing";

+ 11 - 11
FreeAPS/Sources/Localizations/Main/sv.lproj/Localizable.strings

@@ -1332,8 +1332,11 @@ Enact a temp Basal or a temp target */
 /* */
 "Insulin Sensitivity" = "Insulinkänslighet";
 
-/* Formuala displayed in Bolus info pop-up. Make translation short! */
-"(Eventual Glucose - Target) / ISF =" = "(Blodsockerprognos - Målvärde) / ISF =";
+/* Formula displayed in Bolus info pop-up. Make translation short! */
+"(Eventual Glucose - Target) / ISF" = "(Blodsockerprognos - Målvärde) / ISF";
+
+/* */
+"Formula =" = "Formel =";
 
 /* Bolus pop-up footer */
 "Carbs and previous insulin are included in the glucose prediction, but if the Eventual Glucose is lower than the Target Glucose, a bolus will not be recommended." = "Kolhydrater och tidigare insulin ingår i prognos, men om prognos är lägre än målvärde kommer ingen bolus att föreslås.";
@@ -1342,34 +1345,31 @@ Enact a temp Basal or a temp target */
 "Hide" = "Göm";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
-"Predicted Glucose, " = "Prognos, ";
-
-/* Bolus pop-up / Alert string. Make translations concise! */
-"is predicted below threshold " = "är under tröskelvärde ";
+"Eventual Glucose > Target Glucose, but glucose, " = "Prognos > målvärde, men ditt blodsocker, ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
-"is below Threshold of " = "är under tröskelvärde ";
+"is predicted below Threshold of " = "beräknas sjunka under tröskelvärde ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
-"Eventual Glucose > Target Glucose, but glucose is climbing slower than expected. Expected: " = "Prognos > Målvärde, men blodsocker stiger snabbare än väntat. Förväntat: ";
+"Eventual Glucose > Target Glucose, but glucose is climbing slower than expected. Expected: " = "Prognos > Målvärde, men ditt blodsocker stiger långsammare än väntat. Förväntat: ";
 
 //* Bolus pop-up / Alert string. Make translations concise! */
 ". Climbing: " = ". Stiger: ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
-"Eventual Glucose > Target Glucose, but glucose is falling slower than expected. Expected: " = "Prognos > Målvärde, men blodsocker sjunker snabbare än väntat. Förväntat: ";
+"Eventual Glucose > Target Glucose, but glucose is falling faster than expected. Expected: " = "Prognos > målvärde, men blodsocker sjunker snabbare än väntat. Förväntat: ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
 ". Falling: " = ". Sjunker: ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
-"Eventual Glucose > Target Glucose, but glucose is changing faster than expected. Expected: " =  "Prognos > Målvärde, men blodsocker ändras snabbare än väntat. Förväntat: ";
+"Eventual Glucose > Target Glucose, but glucose is changing faster than expected. Expected: " =  "Prognos > målvärde, men blodsocker ändras snabbare än väntat. Förväntat: ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
 ". Changing: " = ". Ändras: ";
 
 /* Bolus pop-up / Alert string. Make translations concise! */
-"Minimum predicted Glucose is " = "Lägsta prognos är ";
+"Eventual Glucose > Target Glucose, but glucose is predicted to drop down to " = "Prognos är > målvärde, men blodsocker väntas ev sjunka till ";
 
 /* Add insulin without bolusing alert */
 " without bolusing" = " utan att ge insulin";

+ 1 - 3
FreeAPS/Sources/Modules/AddCarbs/AddCarbsStateModel.swift

@@ -16,7 +16,6 @@ extension AddCarbs {
         @Published var dish: String = ""
         @Published var selection: Presets?
         @Published var summation: [String] = []
-        @Published var manualBolus: Bool = false
 
         let coredataContext = CoreDataStack.shared.persistentContainer.viewContext
 
@@ -109,8 +108,7 @@ extension AddCarbs {
                 apsManager.determineBasalSync()
                 showModal(for: nil)
             } else {
-                manualBolus.toggle()
-                showModal(for: .bolus(waitForSuggestion: true, manualBolus: manualBolus))
+                showModal(for: .bolus(waitForSuggestion: true))
             }
         }
 

+ 7 - 3
FreeAPS/Sources/Modules/Bolus/BolusStateModel.swift

@@ -7,12 +7,11 @@ extension Bolus {
         @Injected() var apsManager: APSManager!
         @Injected() var broadcaster: Broadcaster!
         @Injected() var pumpHistoryStorage: PumpHistoryStorage!
-      
+
         @Published var amount: Decimal = 0
         @Published var insulinRecommended: Decimal = 0
         @Published var insulinRequired: Decimal = 0
         @Published var waitForSuggestion: Bool = false
-        @Published var manual: Bool = false
         @Published var error: Bool = false
         @Published var errorString: Decimal = 0
         @Published var evBG: Int = 0
@@ -96,7 +95,12 @@ extension Bolus {
             DispatchQueue.main.async {
                 self.insulinRequired = self.provider.suggestion?.insulinReq ?? 0
 
-                // Manual Bolus recommendation screen after a carb entry (normally) yields a higher amount than the insulin reqiured amount computed for SMBs (auto boluses). Carbs combined with a manual bolus threfore now (test) uses the Eventual BG for glucose prediction, whereas the insulinReg for SMBs uses the minPredBG for glucose prediction (typically lower than Eventual BG).
+                // Manual Bolus recommendation (normally) yields a higher amount than the insulin reqiured amount computed for SMBs (auto boluses). A manual bolus threfore now (test) uses the Eventual BG for glucose prediction, whereas the insulinReg for SMBs uses the minPredBG for glucose prediction (typically lower than Eventual BG).
+
+                var conversion: Decimal = 1.0
+                if self.units == .mmolL {
+                    conversion = 0.0555
+                }
 
                 var conversion: Decimal = 1.0
                 if self.units == .mmolL {

+ 14 - 12
FreeAPS/Sources/Modules/Bolus/View/BolusRootView.swift

@@ -5,7 +5,6 @@ extension Bolus {
     struct RootView: BaseView {
         let resolver: Resolver
         let waitForSuggestion: Bool
-        let manualBolus: Bool
         @StateObject var state = StateModel()
 
         @State private var isAddInsulinAlertPresented = false
@@ -96,7 +95,7 @@ extension Bolus {
                         Alert(
                             title: Text("Are you sure?"),
                             message: Text(
-                                "Add " + formatter
+                                NSLocalizedString("Add", comment: "Add insulin without bolusing alert") + " " + formatter
                                     .string(from: state.amount as NSNumber)! + NSLocalizedString(" U", comment: "Insulin unit") +
                                     NSLocalizedString(" without bolusing", comment: "Add insulin without bolusing alert")
                             ),
@@ -132,7 +131,7 @@ extension Bolus {
             .alert(isPresented: $displayError) {
                 Alert(
                     title: Text("Warning!"),
-                    message: Text("\n" + NSLocalizedString(state.errorString, comment: "") + NSLocalizedString(
+                    message: Text("\n" + alertString() + NSLocalizedString(
                         "\n\nTap 'Add' to continue with selected amount.",
                         comment: "Alert text to confirm bolus amount to add"
                     )),
@@ -150,7 +149,6 @@ extension Bolus {
                 configureView {
                     state.waitForSuggestionInitial = waitForSuggestion
                     state.waitForSuggestion = waitForSuggestion
-                    state.manual = manualBolus
                 }
             }
             .navigationTitle("Enact Bolus")
@@ -196,6 +194,10 @@ extension Bolus {
                             Text("%").foregroundColor(.secondary)
                         }
                     }
+                    HStack {
+                        Text("Formula =")
+                        Text("(Eventual Glucose - Target) / ISF")
+                    }.foregroundColor(.secondary).italic().padding(.top, 5)
                 }
                 .font(.footnote)
                 .padding(.top, 10)
@@ -206,11 +208,10 @@ extension Bolus {
                         " U",
                         comment: "Unit in number of units delivered (keep the space character!)"
                     )
-                    Text("(Eventual Glucose - Target) / ISF =").font(.callout).italic()
                     let color: Color = (state.percentage != 100 && state.insulin > 0) ? .secondary : .blue
                     let fontWeight: Font.Weight = (state.percentage != 100 && state.insulin > 0) ? .regular : .bold
                     HStack {
-                        Text(" = ").font(.callout)
+                        Text(NSLocalizedString("Insulin recommended", comment: "") + ":").font(.callout)
                         Text(state.insulin.formatted() + unit).font(.callout).foregroundColor(color).fontWeight(fontWeight)
                     }
                     if state.percentage != 100, state.insulin > 0 {
@@ -231,6 +232,7 @@ extension Bolus {
                         Divider()
                     }.padding(.horizontal, 10)
                 }
+                // Footer
                 if !(state.error && state.insulinRecommended > 0) {
                     VStack {
                         Text(
@@ -257,25 +259,25 @@ extension Bolus {
             switch state.errorString {
             case 1:
                 return NSLocalizedString(
-                    "Predicted Glucose, ",
+                    "Eventual Glucose > Target Glucose, but glucose, ",
                     comment: "Bolus pop-up / Alert string. Make translations concise!"
                 ) + state.minGuardBG
                     .formatted(.number.grouping(.never).rounded().precision(.fractionLength(fractionDigits))) + " " + state.units
                     .rawValue + ", " +
                     NSLocalizedString(
-                        "is predicted below threshold ",
+                        "is predicted below Threshold of ",
                         comment: "Bolus pop-up / Alert string. Make translations concise!"
                     ) + state
                     .threshold.formatted(.number.grouping(.never).rounded().precision(.fractionLength(fractionDigits))) + "!"
             case 2:
                 return NSLocalizedString(
-                    "Predicted Glucose, ",
+                    "Eventual Glucose > Target Glucose, but glucose, ",
                     comment: "Bolus pop-up / Alert string. Make translations concise!"
                 ) + state.minGuardBG
                     .formatted(.number.grouping(.never).rounded().precision(.fractionLength(fractionDigits))) + " " + state.units
                     .rawValue + ", " +
                     NSLocalizedString(
-                        "is below Threshold of ",
+                        "is predicted below Threshold of ",
                         comment: "Bolus pop-up / Alert string. Make translations concise!"
                     ) + state
                     .threshold.formatted(.number.grouping(.never).rounded().precision(.fractionLength(fractionDigits)))
@@ -290,7 +292,7 @@ extension Bolus {
                     .minDelta.formatted(.number.grouping(.never).rounded().precision(.fractionLength(fractionDigits)))
             case 4:
                 return NSLocalizedString(
-                    "Eventual Glucose > Target Glucose, but glucose is falling slower than expected. Expected: ",
+                    "Eventual Glucose > Target Glucose, but glucose is falling faster than expected. Expected: ",
                     comment: "Bolus pop-up / Alert string. Make translations concise!"
                 ) +
                     state.expectedDelta
@@ -308,7 +310,7 @@ extension Bolus {
                     .minDelta.formatted(.number.grouping(.never).rounded().precision(.fractionLength(fractionDigits)))
             case 6:
                 return NSLocalizedString(
-                    "Minimum predicted Glucose is ",
+                    "Eventual Glucose > Target Glucose, but glucose is predicted to drop down to ",
                     comment: "Bolus pop-up / Alert string. Make translations concise!"
                 ) + state
                     .minPredBG

+ 1 - 1
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -502,7 +502,7 @@ extension Home {
                             .padding(8)
                     }.foregroundColor(.loopGreen)
                     Spacer()
-                    Button { state.showModal(for: .bolus(waitForSuggestion: false, manualBolus: false)) }
+                    Button { state.showModal(for: .bolus(waitForSuggestion: false)) }
                     label: {
                         Image("bolus")
                             .renderingMode(.template)

+ 3 - 3
FreeAPS/Sources/Router/Screen.swift

@@ -16,7 +16,7 @@ enum Screen: Identifiable, Hashable {
     case preferencesEditor
     case addCarbs
     case addTempTarget
-    case bolus(waitForSuggestion: Bool, manualBolus: Bool)
+    case bolus(waitForSuggestion: Bool)
     case manualTempBasal
     case autotuneConfig
     case dataTable
@@ -67,8 +67,8 @@ extension Screen {
             AddCarbs.RootView(resolver: resolver)
         case .addTempTarget:
             AddTempTarget.RootView(resolver: resolver)
-        case let .bolus(waitForSuggestion, manualBolus):
-            Bolus.RootView(resolver: resolver, waitForSuggestion: waitForSuggestion, manualBolus: manualBolus)
+        case let .bolus(waitForSuggestion):
+            Bolus.RootView(resolver: resolver, waitForSuggestion: waitForSuggestion)
         case .manualTempBasal:
             ManualTempBasal.RootView(resolver: resolver)
         case .autotuneConfig: