Skip to content

Commit

Permalink
#60 Adds Localization comments to SettingsView (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnolwamba committed Oct 8, 2023
1 parent b39316a commit 4351728
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 18 deletions.
15 changes: 15 additions & 0 deletions Basic-Car-Maintenance/Shared/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
}
},
"Add Vehicle" : {
"comment" : "Label to add a vehicle.",
"localizations" : {
"cs" : {
"stringUnit" : {
Expand Down Expand Up @@ -160,6 +161,7 @@

},
"Contributors" : {
"comment" : "Link to contributors list.",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand Down Expand Up @@ -224,6 +226,7 @@
}
},
"Delete" : {
"comment" : "Label to delete a vehicle",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand All @@ -237,6 +240,7 @@

},
"Failed To Add Vehicle. Unknown Error." : {
"comment" : "Label to display error details.",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand All @@ -257,6 +261,7 @@
}
},
"Failed To Delete Vehicle" : {
"comment" : "Label to dsplay title of the delete vehicle alert",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand All @@ -267,6 +272,7 @@
}
},
"Failed To Delete Vehicle\nDetails:%@" : {
"comment" : "Label to display localized error description.",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand All @@ -277,6 +283,7 @@
}
},
"GitHub Repo" : {
"comment" : "Link to the Basic Car Maintenance GitHub repo.",
"localizations" : {
"cs" : {
"stringUnit" : {
Expand Down Expand Up @@ -419,6 +426,7 @@
}
},
"OK" : {
"comment" : "Label to dismiss alert",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand All @@ -439,6 +447,7 @@
}
},
"Profile" : {
"comment" : "Link to view profile.",
"localizations" : {
"cs" : {
"stringUnit" : {
Expand All @@ -461,6 +470,7 @@
}
},
"Report a Bug" : {
"comment" : "Link to report a bug",
"localizations" : {
"cs" : {
"stringUnit" : {
Expand All @@ -483,6 +493,7 @@
}
},
"Request a New Feature" : {
"comment" : "Link to request a new feature.",
"localizations" : {
"cs" : {
"stringUnit" : {
Expand All @@ -505,6 +516,7 @@
}
},
"Settings" : {
"comment" : "Label to display settings.",
"localizations" : {
"cs" : {
"stringUnit" : {
Expand Down Expand Up @@ -571,6 +583,7 @@
}
},
"Thanks for using this app! It's open source and anyone can contribute to it." : {
"comment" : "Thanks a user for using the app and tells the user they can contribute to the codebase",
"localizations" : {
"cs" : {
"stringUnit" : {
Expand Down Expand Up @@ -728,6 +741,7 @@
}
},
"Vehicles" : {
"comment" : "Label to display header title.",
"localizations" : {
"cs" : {
"stringUnit" : {
Expand All @@ -750,6 +764,7 @@
}
},
"Version %@ (%@)" : {
"comment" : "Label to display version and build number.",
"localizations" : {
"cs" : {
"stringUnit" : {
Expand Down
43 changes: 25 additions & 18 deletions Basic-Car-Maintenance/Shared/Settings/Views/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,37 @@ struct SettingsView: View {
var body: some View {
NavigationStack {
Form {
Text("Thanks for using this app! It's open source and anyone can contribute to it.")
// swiftlint:disable:next line_length
Text("Thanks for using this app! It's open source and anyone can contribute to it.", comment: "Thanks a user for using the app and tells the user they can contribute to the codebase")

Link(destination: URL(string: "https://github.com/mikaelacaron/Basic-Car-Maintenance")!) {
Label {
Text("GitHub Repo")
Text("GitHub Repo", comment: "Link to the Basic Car Maintenance GitHub repo.")
} icon: {
Image("github-logo")
.resizable()
.frame(width: 20, height: 20)
}
}

Link(destination: URL(string: "https://github.com/mikaelacaron")!) {
Text("🦄 Mikaela Caron - Maintainer", comment: "Link to maintainer Github account.")
}

// swiftlint:disable:next line_length
Link(destination: URL(string: "https://github.com/mikaelacaron/Basic-Car-Maintenance/issues/new?assignees=&labels=feature+request&projects=&template=feature-request.md&title=FEATURE+-")!) {
Label {
Text("Request a New Feature")
Text("Request a New Feature", comment: "Link to request a new feature.")
} icon: {
Image(systemName: "doc.badge.plus")
.resizable()
.frame(width: 20, height: 20)
}
}

// swiftlint:disable:next line_length
Link(destination: URL(string: "https://github.com/mikaelacaron/Basic-Car-Maintenance/issues/new?assignees=&labels=bug&projects=&template=bug-report.md&title=BUG+-")!) {
Label {
Text("Report a Bug")
Text("Report a Bug", comment: "Link to report a bug")
} icon: {
Image(systemName: "ladybug")
.resizable()
Expand All @@ -63,7 +63,7 @@ struct SettingsView: View {
} label: {
HStack {
Image(systemName: "person.3.fill")
Text("Contributors")
Text("Contributors", comment: "Link to contributors list.")
}
}

Expand All @@ -78,7 +78,7 @@ struct SettingsView: View {
Text(vehicle.model)
}
.swipeActions {
Button("Delete", role: .destructive) {
Button(role: .destructive) {
Task {
do {
try await viewModel.deleteVehicle(vehicle)
Expand All @@ -87,45 +87,52 @@ struct SettingsView: View {
showDeleteVehicleError = true
}
}
} label: {
Text("Delete", comment: "Label to delete a vehicle")
}
}
}

Button {
isShowingAddVehicle.toggle()
} label: {
Text("Add Vehicle")
Text("Add Vehicle", comment: "Label to add a vehicle.")
}
} header: {
Text("Vehicles")
Text("Vehicles", comment: "Label to display header title.")
}

Section {
NavigationLink {
AuthenticationView(viewModel: viewModel.authenticationViewModel)
} label: {
Label {
Text("Profile")
Text("Profile", comment: "Link to view profile.")
} icon: {
Image(systemName: "person")
}
}
}

Text("Version \(Bundle.main.versionNumber) (\(Bundle.main.buildNumber))")
// swiftlint:disable:next line_length
Text("Version \(Bundle.main.versionNumber) (\(Bundle.main.buildNumber))", comment: "Label to display version and build number.")
}
.alert("Failed To Delete Vehicle", isPresented: $showDeleteVehicleError) {
Button("OK") {
// swiftlint:disable:next line_length
.alert(Text("Failed To Delete Vehicle", comment: "Label to dsplay title of the delete vehicle alert"),
isPresented: $showDeleteVehicleError) {
Button {
showDeleteVehicleError = false
} label: {
Text("OK", comment: "Label to dismiss alert")
}
} message: {
if let errorDetails {
Text("Failed To Delete Vehicle\nDetails:\(errorDetails.localizedDescription)")
// swiftlint:disable:next line_length
Text("Failed To Delete Vehicle\nDetails:\(errorDetails.localizedDescription)", comment: "Label to display localized error description.")
} else {
Text("Failed To Add Vehicle. Unknown Error.")
Text("Failed To Add Vehicle. Unknown Error.", comment: "Label to display error details.")
}
}
.navigationTitle(Text("Settings"))
.navigationTitle(Text("Settings", comment: "Label to display settings."))
.task {
await viewModel.getVehicles()
}
Expand Down

0 comments on commit 4351728

Please sign in to comment.