Просмотр исходного кода

" U" in Bolus View and " U/hr" in info panel now localized.
Fixed previous commits (string interpolation).

Jon Mårtensson 4 лет назад
Родитель
Сommit
cecddbc903

+ 10 - 2
FreeAPS/Sources/Modules/Bolus/View/BolusRootView.swift

@@ -25,7 +25,11 @@ extension Bolus {
                         HStack {
                             Text("Insulin required").foregroundColor(.secondary)
                             Spacer()
-                            Text("\(formatter.string(from: viewModel.inslinRequired as NSNumber)!) U").foregroundColor(.secondary)
+                            Text(
+                                formatter
+                                    .string(from: viewModel.inslinRequired as NSNumber)! +
+                                    NSLocalizedString(" U", comment: "Insulin unit")
+                            ).foregroundColor(.secondary)
                         }.contentShape(Rectangle())
                             .onTapGesture {
                                 viewModel.amount = viewModel.inslinRecommended
@@ -33,7 +37,11 @@ extension Bolus {
                         HStack {
                             Text("Insulin recommended")
                             Spacer()
-                            Text("\(formatter.string(from: viewModel.inslinRecommended as NSNumber)!) U")
+                            Text(
+                                formatter
+                                    .string(from: viewModel.inslinRequired as NSNumber)! +
+                                    NSLocalizedString(" U", comment: "Insulin unit")
+                            ).foregroundColor(.secondary)
                         }.contentShape(Rectangle())
                             .onTapGesture {
                                 viewModel.amount = viewModel.inslinRecommended

+ 6 - 3
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -97,9 +97,12 @@ extension Home {
                         .font(.system(size: 12, weight: .bold)).foregroundColor(.loopGray)
                         .padding(.leading, 8)
                 } else if let tempRate = viewModel.tempRate {
-                    Text("\(numberFormatter.string(from: tempRate as NSNumber) ?? "0") U/hr")
-                        .font(.system(size: 12, weight: .bold)).foregroundColor(.insulin)
-                        .padding(.leading, 8)
+                    Text(
+                        (numberFormatter.string(from: tempRate as NSNumber) ?? "0") +
+                            NSLocalizedString(" U/hr", comment: "Unit per hour with space")
+                    )
+                    .font(.system(size: 12, weight: .bold)).foregroundColor(.insulin)
+                    .padding(.leading, 8)
                 }
 
                 if let tempTarget = viewModel.tempTarget {