Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

59 add localization comments to the dashboardview #250

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 32 additions & 11 deletions Basic-Car-Maintenance/Shared/Dashboard/Views/DashboardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ struct DashboardView: View {
Text(event.title)
.font(.title3)

Text("\(event.vehicle.name) on \(event.date, formatter: self.eventDateFormat)")
Text("\(event.vehicle.name) on \(event.date, formatter: self.eventDateFormat)",
comment: "Maintenance list item for a vehicle on a date")

if !event.notes.isEmpty {
Text(event.notes)
Expand All @@ -55,7 +56,8 @@ struct DashboardView: View {
isShowingEditView = true
} label: {
VStack {
Text("Edit")
Text("Edit",
comment: "Button label to edit this maintenance")
Image(systemName: SFSymbol.pencil)
}
}
Expand All @@ -74,7 +76,8 @@ struct DashboardView: View {
ProgressView("Loading...")
} else {
if viewModel.events.isEmpty {
Text("Add your first maintenance")
Text("Add your first maintenance",
comment: "Placeholder text for empty maintenance list prompting the user to add a maintenance event") // swiftlint:disable:this line_length
} else if viewModel.searchedEvents.isEmpty && !viewModel.searchText.isEmpty {
ContentUnavailableView("No results",
systemImage: SFSymbol.magnifyingGlass,
Expand All @@ -83,10 +86,15 @@ struct DashboardView: View {
}
}
.animation(.linear, value: viewModel.searchedEvents)
.navigationTitle(Text("Dashboard"))
.alert("Failed To Delete Event", isPresented: $viewModel.showErrorAlert) {
Button("OK") {
.navigationTitle(Text("Dashboard",
comment: "Title label for Dashboard view"))
.alert(Text("Failed To Delete Event",
comment: "Title for alert shown when deleting maintenance event fails"),
isPresented: $viewModel.showErrorAlert) {
Button {
viewModel.showErrorAlert = false
} label: {
Text("OK", comment: "Label to dismiss alert")
}
} message: {
Text(viewModel.errorMessage).padding()
Expand All @@ -109,7 +117,11 @@ struct DashboardView: View {
Image(systemName: SFSymbol.filter)
}
.accessibilityShowsLargeContentViewer {
Label("Filter", systemImage: SFSymbol.filter)
Label {
Text("Filter", comment: "Label for filtering on Dashboard view")
} icon: {
Image(systemName: SFSymbol.filter)
}
}

Button {
Expand All @@ -118,7 +130,11 @@ struct DashboardView: View {
Image(systemName: SFSymbol.plus)
}
.accessibilityShowsLargeContentViewer {
Label("Add", systemImage: SFSymbol.plus)
Label {
Text("AddEvent", comment: "Label for adding maintenance event on Dashboard view")
} icon: {
Image(systemName: SFSymbol.plus)
}
}
}
}
Expand Down Expand Up @@ -158,15 +174,20 @@ struct DashboardView: View {
await viewModel.getMaintenanceEvents()
}
}
.alert("An Error Occurred", isPresented: $viewModel.showAddErrorAlert) {
Button("OK", role: .cancel) {}
.alert(Text("An Error Occurred",
comment: "Title for alert shown when adding maintenance event fails"),
isPresented: $viewModel.showAddErrorAlert) {
Button(role: .cancel) {} label: {
Text("OK", comment: "Label to dismiss alert")
}
} message: {
Text(viewModel.errorMessage)
}
}

private var noSearchResultsDescription: Text {
Text("There were no maintenance events for '\(viewModel.searchText)'. Try a new search.")
Text("There were no maintenance events for '\(viewModel.searchText)'. Try a new search.",
comment: "Text shwon when there are no results for maintenance search")
hartti marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
65 changes: 43 additions & 22 deletions Basic-Car-Maintenance/Shared/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"sourceLanguage" : "en",
"strings" : {
"%@" : {
"comment" : "Maintenance list item description 'Date' formatted",
"localizations" : {
"be" : {
"stringUnit" : {
Expand Down Expand Up @@ -66,6 +67,7 @@
}
},
"%@ on %@" : {
"comment" : "Maintenance list item for a vehicle on a date",
"localizations" : {
"en" : {
"stringUnit" : {
Expand Down Expand Up @@ -447,6 +449,7 @@
}
},
"Add your first maintenance" : {
"comment" : "Placeholder text for empty maintenance list prompting the user to add a maintenance event",
"localizations" : {
"be" : {
"stringUnit" : {
Expand Down Expand Up @@ -563,6 +566,17 @@
}
}
},
"AddEvent" : {
"comment" : "Label for adding maintenance event on Dashboard view",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add"
}
}
}
},
"Additional Notes" : {
"comment" : "Notes text field placeholder",
"localizations" : {
Expand Down Expand Up @@ -641,6 +655,7 @@
}
},
"An Error Occurred" : {
"comment" : "Title for alert shown when adding maintenance event fails",
"localizations" : {
"be" : {
"stringUnit" : {
Expand Down Expand Up @@ -1174,6 +1189,7 @@
}
},
"Dashboard" : {
"comment" : "Title label for Dashboard view",
"localizations" : {
"be" : {
"stringUnit" : {
Expand Down Expand Up @@ -1502,6 +1518,7 @@
}
},
"Edit" : {
"comment" : "Button label to edit this maintenance",
"localizations" : {
"be" : {
"stringUnit" : {
Expand Down Expand Up @@ -1789,6 +1806,7 @@
}
},
"Failed To Delete Event" : {
"comment" : "Title for alert shown when deleting maintenance event fails",
"localizations" : {
"be" : {
"stringUnit" : {
Expand Down Expand Up @@ -2090,6 +2108,7 @@
}
},
"Filter" : {
"comment" : "Label for filtering on Dashboard view",
"localizations" : {
"be" : {
"stringUnit" : {
Expand Down Expand Up @@ -2136,6 +2155,7 @@
}
},
"For %@" : {
"comment" : "Maintenance list item description 'For which vehicle'",
"localizations" : {
"be" : {
"stringUnit" : {
Expand Down Expand Up @@ -2404,30 +2424,30 @@
}
},
"Loading..." : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Lade…"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Laden..."
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Yükleniyor..."
}
}
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Lade…"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Laden..."
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Yükleniyor..."
}
}
}
},
"Logged in anonymously with ID: %@" : {
"localizations" : {
"be" : {
"localizations" : {
"be" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ананімны ўваход з ідэнтыфікатарам: %@"
Expand Down Expand Up @@ -3989,6 +4009,7 @@
}
},
"There were no maintenance events for '%@'. Try a new search." : {
"comment" : "Text shwon when there are no results for maintenance search",
"localizations" : {
"be" : {
"stringUnit" : {
Expand Down Expand Up @@ -5219,4 +5240,4 @@
}
},
"version" : "1.0"
}
}
Loading