diff --git a/OCKSample/Main/Login/LoginView.swift b/OCKSample/Main/Login/LoginView.swift index a902955..8eae317 100644 --- a/OCKSample/Main/Login/LoginView.swift +++ b/OCKSample/Main/Login/LoginView.swift @@ -33,7 +33,7 @@ struct LoginView: View { var body: some View { VStack { // Change the title to the name of your application - Text("CareKit Sample App") + Text("APP_NAME") .font(.largeTitle) .foregroundColor(.white) .padding() @@ -51,9 +51,9 @@ struct LoginView: View { https://www.swiftkickmobile.com/creating-a-segmented-control-in-swiftui/ */ Picker(selection: $signupLoginSegmentValue, - label: Text("Login Picker")) { - Text("Login").tag(0) - Text("Sign Up").tag(1) + label: Text("LOGIN_PICKER")) { + Text("LOGIN").tag(0) + Text("SIGN_UP").tag(1) } .pickerStyle(.segmented) .background(Color(tintColorFlip)) @@ -61,12 +61,12 @@ struct LoginView: View { .padding() VStack(alignment: .leading) { - TextField("Username", text: $usersname) + TextField("USERNAME", text: $usersname) .padding() .background(.white) .cornerRadius(20.0) .shadow(radius: 10.0, x: 20, y: 10) - SecureField("Password", text: $password) + SecureField("PASSWORD", text: $password) .padding() .background(.white) .cornerRadius(20.0) @@ -74,13 +74,13 @@ struct LoginView: View { switch signupLoginSegmentValue { case 1: - TextField("First Name", text: $firstName) + TextField("FIRST_NAME", text: $firstName) .padding() .background(.white) .cornerRadius(20.0) .shadow(radius: 10.0, x: 20, y: 10) - TextField("Last Name", text: $lastName) + TextField("LAST_NAME", text: $lastName) .padding() .background(.white) .cornerRadius(20.0) @@ -114,13 +114,13 @@ struct LoginView: View { }, label: { switch signupLoginSegmentValue { case 1: - Text("Sign Up") + Text("SIGN_UP") .font(.headline) .foregroundColor(.white) .padding() .frame(width: 300) default: - Text("Login") + Text("LOGIN") .font(.headline) .foregroundColor(.white) .padding() @@ -137,7 +137,7 @@ struct LoginView: View { }, label: { switch signupLoginSegmentValue { case 0: - Text("Login Anonymously") + Text("LOGIN_ANONYMOUSLY") .font(.headline) .foregroundColor(.white) .padding() @@ -151,15 +151,22 @@ struct LoginView: View { // If an error occurs show it on the screen if let error = viewModel.loginError { - Text("Error: \(error.message)") + Text("\(String(localized: "ERROR")): \(error.message)") .foregroundColor(.red) } Spacer() } - .background(LinearGradient(gradient: Gradient(colors: [Color(tintColorFlip), - Color(tintColor)]), - startPoint: .top, - endPoint: .bottom)) + .background( + LinearGradient( + gradient: Gradient( + colors: [ + Color(tintColorFlip), + Color(tintColor)] + ), + startPoint: .top, + endPoint: .bottom + ) + ) } } diff --git a/OCKSample/Main/Profile/ProfileView.swift b/OCKSample/Main/Profile/ProfileView.swift index eadcb8a..8d64bda 100644 --- a/OCKSample/Main/Profile/ProfileView.swift +++ b/OCKSample/Main/Profile/ProfileView.swift @@ -21,24 +21,30 @@ struct ProfileView: View { var body: some View { VStack { VStack(alignment: .leading) { - TextField("First Name", - text: $viewModel.firstName) - .padding() - .cornerRadius(20.0) - .shadow(radius: 10.0, x: 20, y: 10) + TextField( + "FIRST_NAME", + text: $viewModel.firstName + ) + .padding() + .cornerRadius(20.0) + .shadow(radius: 10.0, x: 20, y: 10) - TextField("Last Name", - text: $viewModel.lastName) - .padding() - .cornerRadius(20.0) - .shadow(radius: 10.0, x: 20, y: 10) + TextField( + "LAST_NAME", + text: $viewModel.lastName + ) + .padding() + .cornerRadius(20.0) + .shadow(radius: 10.0, x: 20, y: 10) - DatePicker("Birthday", - selection: $viewModel.birthday, - displayedComponents: [DatePickerComponents.date]) - .padding() - .cornerRadius(20.0) - .shadow(radius: 10.0, x: 20, y: 10) + DatePicker( + "BIRTHDAY", + selection: $viewModel.birthday, + displayedComponents: [DatePickerComponents.date] + ) + .padding() + .cornerRadius(20.0) + .shadow(radius: 10.0, x: 20, y: 10) } Button(action: { @@ -50,11 +56,13 @@ struct ProfileView: View { } } }, label: { - Text("Save Profile") - .font(.headline) - .foregroundColor(.white) - .padding() - .frame(width: 300, height: 50) + Text( + "SAVE_PROFILE" + ) + .font(.headline) + .foregroundColor(.white) + .padding() + .frame(width: 300, height: 50) }) .background(Color(.green)) .cornerRadius(15) @@ -66,11 +74,13 @@ struct ProfileView: View { await loginViewModel.logout() } }, label: { - Text("Log Out") - .font(.headline) - .foregroundColor(.white) - .padding() - .frame(width: 300, height: 50) + Text( + "LOG_OUT" + ) + .font(.headline) + .foregroundColor(.white) + .padding() + .frame(width: 300, height: 50) }) .background(Color(.red)) .cornerRadius(15) diff --git a/OCKSample/Supporting Files/Localization/en.lproj/Localizable.strings b/OCKSample/Supporting Files/Localization/en.lproj/Localizable.strings index 71e2b2d..d66ec8c 100644 --- a/OCKSample/Supporting Files/Localization/en.lproj/Localizable.strings +++ b/OCKSample/Supporting Files/Localization/en.lproj/Localizable.strings @@ -62,7 +62,28 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. "THREE_FINGER_SWIPE_WEEK" = "Three-finger swipe to go to next or previous week"; "TODAY" = "Today"; "START_SURVEY" = "Start Survey"; + +// MARK: Login +"APP_NAME" = "CareKit Sample App"; +"LOGIN_PICKER" = "Login Picker"; +"LOGIN" = "Login"; +"LOGIN_ANONYMOUSLY" = "Login Anonymously"; +"SIGN_UP" = "Sign Up"; +"USERNAME" = "Username"; +"PASSWORD" = "Password"; +"FIRST_NAME" = "First Name"; +"LAST_NAME" = "Last Name"; +"ERROR" = "Error"; +"OPEN_APP_IPHONE" = "Please open the app on your iPhone"; + +// MARK: Care View "NAUSEA_DOXYLAMINE_INTAKE" = "Nausea & Doxylamine Intake"; "THIS_WEEK" = "This Week"; "NAUSEA" = "Nausea"; "DOXYLAMINE" = "Doxylamine"; + +// MARK: Profile + +"BIRTHDAY" = "Birthday"; +"SAVE_PROFILE" = "Save Profile"; +"LOG_OUT" = "Log Out"; diff --git a/OCKWatchSample Extension/Main/Login/LoginView.swift b/OCKWatchSample Extension/Main/Login/LoginView.swift index 75d1a9b..bd00bee 100644 --- a/OCKWatchSample Extension/Main/Login/LoginView.swift +++ b/OCKWatchSample Extension/Main/Login/LoginView.swift @@ -12,7 +12,7 @@ struct LoginView: View { @ObservedObject var viewModel: LoginViewModel var body: some View { - Text("Please open the OCKSample app on your iPhone") + Text("OPEN_APP_IPHONE") .multilineTextAlignment(.center) .padding() Image(systemName: "apps.iphone")