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,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
1C0DAB45279DB0FB003B1F21 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1C0DAB47279DB0FB003B1F21 /* Localizable.strings */; };
1C2618FA2795E41D00FDC148 /* Charts in Frameworks */ = {isa = PBXBuildFile; productRef = 1C2618F92795E41D00FDC148 /* Charts */; };
1C2618FE27960A4F00FDC148 /* FilterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C2618FD27960A4F00FDC148 /* FilterViewModel.swift */; };
1C26190327960CE500FDC148 /* ChartDataBuildable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C26190227960CE500FDC148 /* ChartDataBuildable.swift */; };
@@ -112,6 +113,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1C0DAB46279DB0FB003B1F21 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
1C0DAB48279DB116003B1F21 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
1C2618FD27960A4F00FDC148 /* FilterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterViewModel.swift; sourceTree = "<group>"; };
1C26190227960CE500FDC148 /* ChartDataBuildable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartDataBuildable.swift; sourceTree = "<group>"; };
1C26190627960DC900FDC148 /* ChartViewItemBuildable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartViewItemBuildable.swift; sourceTree = "<group>"; };
@@ -243,6 +246,7 @@
1CD90AE5278C7DDF001C4FEA = {
isa = PBXGroup;
children = (
1C0DAB47279DB0FB003B1F21 /* Localizable.strings */,
1CD90B6A278C7F75001C4FEA /* Feels (iOS).entitlements */,
1CD90B70278C8000001C4FEA /* Feels (iOS)Dev.entitlements */,
1CD90B6D278C7F89001C4FEA /* FeelsWidgetExtension.entitlements */,
@@ -495,6 +499,7 @@
knownRegions = (
en,
Base,
es,
);
mainGroup = 1CD90AE5278C7DDF001C4FEA;
packageReferences = (
@@ -519,6 +524,7 @@
buildActionMask = 2147483647;
files = (
1CD90B1E278C7DE0001C4FEA /* Assets.xcassets in Resources */,
1C0DAB45279DB0FB003B1F21 /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -665,11 +671,24 @@
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
1C0DAB47279DB0FB003B1F21 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
1C0DAB46279DB0FB003B1F21 /* en */,
1C0DAB48279DB116003B1F21 /* es */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
1CD90B20278C7DE0001C4FEA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
@@ -730,6 +749,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";

View File

@@ -19,17 +19,17 @@ enum Mood: Int {
var strValue: String {
switch self {
case .horrible:
return "Horrible"
return String(localized: "mood_value_horrible")
case .bad:
return "Bad"
return String(localized: "mood_value_bad")
case .average:
return "Average"
return String(localized: "mood_value_average")
case .good:
return "Good"
return String(localized: "mood_value_good")
case .great:
return "Great"
return String(localized: "mood_value_great")
case .missing:
return "Missing"
return String(localized: "mood_value_missing")
}
}

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)

View File

@@ -26,7 +26,7 @@ struct OnboardingTime: View {
ScrollView {
VStack {
Text("What time do you want to unlock your rating")
Text(String(localized: "onboarding_time_title"))
.font(.title)
.padding([.trailing, .leading], 55)
.padding([.top], 25)
@@ -41,7 +41,8 @@ struct OnboardingTime: View {
.padding([.top, .bottom], 25)
.colorScheme(.dark)
Text("Your shit will be unlocked at \(formatter.string(from: onboardingData.date)) daily")
Text(String(format: String(localized: "onboarding_time_body"),
formatter.string(from: onboardingData.date)))
.font(.body)
.padding([.top], 15)
.padding([.trailing, .leading], 55)

View File

@@ -9,9 +9,9 @@ import SwiftUI
struct OnboardingTitle: View {
static let titleOptions = [
"Its time to select.",
"Pick your shit!",
"How was your day?"]
String(localized: "onboarding_title_title_option_1"),
String(localized: "onboarding_title_title_option_2"),
String(localized: "onboarding_title_title_option_3")]
@ObservedObject var onboardingData: OnboardingData
@@ -26,7 +26,7 @@ struct OnboardingTitle: View {
ScrollView {
VStack{
Text("What would you like the reminder to say?")
Text(String(localized: "onboarding_title_title"))
.font(.title)
.foregroundColor(Color(UIColor.white))
.padding([.trailing, .leading], 55)
@@ -48,7 +48,7 @@ struct OnboardingTitle: View {
.padding([.top], 10)
}
Text("-- or type your own--")
Text(String(localized: "onboarding_title_type_your_own"))
.font(.body)
.foregroundColor(Color(UIColor.white))
.padding([.top], 25)

View File

@@ -31,7 +31,7 @@ struct OnboardingWrapup: View {
VStack {
Spacer()
Text("At")
Text(String(localized: "onboarding_wrap_up_1"))
.font(.title)
.foregroundColor(Color(UIColor.white))
.padding([.trailing, .leading], 55)
@@ -44,7 +44,7 @@ struct OnboardingWrapup: View {
.padding([.trailing, .leading], 55)
.padding([.top], 15)
Text("aou will get notified that")
Text(String(localized: "onboarding_wrap_up_2"))
.font(.title)
.foregroundColor(Color(UIColor.white))
.padding([.trailing, .leading], 55)
@@ -57,13 +57,13 @@ struct OnboardingWrapup: View {
.padding([.trailing, .leading], 55)
.padding([.top], 15)
Text("and when you vote it will be counted for the")
Text(String(localized: "onboarding_wrap_up_3"))
.font(.title)
.foregroundColor(Color(UIColor.white))
.padding([.trailing, .leading], 55)
.padding([.top], 15)
Text(onboardingData.inputDay.rawValue)
Text(onboardingData.inputDay.localizedValue)
.font(.title)
.fontWeight(.bold)
.foregroundColor(Color(UIColor.white))
@@ -73,7 +73,7 @@ struct OnboardingWrapup: View {
Button(action: {
completionClosure(onboardingData)
}, label: {
Text("Complete")
Text(String(localized: "onboarding_wrap_up_complete_button"))
.font(.title)
.fontWeight(.bold)
.foregroundColor(.yellow)

View File

@@ -53,9 +53,9 @@ struct AddMoodHeaderView: View {
switch savedOnboardingData.inputDay {
case .Today:
return "How is today?"
return String(localized: "add_mood_header_view_title_today")
case .Previous:
return "How was yesterday?"
return String(localized: "add_mood_header_view_title_yesterday")
}
}

View File

@@ -26,17 +26,17 @@ struct ContentView: View {
TabView {
mainView
.tabItem {
Label("Main", systemImage: "list.dash")
Label(String(localized: "content_view_tab_main"), systemImage: "list.dash")
}
FilterView()
.tabItem {
Label("Filter", systemImage: "calendar.circle")
Label(String(localized: "content_view_tab_filter"), systemImage: "calendar.circle")
}
GraphView()
.tabItem {
Label("Stats", systemImage: "chart.line.uptrend.xyaxis")
Label(String(localized: "content_view_tab_stats"), systemImage: "chart.line.uptrend.xyaxis")
}
}.sheet(isPresented: $needsOnboarding, onDismiss: {

View File

@@ -51,7 +51,7 @@ struct FilterView: View {
.cornerRadius(25)
.padding([.leading, .trailing])
Text("Total: \(self.viewModel.numberOfRatings)")
Text(String(localized: "filter_view_total") + ": \(self.viewModel.numberOfRatings)")
.font(.title2)
if showFilter {
@@ -71,7 +71,7 @@ struct FilterView: View {
showFilter.toggle()
}
}, label: {
Text(showFilter ? "Close Filters" : "Show Filters")
Text(showFilter ? String(localized: "filter_view_hide_filters") : String(localized: "filter_view_show_filters"))
.frame(maxWidth: .infinity)
.frame(height: 44)
.foregroundColor(Color(UIColor.label))
@@ -117,7 +117,7 @@ struct FilterView: View {
ZStack {
Color(UIColor.secondarySystemBackground)
DatePicker(
"Start Date",
String(localized: "filter_view_begin_date"),
selection: $viewModel.entryStartDate,
displayedComponents: [.date]
).onChange(of: viewModel.entryStartDate, perform: { value in
@@ -132,7 +132,7 @@ struct FilterView: View {
ZStack {
Color(UIColor.secondarySystemBackground)
DatePicker(
"End Date",
String(localized: "filter_view_end_date"),
selection: $viewModel.entryEndDate,
displayedComponents: [.date]
).onChange(of: viewModel.entryStartDate, perform: { value in

View File

@@ -46,7 +46,7 @@ struct SettingsView: View {
Button(action: {
dismiss()
}, label: {
Text("Exit")
Text(String(localized: "settings_view_exit"))
.font(.body)
.foregroundColor(Color(UIColor.systemBlue))
})
@@ -60,7 +60,7 @@ struct SettingsView: View {
Button(action: {
}, label: {
Text("Special thanks to")
Text(String(localized: "settings_view_special_thanks_to"))
})
.padding()
}
@@ -102,7 +102,7 @@ struct SettingsView: View {
private var whyBackgroundMode: some View {
ZStack {
Color(UIColor.systemBackground)
Text("we do bg mode b/c we can")
Text(String(localized: "settings_view_why_bg_mode"))
.padding()
}
.fixedSize(horizontal: false, vertical: true)
@@ -118,7 +118,7 @@ struct SettingsView: View {
ZStack {
Color(UIColor.systemBackground)
VStack {
Text("Change Icon")
Text(String(localized: "settings_view_change_icon"))
HStack {
Button(action: {
@@ -157,7 +157,7 @@ struct SettingsView: View {
Button(action: {
showOnboarding.toggle()
}, label: {
Text("Show Onboarding")
Text(String(localized: "settings_view_show_onboarding"))
})
.padding()
}

View File

@@ -0,0 +1,54 @@
/*
Localizable.strings
Feels
Created by Trey Tartt on 1/23/22.
*/
"onboarding_time_title" = "What time do you want to unlock your rating";
"onboarding_time_body" = "Your shit will be unlocked at %@ daily";
"onboarding_day_title" = "Will this rating be for current day or previous day";
"onboarding_day_body" = "When you vote your vote will be for the %@";
"onboarding_day_preview_text_today" = "Example: If you pick on a Tuesday, the value will be recorded for Tuesday";
"onboarding_day_preview_text_yesterday" = "Example: If you pick on a Tuesday, the value will be recorded for Monday, the day before";
"onboarding_day_options_today" = "Same Day";
"onboarding_day_options_yesterday" = "Previous Day";
"onboarding_title_title" = "What would you like the reminder to say?";
"onboarding_title_type_your_own" = "-- or type your own--";
"onboarding_title_title_option_1" = "Its time to select.";
"onboarding_title_title_option_2" = "Pick your shit!";
"onboarding_title_title_option_3" = "How was your day?";
"onboarding_wrap_up_1" = "At";
"onboarding_wrap_up_2" = "you will get notified that";
"onboarding_wrap_up_3" = "and when you vote it will be counted for the";
"onboarding_wrap_up_complete_button" = "Complete";
"add_mood_header_view_title_today" = "How is today?";
"add_mood_header_view_title_yesterday" = "How was yesterday?";
"content_view_tab_main" = "Main";
"content_view_tab_filter" = "Filter";
"content_view_tab_stats" = "Stats";
"filter_view_total" = "Total";
"filter_view_show_filters" = "Show Filters";
"filter_view_hide_filters" = "Hide Filters";
"filter_view_begin_date" = "Begin Date";
"filter_view_end_date" = "End Date";
"settings_view_exit" = "Exit";
"settings_view_special_thanks_to" = "Special thanks to";
"settings_view_why_bg_mode" = "we do bg mode b/c we can";
"settings_view_change_icon" = "Change Icon";
"settings_view_show_onboarding" = "Show onboarding";
"mood_value_great" = "Great";
"mood_value_good" = "Good";
"mood_value_average" = "Average";
"mood_value_bad" = "Bad";
"mood_value_horrible" = "Horrible";
"mood_value_missing" = "Missing";

View File

@@ -0,0 +1,7 @@
/*
Localizable.strings
Feels
Created by Trey Tartt on 1/23/22.
*/