Skip to content

Commit 975b4d5

Browse files
make favorite food translatable
1 parent 1aaee2d commit 975b4d5

5 files changed

+98
-28
lines changed

Loop/Extensions/EditMode.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import SwiftUI
1010

1111
extension EditMode {
1212
var title: String {
13-
self == .active ? "Done" : "Edit"
13+
self == .active ? NSLocalizedString("Done", comment: "") : NSLocalizedString("Edit", comment: "")
1414
}
1515

1616
mutating func toggle() {

Loop/Views/AddEditFavoriteFoodView.swift

+25-5
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,40 @@ struct AddEditFavoriteFoodView: View {
9393
let foodTypeFocused: Binding<Bool> = Binding(get: { expandedRow == .foodType }, set: { expandedRow = $0 ? .foodType : nil })
9494
let absorptionTimeFocused: Binding<Bool> = Binding(get: { expandedRow == .absorptionTime }, set: { expandedRow = $0 ? .absorptionTime : nil })
9595

96-
TextFieldRow(text: $viewModel.name, isFocused: nameFocused, title: "Name", placeholder: "Apple")
96+
TextFieldRow(
97+
text: $viewModel.name,
98+
isFocused: nameFocused,
99+
title: NSLocalizedString("Name", comment: "Label for name in favorite food entry screen"),
100+
placeholder: NSLocalizedString("Apple", comment: "Placeholder for name in favorite food entry screen")
101+
)
97102

98103
CardSectionDivider()
99104

100-
CarbQuantityRow(quantity: $viewModel.carbsQuantity, isFocused: carbQuantityFocused, title: "Carb Quantity", preferredCarbUnit: viewModel.preferredCarbUnit)
105+
CarbQuantityRow(
106+
quantity: $viewModel.carbsQuantity,
107+
isFocused: carbQuantityFocused,
108+
title: NSLocalizedString("Carb Quantity", comment: "Label for carb quantity in favorite food entry screen"),
109+
preferredCarbUnit: viewModel.preferredCarbUnit
110+
)
101111

102112
CardSectionDivider()
103113

104-
EmojiRow(text: $viewModel.foodType, isFocused: foodTypeFocused, emojiType: .food, title: "Food Type")
114+
EmojiRow(
115+
text: $viewModel.foodType,
116+
isFocused: foodTypeFocused,
117+
emojiType: .food,
118+
title: NSLocalizedString("Food Type", comment: "Label for food type in favorite entry screen")
119+
)
105120

106121
CardSectionDivider()
107122

108-
AbsorptionTimePickerRow(absorptionTime: $viewModel.absorptionTime, isFocused: absorptionTimeFocused, validDurationRange: viewModel.absorptionRimesRange, showHowAbsorptionTimeWorks: $showHowAbsorptionTimeWorks)
109-
.padding(.bottom, 2)
123+
AbsorptionTimePickerRow(
124+
absorptionTime: $viewModel.absorptionTime,
125+
isFocused: absorptionTimeFocused,
126+
validDurationRange: viewModel.absorptionRimesRange,
127+
showHowAbsorptionTimeWorks: $showHowAbsorptionTimeWorks
128+
)
129+
.padding(.bottom, 2)
110130
}
111131
.padding(.vertical, 12)
112132
.padding(.horizontal)

Loop/Views/FavoriteFoodDetailView.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public struct FavoriteFoodDetailView: View {
3535
Section("Information") {
3636
VStack(spacing: 16) {
3737
let rows: [(field: String, value: String)] = [
38-
("Name", food.name),
39-
("Carb Quantity", food.carbsString(formatter: carbFormatter)),
40-
("Food Type", food.foodType),
41-
("Absorption Time", food.absorptionTimeString(formatter: absorptionTimeFormatter))
38+
(NSLocalizedString("Name", comment: "Label for name in favorite food entry"), food.name),
39+
(NSLocalizedString("Carb Quantity", comment:"Label for carb quantity in favorite food entry"), food.carbsString(formatter: carbFormatter)),
40+
(NSLocalizedString("Food Type", comment:"Label for food type in favorite food entry"), food.foodType),
41+
(NSLocalizedString("Absorption Time", comment:"Label for absorption time in favorite food entry"), food.absorptionTimeString(formatter: absorptionTimeFormatter))
4242
]
4343
ForEach(rows, id: \.field) { row in
4444
HStack {

Loop/Views/SettingsView.swift

+14-14
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,31 @@ public struct SettingsView: View {
2929
var id: String {
3030
rawValue
3131
}
32-
32+
3333
case deleteCGMData
3434
case deletePumpData
3535
}
36-
36+
3737
enum ActionSheet: String, Identifiable {
3838
var id: String {
3939
rawValue
4040
}
41-
41+
4242
case cgmPicker
4343
case pumpPicker
4444
case servicePicker
4545
}
46-
46+
4747
enum Sheet: String, Identifiable {
4848
var id: String {
4949
rawValue
5050
}
51-
51+
5252
case favoriteFoods
5353
case therapySettings
5454
}
5555
}
56-
56+
5757
@State private var actionSheet: Destination.ActionSheet?
5858
@State private var alert: Destination.Alert?
5959
@State private var sheet: Destination.Sheet?
@@ -254,7 +254,7 @@ extension SettingsView {
254254
}
255255
}
256256
}
257-
257+
258258
@ViewBuilder
259259
private var alertWarning: some View {
260260
if viewModel.alertPermissionsChecker.showWarning || viewModel.alertPermissionsChecker.notificationCenterSettings.scheduledDeliveryEnabled {
@@ -369,8 +369,8 @@ extension SettingsView {
369369
LargeButton(action: { sheet = .favoriteFoods },
370370
includeArrow: true,
371371
imageView: Image("Favorite Foods Icon").renderingMode(.template).foregroundColor(carbTintColor),
372-
label: "Favorite Foods",
373-
descriptiveText: "Simplify Carb Entry")
372+
label: NSLocalizedString("Favorite Foods", comment: "Label for favorite foods in settings view"),
373+
descriptiveText: NSLocalizedString("Simplify Carb Entry", comment: "subheadline of favorite foods in settings view"))
374374
}
375375
}
376376

@@ -493,7 +493,7 @@ extension SettingsView {
493493
)
494494
}
495495
}
496-
496+
497497
private func createAppExpirationSection(headerLabel: String, footerLabel: String, expirationLabel: String, updateURL: String, nearExpiration: Bool, expirationMessage: String) -> some View {
498498
return Section(
499499
header: SectionHeader(label: headerLabel),
@@ -557,7 +557,7 @@ fileprivate struct LargeButton<Content: View, SecondaryContent: View>: View {
557557
let secondaryImageView: SecondaryContent
558558
let label: String
559559
let descriptiveText: String
560-
560+
561561
init(
562562
action: @escaping () -> Void,
563563
includeArrow: Bool = true,
@@ -593,15 +593,15 @@ fileprivate struct LargeButton<Content: View, SecondaryContent: View>: View {
593593
DescriptiveText(label: descriptiveText)
594594
}
595595
}
596-
596+
597597
if !(secondaryImageView is EmptyView) || includeArrow {
598598
Spacer()
599599
}
600-
600+
601601
if !(secondaryImageView is EmptyView) {
602602
secondaryImageView.frame(width: secondaryImageWidth, height: secondaryImageHeight)
603603
}
604-
604+
605605
if includeArrow {
606606
// TODO: Ick. I can't use a NavigationLink because we're not Navigating, but this seems worse somehow.
607607
Image(systemName: "chevron.right").foregroundColor(.gray).font(.footnote)

Loop/de.lproj/Localizable.strings

+54-4
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@
125125
/* Alert message for a missing pump error */
126126
"A pump must be configured before a bolus can be delivered." = "Eine Pumpe muss konfiguriert werden, bevor ein Bolus abgegeben werden kann.";
127127

128+
/* Label for absorption time in favorite food entry */
129+
"Absorption Time" = "Resorptionsdauer";
130+
128131
/* Action to copy the recommended Bolus value to the actual Bolus Field */
129132
"AcceptRecommendedBolus" = "Akzeptiere empfohlenen Bolus";
130133

@@ -143,6 +146,9 @@
143146
/* The string format describing active insulin. (1: localized insulin value description) */
144147
"Active Insulin: %@" = "Aktives Insulin: %@";
145148

149+
/* No comment provided by engineer. */
150+
"Add a new favorite food" = "Erstelle einen neuen Favoriten";
151+
146152
/* Title of the user activity for adding carbs */
147153
"Add Carb Entry" = "KH hinzufügen";
148154

@@ -171,17 +177,24 @@
171177
Notification & Critical Alert Permissions screen title */
172178
"Alert Permissions" = "Benachrichtigungsberechtigungen";
173179

180+
/* Navigation title for algorithms experiments screen
181+
The title of the Algorithm Experiments section in settings */
182+
"Algorithm Experiments" = "Algorithmusexperimente";
183+
184+
/* Algorithm Experiments description. */
185+
"Algorithm Experiments are optional modifications to the Loop Algorithm. These modifications are less tested than the standard Loop Algorithm, so please use carefully." = "Algorithmusexperimente sind optionale Modifikationen des Schleifenalgorithmus. Diese Modifikationen sind weniger getestet als der Standard-Loop-Algorithmus. Gehe daher bitte vorsichtig vor!";
186+
174187
/* The title of the section containing algorithm settings */
175188
"Algorithm Settings" = "Algorithmus-Einstellungen";
176189

177-
/* Label for when mute alert will end */
178-
"All alerts muted until" = "Alle Alarme stummgeschaltet bis";
179-
180190
/* No comment provided by engineer. */
181191
"All Favorites" = "Alle Favoriten";
182192

183193
/* Label for carb quantity entry row on carb entry screen */
184-
"Amount Consumed" = "KH-Menge gegessen";
194+
"Amount Consumed" = "Menge gegessen";
195+
196+
/* Label for when mute alert will end */
197+
"All alerts muted until" = "Alle Alarme stummgeschaltet bis";
185198

186199
/* The title of the Amplitude service */
187200
"Amplitude" = "Amplitude";
@@ -210,6 +223,9 @@
210223
/* Settings app profile section */
211224
"App Profile" = "App-Profil";
212225

226+
/* Placeholder for name in favorite food entry screen */
227+
"Apple" = "Apfel";
228+
213229
/* Action sheet confirmation message for pump history deletion */
214230
"Are you sure you want to delete all history entries?" = "Möchtest Du wirklich alle Verlaufseinträge löschen?";
215231

@@ -296,6 +312,10 @@
296312
/* Label for carb entry row on bolus screen */
297313
"Carb Entry" = "KH-Eintrag";
298314

315+
/* Label for carb quantity entry row on favorite food entry screen
316+
Label for carb quantity in favorite food entry */
317+
"Carb Quantity" = "KH-Menge";
318+
299319
/* Details for configuration error when carb ratio schedule is missing */
300320
"Carb Ratio Schedule" = "Zeitplan für das Kohlenhydratverhältnis";
301321

@@ -477,6 +497,9 @@
477497
/* Override error description: duration exceed max (1: max duration in hours). */
478498
"Duration exceeds: %1$.1f hours" = "Dauer überschritten: %1$.1f Stunden";
479499

500+
/* No comment provided by engineer. */
501+
"Edit" = "Bearbeiten";
502+
480503
/* Message to the user to enable bluetooth */
481504
"Enable\nBluetooth" = "Bluetooth einschalten";
482505

@@ -540,6 +563,9 @@
540563
/* No comment provided by engineer. */
541564
"FAVORITE FOODS" = "Favorisiertes Essen";
542565

566+
/* No comment provided by engineer. */
567+
"Favorite Foods" = "Favorisiertes Essen";
568+
543569
/* Title of insulin model preset */
544570
"Fiasp" = "Fiasp";
545571

@@ -549,6 +575,10 @@
549575
/* Secondary text for alerts disabled warning, which appears on the main status screen. */
550576
"Fix now by turning Notifications, Critical Alerts and Time Sensitive Notifications ON." = "Behebe dies jetzt, indem Du Benachrichtigungen, kritische Alarme und zeitkritische Benachrichtigungen einschaltest.";
551577

578+
/* label for food type in favorite entry screen
579+
Label for food type in favorite food entry */
580+
"Food Type" = "Essensart";
581+
552582
/* The format string used to describe a finite workout targets duration */
553583
"For %1$@" = "Für %1$@";
554584

@@ -567,6 +597,10 @@
567597
/* The title of the glucose and prediction graph */
568598
"Glucose" = "Blutzucker";
569599

600+
/* Title for glucose based partial application experiment description
601+
Title of glucose based partial application experiment */
602+
"Glucose Based Partial Application" = "Glucose Based Partial Application";
603+
570604
/* The error message when glucose data is too old to be used. (1: glucose data age in minutes) */
571605
"Glucose data is %1$@ old" = "Blutzuckerdaten sind %1$@ alt";
572606

@@ -760,6 +794,10 @@
760794
/* Label for button to mute all alerts */
761795
"Mute All Alerts" = "Alle Alarme stummschalten";
762796

797+
/* Label for name in favorite food entry
798+
Label for name in favorite food entry screen */
799+
"Name" = "Name";
800+
763801
/* Sensor state description for the non-valid state */
764802
"Needs Attention" = "Erfordert Aufmerksamkeit";
765803

@@ -938,15 +976,24 @@
938976
/* The title of the notification action to retry a bolus command */
939977
"Retry" = "Wiederholen";
940978

979+
/* No comment provided by engineer. */
980+
"Save" = "Speichern";
981+
941982
/* Button text to save carbs and/or manual glucose entry and deliver a bolus */
942983
"Save and Deliver" = "Speichern und Bolus abgeben";
943984

985+
/* No comment provided by engineer. */
986+
"Save as favorite food" = "Als Favorit speichern";
987+
944988
/* Button text to save carbs and/or manual glucose entry without a bolus */
945989
"Save without Bolusing" = "Speichern ohne Bolusgabe";
946990

947991
/* Scheduled Delivery status text */
948992
"Scheduled" = "Geplant";
949993

994+
/* No comment provided by engineer. */
995+
"Selecting a favorite food in the carb entry screen automatically fills in the carb quantity, food type, and absorption time fields! Tap the add button below to create your first favorite food!" = "Wenn Du auf dem Kohlenhydrat-Eingabebildschirm ein Lieblingslebensmittel auswählst, werden automatisch die Felder Kohlenhydratmenge, Lebensmittelart und Absorptionszeit ausgefüllt! Tippe unten auf die Schaltfläche „Hinzufügen“, um Dein erstes Lieblingsessen zu erstellen!";
996+
950997
/* The title of the services section in settings */
951998
"Services" = "Dienste";
952999

@@ -965,6 +1012,9 @@
9651012
/* Title of simple bolus view when displaying meal entry */
9661013
"Simple Meal Calculator" = "Einfacher Mahlzeitenrechner";
9671014

1015+
/* subheadline of Favorite Foods */
1016+
"Simplify Carb Entry" = "Vereinfachte KH Eingabe";
1017+
9681018
/* Format fragment for a start time */
9691019
"since %@" = "seit %@";
9701020

0 commit comments

Comments
 (0)