localize main app

This commit is contained in:
Trey t
2022-01-23 10:28:38 -06:00
parent 8648a8f834
commit 8ece03abce
12 changed files with 132 additions and 40 deletions

View File

@@ -7,9 +7,19 @@
import SwiftUI
enum DayOptions: String, CaseIterable, RawRepresentable, Codable {
case Today = "Same Day"
case Previous = "Previous Day"
enum DayOptions: Int, CaseIterable, RawRepresentable, Codable {
case Today
case Previous
var localizedValue: String {
switch self {
case .Today:
return String(localized: "onboarding_day_options_today")
case .Previous:
return String(localized: "onboarding_day_options_yesterday")
}
}
}
struct OnboardingDay: View {
@@ -18,9 +28,9 @@ struct OnboardingDay: View {
var previewText: String {
switch onboardingData.inputDay {
case .Today:
return "Example: If you pick on a Tuesday, the value will be recorded for Tuesday"
return String(localized: "onboarding_day_preview_text_today")
case .Previous:
return "Example: If you pick on a Tuesday, the value will be recorded for Monday, the day before"
return String(localized: "onboarding_day_preview_text_yesterday")
}
}
@@ -35,7 +45,7 @@ struct OnboardingDay: View {
ScrollView {
VStack{
Text("Will this rating be for current day or previous day")
Text(String(localized: "onboarding_day_title"))
.font(.title)
.foregroundColor(Color(UIColor.white))
.padding([.trailing, .leading], 55)
@@ -44,7 +54,7 @@ struct OnboardingDay: View {
Picker(selection: $onboardingData.inputDay,
label: Text("")) {
ForEach(DayOptions.allCases, id: \.self) { day in
Text(day.rawValue)
Text(day.localizedValue)
}
}
.padding()
@@ -52,7 +62,7 @@ struct OnboardingDay: View {
.padding([.trailing, .leading], 55)
.pickerStyle(SegmentedPickerStyle())
Text("When you vote your vote will be for the \(onboardingData.inputDay.rawValue)")
Text(String(localized: "onboarding_day_body"))
.font(.body)
.foregroundColor(Color(UIColor.white))
.padding([.trailing, .leading], 75)