From 9e85e0496b69a93fbd81b3668b7f4a525aa090a2 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Wed, 25 Jan 2023 08:55:05 -0800 Subject: [PATCH 1/8] move comment in line with translation --- .../Sources/Views/Resources/zh-Hans.lproj/Localizable.strings | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings b/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings index 8a766ccff..21d6270cc 100644 --- a/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings +++ b/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings @@ -86,8 +86,7 @@ "registrationUsername" = "用户名"; "registrationAlreadyHaveAccount" = "已有帐户?"; "registrationBio" = "个人简介 (可选)"; -// 读万卷书,行万里路. From Chinese verse, Similar to the old saying: study, every day. -"registrationWelcome" = "读万卷书,行万里路."; +"registrationWelcome" = "读万卷书,行万里路."; // From Chinese verse, Similar to the old saying: study, every day. "registrationUsernameAssignedPrefix" = "您的用户名是:"; "registrationChangeUsername" = "更改用户名"; "registrationEdit" = "编辑"; From f4c501f42cdcfd902c491952569f387f4a521550 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Wed, 25 Jan 2023 09:16:01 -0800 Subject: [PATCH 2/8] add missing semiclon in strings file --- apple/OmnivoreKit/Sources/Views/LocalText.swift | 4 +++- .../Sources/Views/Resources/en.lproj/Localizable.strings | 2 +- .../Sources/Views/Resources/zh-Hans.lproj/Localizable.strings | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apple/OmnivoreKit/Sources/Views/LocalText.swift b/apple/OmnivoreKit/Sources/Views/LocalText.swift index 148be5252..811426c7b 100644 --- a/apple/OmnivoreKit/Sources/Views/LocalText.swift +++ b/apple/OmnivoreKit/Sources/Views/LocalText.swift @@ -2,7 +2,9 @@ import Foundation public enum LocalText { public static func localText(key: String, comment: String? = nil) -> String { - NSLocalizedString(key, bundle: .module, comment: comment ?? "no comment provided by developer") + let string = NSLocalizedString(key, bundle: .module, comment: comment ?? "no comment provided by developer") + print(string) + return string } // Share extension diff --git a/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings b/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings index 77c6164c4..daabd3fa9 100644 --- a/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings +++ b/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings @@ -55,7 +55,7 @@ "clubsName" = "Club Name"; "clubsCreate" = "Create a new club"; "clubsYours" = "Your clubs"; -"clubsNotAMemberMessage" = "You are not a member of any clubs.\nCreate a new club and send the invite link to your friends get started.\n\nDuring the beta you are limited to creating three clubs, and each club\ncan have a maximum of twelve users." +"clubsNotAMemberMessage" = "You are not a member of any clubs.\nCreate a new club and send the invite link to your friends get started.\n\nDuring the beta you are limited to creating three clubs, and each club\ncan have a maximum of twelve users."; "clubsErrorCopying" = "Error copying invite URL"; "clubsAdminDenyViewing" = "The admin of this club does not allow viewing all members."; "clubsNoMembers" = "This club does not have any members. Add users to your club by sending\nthem the invite link."; diff --git a/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings b/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings index 21d6270cc..6f62d6537 100644 --- a/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings +++ b/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings @@ -55,7 +55,7 @@ "clubsName" = "读书俱乐部名称"; "clubsCreate" = "创建新读书俱乐部"; "clubsYours" = "您的读书俱乐部"; -"clubsNotAMemberMessage" = "您不是任何读书俱乐部的成员.\n创建新读书俱乐部并将邀请链接发送给您的朋友开始使用.\n\n在测试期间您只能创建三个读书俱乐部, 且每个读书俱乐部\n最多可以有 12 个用户." +"clubsNotAMemberMessage" = "您不是任何读书俱乐部的成员.\n创建新读书俱乐部并将邀请链接发送给您的朋友开始使用.\n\n在测试期间您只能创建三个读书俱乐部, 且每个读书俱乐部\n最多可以有 12 个用户."; "clubsErrorCopying" = "复制邀请 URL 时出错"; "clubsAdminDenyViewing" = "此读书俱乐部的管理员不允许查看所有成员."; "clubsNoMembers" = "此读书俱乐部没有任何成员. 通过向用户发送邀请链接\n将用户添加到您的读书俱乐部."; From 8c9d8816c76a93b22144742d746030a0157e8544 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Wed, 25 Jan 2023 09:28:27 -0800 Subject: [PATCH 3/8] add unit tests to default ios test plan --- apple/Omnivore-iOS.xctestplan | 35 +++++++++++++++++++ .../Sources/Views/SnoozeView.swift | 2 +- .../Tests/ViewsTests/HomeFeedViewTests.swift | 4 +-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/apple/Omnivore-iOS.xctestplan b/apple/Omnivore-iOS.xctestplan index edfeb2059..385bb5cd0 100644 --- a/apple/Omnivore-iOS.xctestplan +++ b/apple/Omnivore-iOS.xctestplan @@ -34,6 +34,41 @@ "identifier" : "042F48D826DFD10E00BF98FC", "name" : "UITests-iOS" } + }, + { + "target" : { + "containerPath" : "container:OmnivoreKit", + "identifier" : "AppTests", + "name" : "AppTests" + } + }, + { + "target" : { + "containerPath" : "container:OmnivoreKit", + "identifier" : "ModelsTests", + "name" : "ModelsTests" + } + }, + { + "target" : { + "containerPath" : "container:OmnivoreKit", + "identifier" : "ServicesTests", + "name" : "ServicesTests" + } + }, + { + "target" : { + "containerPath" : "container:OmnivoreKit", + "identifier" : "UtilsTests", + "name" : "UtilsTests" + } + }, + { + "target" : { + "containerPath" : "container:OmnivoreKit", + "identifier" : "ViewsTests", + "name" : "ViewsTests" + } } ], "version" : 1 diff --git a/apple/OmnivoreKit/Sources/Views/SnoozeView.swift b/apple/OmnivoreKit/Sources/Views/SnoozeView.swift index 3209144b2..70191325d 100644 --- a/apple/OmnivoreKit/Sources/Views/SnoozeView.swift +++ b/apple/OmnivoreKit/Sources/Views/SnoozeView.swift @@ -87,7 +87,7 @@ private struct SnoozeIconButtonView: View { } } -private struct Snooze { +struct Snooze { let until: Date let icon: Image let title: String diff --git a/apple/OmnivoreKit/Tests/ViewsTests/HomeFeedViewTests.swift b/apple/OmnivoreKit/Tests/ViewsTests/HomeFeedViewTests.swift index c8fb05b28..8d86e039f 100644 --- a/apple/OmnivoreKit/Tests/ViewsTests/HomeFeedViewTests.swift +++ b/apple/OmnivoreKit/Tests/ViewsTests/HomeFeedViewTests.swift @@ -11,7 +11,7 @@ final class HomeFeedViewTests: XCTestCase { func test_weekdayBefore8PM() { let now = parse("2022-01-31T10:11:12-08:00") - let snoozes = HomeFeedView.snoozeValuesForDate(now: now) + let snoozes = Snooze.snoozeValuesForDate(now: now) XCTAssertEqual(snoozes[0].until, parse("2022-01-31T20:00:00-08:00")) XCTAssertEqual(snoozes[1].until, parse("2022-02-01T08:00:00-08:00")) @@ -21,7 +21,7 @@ final class HomeFeedViewTests: XCTestCase { func test_weekdayAfter8PM() { let now = parse("2022-01-31T20:11:12-08:00") - let snoozes = HomeFeedView.snoozeValuesForDate(now: now) + let snoozes = Snooze.snoozeValuesForDate(now: now) XCTAssertEqual(snoozes[0].until, parse("2022-02-01T08:00:00-08:00")) XCTAssertEqual(snoozes[1].until, parse("2022-02-01T20:00:00-08:00")) From 06b3150252b0949cb3bf43e2127310f3894110fa Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Wed, 25 Jan 2023 10:06:23 -0800 Subject: [PATCH 4/8] add unit test to make sure Localizable.strings files are syntactically correct --- .../OmnivoreKit/Sources/Views/LocalText.swift | 4 +-- .../Tests/ViewsTests/LocalTextTests.swift | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 apple/OmnivoreKit/Tests/ViewsTests/LocalTextTests.swift diff --git a/apple/OmnivoreKit/Sources/Views/LocalText.swift b/apple/OmnivoreKit/Sources/Views/LocalText.swift index 811426c7b..148be5252 100644 --- a/apple/OmnivoreKit/Sources/Views/LocalText.swift +++ b/apple/OmnivoreKit/Sources/Views/LocalText.swift @@ -2,9 +2,7 @@ import Foundation public enum LocalText { public static func localText(key: String, comment: String? = nil) -> String { - let string = NSLocalizedString(key, bundle: .module, comment: comment ?? "no comment provided by developer") - print(string) - return string + NSLocalizedString(key, bundle: .module, comment: comment ?? "no comment provided by developer") } // Share extension diff --git a/apple/OmnivoreKit/Tests/ViewsTests/LocalTextTests.swift b/apple/OmnivoreKit/Tests/ViewsTests/LocalTextTests.swift new file mode 100644 index 000000000..dcd626dab --- /dev/null +++ b/apple/OmnivoreKit/Tests/ViewsTests/LocalTextTests.swift @@ -0,0 +1,31 @@ +@testable import Views +import XCTest + +final class LocalTextTests: XCTestCase { + func testThatLocalTextFindsStrings() { + // Make sure that the same key is not returned when looking up a localized string by key + // Testing the first and last entry in teh strings file is adequate for finding syntax errors. + // If any entry is not proper than the key will be returned and the test will fail. + + // English (test default) + XCTAssertNotEqual(LocalText.saveArticleSavedState, "saveArticleSavedState") + XCTAssertNotEqual(LocalText.errorNetwork, "errorNetwork") + + // Simple Chinese + XCTAssertNotEqual(simpleChineseText(key: "saveArticleSavedState"), "saveArticleSavedState") + XCTAssertNotEqual(simpleChineseText(key: "errorNetwork"), "errorNetwork") + } + + private func simpleChineseText(key: String) -> String { + guard + let bundlePath = Bundle.module.path(forResource: "zh-Hans", ofType: "lproj"), + let bundle = Bundle(path: bundlePath) + else { return key } + + return NSLocalizedString(key, bundle: bundle, comment: "") + } + + static var allTests = [ + ("testThatLocalTextFindsStrings", testThatLocalTextFindsStrings) + ] +} From 3b5350eced150715f984ec125782e63032833dcb Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Wed, 25 Jan 2023 10:23:01 -0800 Subject: [PATCH 5/8] modify language unit tests to work on all locales --- .../OmnivoreKit/Sources/Views/LocalText.swift | 2 +- .../Resources/en.lproj/Localizable.strings | 8 +++++ .../Resources/es.lproj/Localizable.strings | 8 +++++ .../zh-Hans.lproj/Localizable.strings | 8 +++++ .../Tests/ViewsTests/LocalTextTests.swift | 35 ++++++++++--------- 5 files changed, 44 insertions(+), 17 deletions(-) diff --git a/apple/OmnivoreKit/Sources/Views/LocalText.swift b/apple/OmnivoreKit/Sources/Views/LocalText.swift index 148be5252..b4382db02 100644 --- a/apple/OmnivoreKit/Sources/Views/LocalText.swift +++ b/apple/OmnivoreKit/Sources/Views/LocalText.swift @@ -1,7 +1,7 @@ import Foundation public enum LocalText { - public static func localText(key: String, comment: String? = nil) -> String { + private static func localText(key: String, comment: String? = nil) -> String { NSLocalizedString(key, bundle: .module, comment: comment ?? "no comment provided by developer") } diff --git a/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings b/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings index daabd3fa9..25186c59c 100644 --- a/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings +++ b/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings @@ -1,3 +1,7 @@ +// Unit test Entry -- Do not remove this or add entries before this one. +// This allows us to check for syntax errors in this file with a unit test +"unitTestLeadingEntry" = "For testing purposes only."; + // share extension "saveArticleSavedState" = "Saved to Omnivore"; "saveArticleProcessingState" = "Saved to Omnivore"; @@ -190,3 +194,7 @@ "errorNetwork" = "We are having trouble connecting to the internet."; // TODO: search navigationTitle, toggle, section, button, Label + +// Unit test Entry -- Do not remove this or add entries after this one. +// This allows us to check for syntax errors in this file with a unit test +"unitTestTrailingEntry" = "For testing purposes only."; diff --git a/apple/OmnivoreKit/Sources/Views/Resources/es.lproj/Localizable.strings b/apple/OmnivoreKit/Sources/Views/Resources/es.lproj/Localizable.strings index 211e0e6ca..8180cd519 100644 --- a/apple/OmnivoreKit/Sources/Views/Resources/es.lproj/Localizable.strings +++ b/apple/OmnivoreKit/Sources/Views/Resources/es.lproj/Localizable.strings @@ -1 +1,9 @@ +// Unit test Entry -- Do not remove this or add entries before this one. +// This allows us to check for syntax errors in this file with a unit test +"unitTestLeadingEntry" = "For testing purposes only."; + "googleSignInButton" = "Continuar con Google"; + +// Unit test Entry -- Do not remove this or add entries after this one. +// This allows us to check for syntax errors in this file with a unit test +"unitTestTrailingEntry" = "For testing purposes only."; diff --git a/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings b/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings index 6f62d6537..40169cd31 100644 --- a/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings +++ b/apple/OmnivoreKit/Sources/Views/Resources/zh-Hans.lproj/Localizable.strings @@ -1,3 +1,7 @@ +// Unit test Entry -- Do not remove this or add entries before this one. +// This allows us to check for syntax errors in this file with a unit test +"unitTestLeadingEntry" = "For testing purposes only."; + // share extension "saveArticleSavedState" = "正在保存到 Omnivore 中"; "saveArticleProcessingState" = "已经保存到 Omnivore 中"; @@ -198,3 +202,7 @@ // "username.validation.error.tooshort" = "用户名应至少包含 3 个英文字符."; // "username.validation.error.toolong" = "用户名不能超过 15 个英文字符."; // "saveArticleSavingState" = "保存中..."; + +// Unit test Entry -- Do not remove this or add entries after this one. +// This allows us to check for syntax errors in this file with a unit test +"unitTestTrailingEntry" = "For testing purposes only."; diff --git a/apple/OmnivoreKit/Tests/ViewsTests/LocalTextTests.swift b/apple/OmnivoreKit/Tests/ViewsTests/LocalTextTests.swift index dcd626dab..08800e54d 100644 --- a/apple/OmnivoreKit/Tests/ViewsTests/LocalTextTests.swift +++ b/apple/OmnivoreKit/Tests/ViewsTests/LocalTextTests.swift @@ -7,25 +7,28 @@ final class LocalTextTests: XCTestCase { // Testing the first and last entry in teh strings file is adequate for finding syntax errors. // If any entry is not proper than the key will be returned and the test will fail. - // English (test default) - XCTAssertNotEqual(LocalText.saveArticleSavedState, "saveArticleSavedState") - XCTAssertNotEqual(LocalText.errorNetwork, "errorNetwork") - - // Simple Chinese - XCTAssertNotEqual(simpleChineseText(key: "saveArticleSavedState"), "saveArticleSavedState") - XCTAssertNotEqual(simpleChineseText(key: "errorNetwork"), "errorNetwork") - } - - private func simpleChineseText(key: String) -> String { - guard - let bundlePath = Bundle.module.path(forResource: "zh-Hans", ofType: "lproj"), - let bundle = Bundle(path: bundlePath) - else { return key } - - return NSLocalizedString(key, bundle: bundle, comment: "") + for languageCode in LanguageCode.allCases { + XCTAssertNotEqual(languageCode.translation(key: "unitTestLeadingEntry"), "unitTestLeadingEntry") + XCTAssertNotEqual(languageCode.translation(key: "unitTestTrailingEntry"), "unitTestTrailingEntry") + } } static var allTests = [ ("testThatLocalTextFindsStrings", testThatLocalTextFindsStrings) ] } + +private enum LanguageCode: String, CaseIterable { + case english = "en" + case simpleChinese = "zh-Hans" + case spanish = "es" + + func translation(key: String) -> String { + guard + let bundlePath = Bundle.module.path(forResource: rawValue, ofType: "lproj"), + let bundle = Bundle(path: bundlePath) + else { return key } + + return NSLocalizedString(key, bundle: bundle, comment: "") + } +} From c4861679697148d88d142be798053b6226f5e0e9 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Wed, 25 Jan 2023 10:59:38 -0800 Subject: [PATCH 6/8] use more LocalText --- .../App/Views/Profile/ManageAccountView.swift | 8 ++++---- .../Views/Profile/NewsletterEmailsView.swift | 2 +- .../Sources/App/Views/Profile/ProfileView.swift | 2 +- .../Profile/PushNotificationDevicesView.swift | 4 ++-- .../Profile/PushNotificationSettingsView.swift | 12 +++--------- .../Views/Profile/RecommendationGroupView.swift | 17 ++++++++--------- .../Profile/RecommendationGroupsView.swift | 16 ++++------------ .../App/Views/WebReader/RecommendToView.swift | 4 +--- .../Sources/Views/CommunityModal.swift | 12 ++++++------ .../PushNotificationPrimerView.swift | 8 ++++---- 10 files changed, 34 insertions(+), 51 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/ManageAccountView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/ManageAccountView.swift index e3db2601e..020909470 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/ManageAccountView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/ManageAccountView.swift @@ -35,18 +35,18 @@ struct ManageAccountView: View { action: { showDeleteAccountConfirmation = true }, - label: { Text("Delete Account") } + label: { Text(LocalText.manageAccountDelete) } ) Button( action: { dataService.resetCoreData() }, - label: { Text("Reset Data Cache") } + label: { Text(LocalText.manageAccountResetCache) } ) .alert(isPresented: $showDeleteAccountConfirmation) { Alert( - title: Text("Are you sure you want to delete your account? This action can't be undone."), - primaryButton: .destructive(Text("Delete Account")) { + title: Text(LocalText.manageAccountConfirmDeleteMessage), + primaryButton: .destructive(Text(LocalText.manageAccountDelete)) { Task { await viewModel.deleteAccount(dataService: dataService, authenticator: authenticator) } diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/NewsletterEmailsView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/NewsletterEmailsView.swift index ffd878a3a..b6f9ada3b 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/NewsletterEmailsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/NewsletterEmailsView.swift @@ -73,7 +73,7 @@ struct NewsletterEmailsView: View { } if !viewModel.emails.isEmpty { - Section(header: Text("Existing Emails (Tap to copy)")) { + Section(header: Text(LocalText.newsletterEmailsExisting)) { ForEach(viewModel.emails) { newsletterEmail in Button( action: { diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift index 57620e2fe..9cf579550 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift @@ -152,7 +152,7 @@ struct ProfileView: View { } .alert(isPresented: $showLogoutConfirmation) { Alert( - title: Text("Are you sure you want to logout?"), + title: Text(LocalText.profileConfirmLogoutMessage), primaryButton: .destructive(Text("Confirm")) { authenticator.logout(dataService: dataService) }, diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/PushNotificationDevicesView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/PushNotificationDevicesView.swift index 00c90617c..b334cea50 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/PushNotificationDevicesView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/PushNotificationDevicesView.swift @@ -60,9 +60,9 @@ struct PushNotificationDevicesView: View { private var innerBody: some View { List { - Section(header: Text("Registered device tokens (swipe to remove)")) { + Section(header: Text(LocalText.devicesTokensTitle)) { ForEach(viewModel.devices) { device in - Text("Created: \(createdStr(device))") + Text("\(LocalText.devicesCreated)\(createdStr(device))") .swipeActions(edge: .trailing) { Button( role: .destructive, diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/PushNotificationSettingsView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/PushNotificationSettingsView.swift index afd361772..330291138 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/PushNotificationSettingsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/PushNotificationSettingsView.swift @@ -69,19 +69,13 @@ struct PushNotificationSettingsView: View { private var innerBody: some View { Group { Section { - Toggle(isOn: $viewModel.desiredNotificationsEnabled, label: { Text("Notifications Enabled") }) + Toggle(isOn: $viewModel.desiredNotificationsEnabled, label: { Text(LocalText.notificationsEnabled) }) }.onChange(of: viewModel.desiredNotificationsEnabled) { _ in viewModel.tryUpdateToDesired(dataService: dataService) } - Section { - Text(""" - Enabling push notifications gives Omnivore device permission to send notifications, \ - but you are in charge of which notifications are sent. - - Push notifications are triggered using your \ - [account rules](https://omnivore.app/settings/rules) which you can edit online. - """) + Section { // TODO: double check this text + Text("\(LocalText.notificationsExplainer)\n\(LocalText.notificationsTriggerExplainer)") .accentColor(.blue) } diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupView.swift index f91c64577..c076ce392 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupView.swift @@ -109,7 +109,7 @@ struct RecommendationGroupView: View { if let shareLink = URL(string: viewModel.recommendationGroup.inviteUrl) { return AnyView(ShareSheet(activityItems: [shareLink])) } else { - return AnyView(Text("Error copying invite URL")) + return AnyView(Text(LocalText.clubsErrorCopying)) } } @@ -127,9 +127,9 @@ struct RecommendationGroupView: View { private var membersSection: some View { Section("Members") { - if !viewModel.recommendationGroup.canSeeMembers { + if !viewModel.recommendationGroup.canSeeMembers { // TODO: might need to fix text here Text(""" - The admin of this club does not allow viewing all members. + \(LocalText.clubsAdminDenyViewing) [Learn more about clubs](https://blog.omnivore.app/p/dca38ba4-8a74-42cc-90ca-d5ffa5d075cc) """) @@ -142,10 +142,9 @@ struct RecommendationGroupView: View { imageURL: member.profileImageURL != nil ? URL(string: member.profileImageURL!) : nil )) } - } else { + } else { // TODO: fix link text to use translation Text(""" - This club does not have any members. Add users to your club by sending - them the invite link. + \(LocalText.clubsNoMembers) [Learn more about clubs](https://blog.omnivore.app/p/dca38ba4-8a74-42cc-90ca-d5ffa5d075cc) """) @@ -160,7 +159,7 @@ struct RecommendationGroupView: View { } return AnyView(Button(action: { viewModel.showLeaveGroup = true - }, label: { Text("Leave Club") }) + }, label: { Text(LocalText.clubsLeave) }) .accentColor(.red)) } @@ -196,8 +195,8 @@ struct RecommendationGroupView: View { } .alert(isPresented: $viewModel.showLeaveGroup) { Alert( - title: Text("Are you sure you want to leave this club? No data will be deleted, but you will stop receiving recommendations from the club."), - primaryButton: .destructive(Text("Leave Club")) { + title: Text(Localtext.clubsLeaveConfirm), + primaryButton: .destructive(Text(LocalText.clubsLeave)) { Task { let success = await viewModel.leaveGroup(dataService: dataService) if success { diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupsView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupsView.swift index 0df891584..701510ca1 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupsView.swift @@ -72,7 +72,7 @@ struct CreateRecommendationGroupView: View { var body: some View { NavigationView { Form { - TextField("Name", text: $name, prompt: Text("Club Name")) + TextField("Name", text: $name, prompt: Text(Localtext.clubsName)) Section("Club Rules") { Toggle("Only admins can post", isOn: $viewModel.onlyAdminCanPost) @@ -143,7 +143,7 @@ struct GroupsView: View { label: { HStack { Image(systemName: "plus.circle.fill").foregroundColor(.green) - Text("Create a new club") + Text(LocalText.clubsCreate) Spacer() } } @@ -152,7 +152,7 @@ struct GroupsView: View { if !viewModel.isLoading { if viewModel.recommendationGroups.count > 0 { - Section(header: Text("Your clubs")) { + Section(header: Text(LocalText.clubsYours)) { ForEach(viewModel.recommendationGroups) { recommendationGroup in let vm = RecommendationsGroupViewModel(recommendationGroup: recommendationGroup) NavigationLink( @@ -164,15 +164,7 @@ struct GroupsView: View { } } else { Section { - Text(""" - You are not a member of any clubs. - Create a new club and send the invite link to your friends get started. - - During the beta you are limited to creating three clubs, and each club - can have a maximum of twelve users. - - [Learn more about clubs](https://blog.omnivore.app/p/dca38ba4-8a74-42cc-90ca-d5ffa5d075cc) - """) + Text(LocalText.clubsNotAMemberMessage) .accentColor(.blue) } } diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift index 80ecc315a..e5baeeb32 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift @@ -163,9 +163,7 @@ struct RecommendToView: View { List { if !viewModel.isLoading, viewModel.recommendationGroups.count < 1 { Text(""" - You do not have any clubs you can post to. - - Join a club or create your own to start recommending articles. + \(LocalText.clubsNoneJoined) [Learn more about clubs](https://blog.omnivore.app/p/dca38ba4-8a74-42cc-90ca-d5ffa5d075cc) """) diff --git a/apple/OmnivoreKit/Sources/Views/CommunityModal.swift b/apple/OmnivoreKit/Sources/Views/CommunityModal.swift index 9198a93c7..c8a60b06e 100644 --- a/apple/OmnivoreKit/Sources/Views/CommunityModal.swift +++ b/apple/OmnivoreKit/Sources/Views/CommunityModal.swift @@ -54,7 +54,7 @@ public struct CommunityModal: View { public var header: some View { VStack(spacing: 0) { - Text("Help build the Omnivore Community") + Text(LocalText.communityHeadline) .font(.textToSpeechRead) .foregroundColor(Color.appGrayTextContrast) .frame(maxWidth: .infinity, alignment: .leading) @@ -71,10 +71,10 @@ public struct CommunityModal: View { } let links = [ - (title: "Tweet about Omnivore", url: tweetUrl), - (title: "Follow us on Twitter", url: "https://twitter.com/omnivoreapp"), - (title: "Join us on Discord", url: "https://discord.gg/h2z5rppzz9"), - (title: "Star on GitHub", url: "https://github.com/omnivore-app/omnivore") + (title: LocalText.communityTweet, url: tweetUrl), + (title: LocalText.communityFollowTwitter, url: "https://twitter.com/omnivoreapp"), + (title: LocalText.communityJoinDiscord, url: "https://discord.gg/h2z5rppzz9"), + (title: LocalText.communityStarGithub, url: "https://github.com/omnivore-app/omnivore") ] var buttonLinks: some View { @@ -83,7 +83,7 @@ public struct CommunityModal: View { if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene { SKStoreReviewController.requestReview(in: scene) } - }, label: { Text("Review on the AppStore") }) + }, label: { Text(LocalText.communityAppstoreReview) }) .frame(maxWidth: .infinity, alignment: .leading) ForEach(links, id: \.url) { link in diff --git a/apple/OmnivoreKit/Sources/Views/PushNotifications/PushNotificationPrimerView.swift b/apple/OmnivoreKit/Sources/Views/PushNotifications/PushNotificationPrimerView.swift index 6d2f80366..ee2799437 100644 --- a/apple/OmnivoreKit/Sources/Views/PushNotifications/PushNotificationPrimerView.swift +++ b/apple/OmnivoreKit/Sources/Views/PushNotifications/PushNotificationPrimerView.swift @@ -21,12 +21,12 @@ import SwiftUI .smallOmnivoreLogo .resizable() .frame(width: 30, height: 30) - Text("Enable Push Notifications?") + Text(LocalText.notificationsEnable) .font(.appHeadline) } // swiftlint:disable:next line_length - Text("Get notified when newsletter links reach your inbox. Or receive reminders that you set from our share extension.") + Text(LocalText.notificationsGeneralExplainer) .font(.appBody) .multilineTextAlignment(.leading) .lineLimit(nil) @@ -35,8 +35,8 @@ import SwiftUI HStack { Spacer() - Button(action: denyAction, label: { Text("No Thanks") }) - Button(action: acceptAction, label: { Text("Yes Please") }) + Button(action: denyAction, label: { Text(LocalText.notificationsOptionDeny) }) + Button(action: acceptAction, label: { Text(LocalText.notificationsOptionEnable) }) } .buttonStyle(BorderedButtonStyle(color: .appTextDefault)) } From 1cbaa871018a3b73d613e501d356132beb927531 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Wed, 25 Jan 2023 12:45:12 -0800 Subject: [PATCH 7/8] apply local text on for text (other than generic list) --- .../OmnivoreKit/Sources/App/MacMenuCommands.swift | 12 ++++++------ .../Sources/App/Views/DebugMenuView.swift | 6 +++--- .../Sources/App/Views/PrimaryContentView.swift | 4 ++-- .../Sources/App/Views/Profile/Subscriptions.swift | 4 ++-- .../App/Views/Profile/TextToSpeechView.swift | 8 ++++---- .../Profile/TextToSpeechVoiceSelectionView.swift | 8 ++++---- .../App/Views/Registration/CreateProfileView.swift | 4 ++-- .../EmailAuth/EmailLoginFormView.swift | 8 ++++---- .../EmailAuth/EmailSignupFormView.swift | 8 ++++---- .../Views/Registration/NewAppleSignupView.swift | 6 +++--- .../App/Views/WebReader/RecommendToView.swift | 6 +++--- .../App/Views/WebReader/WebReaderContainer.swift | 6 +++--- .../Sources/App/Views/WelcomeView.swift | 14 +++++++------- .../Views/Article/HighlightAnnotationSheet.swift | 2 +- 14 files changed, 48 insertions(+), 48 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift b/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift index 4cc36fa9b..b136aa554 100644 --- a/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift +++ b/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift @@ -20,7 +20,7 @@ import Views storedFontSize = max(storedFontSize - 2, 10) NSNotification.readerSettingsChanged() }, - label: { Text("Decrease Font Size") + label: { Text(LocalText.keyboardCommandDecreaseFont) } ) .keyboardShortcut("-") @@ -30,7 +30,7 @@ import Views storedFontSize = min(storedFontSize + 2, 28) NSNotification.readerSettingsChanged() }, - label: { Text("Increase Font Size") } + label: { Text(LocalText.keyboardCommandIncreaseFont) } ) .keyboardShortcut("+") } @@ -43,7 +43,7 @@ import Views storedMaxWidthPercentage = min(storedMaxWidthPercentage + 10, 100) NSNotification.readerSettingsChanged() }, - label: { Text("Decrease Margin") + label: { Text(LocalText.keyboardCommandDecreaseMargin) } ) .keyboardShortcut("[") @@ -53,7 +53,7 @@ import Views storedMaxWidthPercentage = max(storedMaxWidthPercentage - 10, 40) NSNotification.readerSettingsChanged() }, - label: { Text("Increase Margin") + label: { Text(LocalText.keyboardCommandIncreaseMargin) } ) .keyboardShortcut("]") @@ -67,7 +67,7 @@ import Views storedLineSpacing = max(storedLineSpacing - 25, 100) NSNotification.readerSettingsChanged() }, - label: { Text("Decrease Line Spacing") } + label: { Text(LocalText.keyboardCommandDecreaseLineSpacing) } ) .keyboardShortcut("k") @@ -76,7 +76,7 @@ import Views storedLineSpacing = min(storedLineSpacing + 25, 300) NSNotification.readerSettingsChanged() }, - label: { Text("Increase Line Spacing") } + label: { Text(LocalText.keyboardCommandIncreaseLineSpacing) } ) .keyboardShortcut("l") } diff --git a/apple/OmnivoreKit/Sources/App/Views/DebugMenuView.swift b/apple/OmnivoreKit/Sources/App/Views/DebugMenuView.swift index 32da93f6c..dfb10939f 100644 --- a/apple/OmnivoreKit/Sources/App/Views/DebugMenuView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/DebugMenuView.swift @@ -12,11 +12,11 @@ struct DebugMenuView: View { var body: some View { VStack { - Text("Debug Menu") + Text(LocalText.menuDebugTitle) .font(.appTitle) Form { - Text("API Environment:") - Picker(selection: $selectedEnvironment, label: Text("API Environment:")) { + Text(LocalText.menuDebugApiEnv) + Picker(selection: $selectedEnvironment, label: Text(LocalText.menuDebugApiEnv)) { ForEach(appEnvironments, id: \.self) { Text($0.rawValue) } diff --git a/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift b/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift index 5121c2186..571c947ae 100644 --- a/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift @@ -32,7 +32,7 @@ public struct PrimaryContentView: View { PrimaryContentCategory.feed.destinationView // Third column is the detail view - Text("Select a link from the feed") + Text(LocalText.navigationSelectLink) } .accentColor(.appGrayTextContrast) } @@ -95,7 +95,7 @@ struct PrimaryContentSidebar: View { #selector(NSSplitViewController.toggleSidebar(_:)), with: nil ) }, - label: { Label("Toggle sidebar", systemImage: "sidebar.left") } + label: { Label(LocalText.navigationSelectSidebarToggle, systemImage: "sidebar.left") } ) } } diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/Subscriptions.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/Subscriptions.swift index 28faec9e0..b8f1fcc1e 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/Subscriptions.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/Subscriptions.swift @@ -57,7 +57,7 @@ struct SubscriptionsView: View { .task { await viewModel.loadSubscriptions(dataService: dataService) } } else if viewModel.hasNetworkError { VStack { - Text("Sorry, we were unable to retrieve your subscriptions.").multilineTextAlignment(.center) + Text(LocalText.subscriptionsErrorRetrieving).multilineTextAlignment(.center) Button( action: { Task { await viewModel.loadSubscriptions(dataService: dataService) } }, label: { Text("Retry") } @@ -67,7 +67,7 @@ struct SubscriptionsView: View { } else if viewModel.subscriptions.isEmpty { VStack(alignment: .center) { Spacer() - Text("You have no current subscriptions.") + Text(LocalText.subscriptionsNone) Spacer() } } else { diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechView.swift index 3aad4e53c..d09feae6f 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechView.swift @@ -10,11 +10,11 @@ var body: some View { Group { Form { - Section("Audio Settings") { - Toggle("Enable audio prefetch", isOn: $audioController.preloadEnabled) + Section(LocalText.texttospeechSettingsAudio) { + Toggle(LocalText.texttospeechSettingsEnablePrefetch, isOn: $audioController.preloadEnabled) } - NavigationLink(destination: TextToSpeechLanguageView().navigationTitle("Default Language")) { - Text("Default Language") + NavigationLink(destination: TextToSpeechLanguageView().navigationTitle(LocalText.texttospeechLanguageDefault)) { + Text(LocalText.texttospeechLanguageDefault) } innerBody } diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechVoiceSelectionView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechVoiceSelectionView.swift index f0ddaf888..99527abf1 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechVoiceSelectionView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechVoiceSelectionView.swift @@ -25,7 +25,7 @@ if FeatureFlag.enableUltraRealisticVoices, language.key == "en" { if viewModel.waitingForRealisticVoices { HStack { - Text("Signing up for beta") + Text(LocalText.texttospeechBetaSignupInProcess) Spacer() ProgressView() } @@ -35,13 +35,13 @@ } if !viewModel.waitingForRealisticVoices, !audioController.ultraRealisticFeatureKey.isEmpty { - Text("You are in the ultra realistic voices beta. During the beta you can listen to 10,000 words of audio per day.") + Text(LocalText.texttospeechBetaRealisticVoiceLimit) .multilineTextAlignment(.leading) } else if audioController.ultraRealisticFeatureRequested { - Text("Your request to join the ultra realistic voices demo has been received. You will be informed by email when a spot is available.") + Text(LocalText.texttospeechBetaRequestReceived) .multilineTextAlignment(.leading) } else { - Text("Ultra realistic voices are currently in limited beta. Enabling the feature will add you to the beta queue.") + Text(LocalText.texttospeechBetaWaitlist) .multilineTextAlignment(.leading) } } diff --git a/apple/OmnivoreKit/Sources/App/Views/Registration/CreateProfileView.swift b/apple/OmnivoreKit/Sources/App/Views/Registration/CreateProfileView.swift index bc60ce80e..788cc7b01 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Registration/CreateProfileView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Registration/CreateProfileView.swift @@ -149,7 +149,7 @@ struct CreateProfileView: View { VStack(alignment: .leading, spacing: 6) { HStack { VStack(alignment: .leading, spacing: 6) { - Text("Username") + Text(LocalText.registrationUsername) .font(.appFootnote) .foregroundColor(.appGrayText) TextField("", text: $viewModel.potentialUsername) @@ -173,7 +173,7 @@ struct CreateProfileView: View { .animation(.default, value: 0.35) VStack(alignment: .leading, spacing: 6) { - Text("Bio (optional)") + Text(LocalText.registrationBio) .font(.appFootnote) .foregroundColor(.appGrayText) TextEditor(text: $bio) diff --git a/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailLoginFormView.swift b/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailLoginFormView.swift index d7b78705c..37f162c5b 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailLoginFormView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailLoginFormView.swift @@ -101,7 +101,7 @@ struct EmailLoginFormView: View { Button( action: { viewModel.emailAuthState = .signUp }, label: { - Text("Don't have an account?") + Text(Localtext.registrationNoAccount) .foregroundColor(.appGrayTextContrast) .underline() } @@ -121,7 +121,7 @@ struct EmailLoginFormView: View { openURL(url) }, label: { - Text("Forgot your password?") + Text(LocalText.registrationForgotPassword) .foregroundColor(.appGrayTextContrast) .underline() } @@ -175,7 +175,7 @@ struct EmailPendingVerificationView: View { ) } }, - label: { Text("Check Status") } + label: { Text(LocalText.registrationStatusCheck) } ) .buttonStyle(SolidCapsuleButtonStyle(color: .appDeepBackground, width: 300)) @@ -183,7 +183,7 @@ struct EmailPendingVerificationView: View { Button( action: { viewModel.emailAuthState = .signUp }, label: { - Text("Use a different email?") + Text(LocalText.registrationUseDifferentEmail) .foregroundColor(.appGrayTextContrast) .underline() } diff --git a/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailSignupFormView.swift b/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailSignupFormView.swift index a5cd9b927..ba6f39cc1 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailSignupFormView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailSignupFormView.swift @@ -124,7 +124,7 @@ struct EmailSignupFormView: View { // Full Name VStack(alignment: .leading, spacing: 6) { - Text("Full Name") + Text(LocalText.registrationFullName) .font(.appFootnote) .foregroundColor(.appGrayText) TextField("", text: $name) @@ -142,7 +142,7 @@ struct EmailSignupFormView: View { VStack(alignment: .leading, spacing: 6) { HStack { VStack(alignment: .leading, spacing: 6) { - Text("Username") + Text(LocalText.registrationUsername) .font(.appFootnote) .foregroundColor(.appGrayText) TextField("", text: $viewModel.potentialUsername) @@ -194,7 +194,7 @@ struct EmailSignupFormView: View { Button( action: { viewModel.emailAuthState = .signIn }, label: { - Text("Already have an account?") + Text(LocalText.registrationAlreadyHaveAccount) .foregroundColor(.appGrayTextContrast) .underline() } @@ -221,7 +221,7 @@ struct EmailSignupFormView: View { Spacer() } } - .navigationTitle(focusedField == nil ? "Sign Up" : "") + .navigationTitle(focusedField == nil ? LocalText.registrationViewSignUpHeadline : "") .task { viewModel.configureUsernameValidation(dataService: dataService) } diff --git a/apple/OmnivoreKit/Sources/App/Views/Registration/NewAppleSignupView.swift b/apple/OmnivoreKit/Sources/App/Views/Registration/NewAppleSignupView.swift index 3eda742f1..28ccad613 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Registration/NewAppleSignupView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Registration/NewAppleSignupView.swift @@ -28,12 +28,12 @@ struct NewAppleSignupView: View { var body: some View { VStack(spacing: 28) { - Text("Welcome to Omnivore!") + Text(LocalText.registrationWelcome) .font(.appTitle) .multilineTextAlignment(.center) VStack(alignment: .center, spacing: 12) { - Text("Your username is:") + Text(LocalText.registrationUsernameAssignedPrefix) .font(.appBody) .foregroundColor(.appGrayText) Text("@\(userProfile.username)") @@ -54,7 +54,7 @@ struct NewAppleSignupView: View { Button( action: showProfileEditView, - label: { Text("Change Username") } + label: { Text(LocalText.registrationChangeUsername) } ) .buttonStyle(SolidCapsuleButtonStyle(color: .appDeepBackground, width: 300)) diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift index e5baeeb32..7b4c11e26 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift @@ -110,7 +110,7 @@ struct RecommendToView: View { var noteView: some View { VStack { HStack { - Text("To:") + Text(LocalText.recommendationToPrefix) .font(.appCaption) .foregroundColor(.appGrayText) Text(InternalRecommendationGroup.readable(list: viewModel.selectedGroups)) @@ -131,7 +131,7 @@ struct RecommendToView: View { .background(RoundedRectangle(cornerRadius: 8).fill(Color.systemBackground)) ) .overlay( - Text("Add a note (optional)") + Text(LocalText.recommendationAddNote) .allowsHitTesting(false) .opacity(viewModel.note.isEmpty ? 0.4 : 0.0) .font(.appBody) @@ -199,7 +199,7 @@ struct RecommendToView: View { } .alert(isPresented: $viewModel.showError) { Alert( - title: Text("Error recommending this page"), + title: Text(LocalText.recommendationError), dismissButton: .cancel(Text("Ok")) { viewModel.showError = false } diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift index f4fb9dfc9..2940049e8 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift @@ -369,19 +369,19 @@ struct WebReaderContainerView: View { Button(action: { UIPasteboard.general.string = item.unwrappedPageURLString showInSnackbar("Link Copied") - }, label: { Text("Copy Link") }) + }, label: { Text(LocalText.readerCopyLink) }) Button(action: { if let linkToOpen = linkToOpen { viewModel.saveLink(dataService: dataService, url: linkToOpen) } - }, label: { Text("Save to Omnivore") }) + }, label: { Text(LocalText.readerSave) }) } #if os(iOS) .fullScreenCover(item: $safariWebLink) { SafariView(url: $0.url) } #endif - .alert(errorAlertMessage ?? "An error occurred", isPresented: $showErrorAlertMessage) { + .alert(errorAlertMessage ?? LocalText.readerError, isPresented: $showErrorAlertMessage) { Button("Ok", role: .cancel, action: { errorAlertMessage = nil showErrorAlertMessage = false diff --git a/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift b/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift index 8f2aeb312..fdebe1931 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift @@ -34,7 +34,7 @@ struct WelcomeView: View { var headlineText: some View { Group { - Text("Read-it-later for serious readers.") + Text(LocalText.welcomeTitle) } .font(.appLargeTitle) } @@ -55,7 +55,7 @@ struct WelcomeView: View { }, label: { HStack(spacing: 4) { - Text("Learn more") + Text(LocalText.welcomeLearnMore) Image(systemName: "arrow.right") } .font(.appTitleThree) @@ -70,10 +70,10 @@ struct WelcomeView: View { var footerView: some View { Group { - Text("By signing up, you agree to Omnivore’s\n") - + Text("Terms of Service").underline() - + Text(" and ") - + Text(LocalText.privacyPolicyGeneric).underline() + Text(LocalText.welcomeSignupAgreement) + + Text(LocalText.welcomeTitleTermsOfService).underline() + + Text(LocalText.welcomeTitleAndJoiner) + + Text(LocalText.privacyPolicyGeneric).underline() } .font(.appSubheadline) .confirmationDialog("", isPresented: $showTermsLinks, titleVisibility: .hidden) { @@ -163,7 +163,7 @@ struct WelcomeView: View { let emailButton = Button( action: { showEmailLoginModal = true }, label: { - Text("Continue with Email") + Text(LocalText.welcomeTitleEmailContinue) .font(.appHeadline) .foregroundColor(.appGrayTextContrast) .underline() diff --git a/apple/OmnivoreKit/Sources/Views/Article/HighlightAnnotationSheet.swift b/apple/OmnivoreKit/Sources/Views/Article/HighlightAnnotationSheet.swift index d82246b50..3e12773fc 100644 --- a/apple/OmnivoreKit/Sources/Views/Article/HighlightAnnotationSheet.swift +++ b/apple/OmnivoreKit/Sources/Views/Article/HighlightAnnotationSheet.swift @@ -49,7 +49,7 @@ public struct HighlightAnnotationSheet: View { Spacer() } .padding() - .alert(errorAlertMessage ?? "An error occurred", isPresented: $showErrorAlertMessage) { + .alert(errorAlertMessage ?? LocalText.readerError, isPresented: $showErrorAlertMessage) { Button("Ok", role: .cancel, action: { errorAlertMessage = nil showErrorAlertMessage = false From dcf40c1daa8e1a39d62256e63f128c0e4f33e5b7 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Wed, 25 Jan 2023 13:09:19 -0800 Subject: [PATCH 8/8] apply generic local text values --- .../AppExtensions/Share/Views/ShareExtensionView.swift | 6 +++--- apple/OmnivoreKit/Sources/App/MacMenuCommands.swift | 4 ++-- .../OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift | 3 ++- .../Sources/App/PrimaryContentCategory.swift | 2 +- .../OmnivoreKit/Sources/App/Views/DebugMenuView.swift | 2 +- .../App/Views/Highlights/HighlightsListViewModel.swift | 2 +- .../Sources/App/Views/Home/HomeFeedViewIOS.swift | 4 ++-- .../Sources/App/Views/Home/HomeFeedViewMac.swift | 2 +- .../Sources/App/Views/Home/LibrarySearchView.swift | 2 +- .../Sources/App/Views/Labels/ApplyLabelsView.swift | 4 ++-- .../Sources/App/Views/Labels/LabelsView.swift | 2 +- .../Sources/App/Views/LinkItemDetailView.swift | 2 +- .../Sources/App/Views/LinkedItemMetadataEditView.swift | 10 +++++----- .../Sources/App/Views/Profile/ProfileView.swift | 4 ++-- .../App/Views/Profile/RecommendationGroupView.swift | 4 ++-- .../App/Views/Profile/RecommendationGroupsView.swift | 6 +++--- .../Sources/App/Views/Profile/Subscriptions.swift | 2 +- .../App/Views/Registration/CreateProfileView.swift | 4 ++-- .../Registration/EmailAuth/EmailLoginFormView.swift | 8 ++++---- .../Registration/EmailAuth/EmailSignupFormView.swift | 6 +++--- .../App/Views/Registration/NewAppleSignupView.swift | 2 +- .../Sources/App/Views/SelfHostSettingsView.swift | 6 +++--- .../Sources/App/Views/WebReader/RecommendToView.swift | 6 +++--- .../App/Views/WebReader/WebReaderContainer.swift | 8 ++++---- apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift | 6 +++--- .../Views/Article/HighlightAnnotationSheet.swift | 4 ++-- .../Sources/Views/Article/OmnivoreWebView.swift | 4 ++-- .../Sources/Views/FontSizeAdjustmentPopoverView.swift | 2 +- .../Views/Resources/en.lproj/Localizable.strings | 2 +- 29 files changed, 60 insertions(+), 59 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift index f56056fec..1dc41ba03 100644 --- a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift +++ b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift @@ -224,7 +224,7 @@ public struct ShareExtensionView: View { .padding(.trailing, 8) VStack { - Text("Highlight") + Text(LocalText.genericHighlight) .font(.appSubheadline) .foregroundColor(Color.appGrayTextContrast) .frame(maxWidth: .infinity, alignment: .leading) @@ -355,7 +355,7 @@ public struct ShareExtensionView: View { case .editingLabels: return LocalText.labelsGeneric case .viewingHighlight: - return "Highlight" + return LocalText.genericHighlight default: return "" } @@ -479,7 +479,7 @@ public struct ShareExtensionView: View { } .alert("Before saving an article select text in Safari to create a highlight on save.", isPresented: $showHighlightInstructionAlert) { - Button("Ok", role: .cancel) { showHighlightInstructionAlert = false } + Button(LocalText.genericOk, role: .cancel) { showHighlightInstructionAlert = false } } .task { await labelsViewModel.loadLabelsFromStore(dataService: viewModel.services.dataService) diff --git a/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift b/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift index b136aa554..71426eb71 100644 --- a/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift +++ b/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift @@ -104,7 +104,7 @@ import Views Divider() - Picker(selection: $preferredFont, label: Text("Font Family")) { + Picker(selection: $preferredFont, label: Text(LocalText.genericFontFamily)) { ForEach(WebFont.allCases, id: \.self) { font in Text(font.displayValue).tag(font.rawValue) } @@ -112,7 +112,7 @@ import Views Toggle( isOn: $prefersHighContrastText, - label: { Text("High Contrast Text") } + label: { Text(LocalText.genericHighContrastText) } ) } } diff --git a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift index b081212df..d64b600fc 100644 --- a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift +++ b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift @@ -7,6 +7,7 @@ import Utils import PSPDFKit import PSPDFKitUI import Services + import Views struct PDFViewer: View { enum SettingsKeys: String { @@ -134,7 +135,7 @@ import Utils .onShouldShowMenuItemsForSelectedText(perform: { pageView, menuItems, selectedText in let copy = menuItems.first(where: { $0.identifier == "Copy" }) let define = menuItems.first(where: { $0.identifier == "Define" }) - let highlight = MenuItem(title: "Highlight", block: { + let highlight = MenuItem(title: LocalText.genericHighlight, block: { _ = coordinator.highlightSelection( pageView: pageView, selectedText: selectedText, diff --git a/apple/OmnivoreKit/Sources/App/PrimaryContentCategory.swift b/apple/OmnivoreKit/Sources/App/PrimaryContentCategory.swift index 682555142..642a38322 100644 --- a/apple/OmnivoreKit/Sources/App/PrimaryContentCategory.swift +++ b/apple/OmnivoreKit/Sources/App/PrimaryContentCategory.swift @@ -18,7 +18,7 @@ enum PrimaryContentCategory: Identifiable, Hashable, Equatable { case .feed: return "Home" case .profile: - return "Profile" + return LocalText.genericProfile } } diff --git a/apple/OmnivoreKit/Sources/App/Views/DebugMenuView.swift b/apple/OmnivoreKit/Sources/App/Views/DebugMenuView.swift index dfb10939f..6509a09a3 100644 --- a/apple/OmnivoreKit/Sources/App/Views/DebugMenuView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/DebugMenuView.swift @@ -29,7 +29,7 @@ struct DebugMenuView: View { authenticator.logout(dataService: dataService) dataService.switchAppEnvironment(appEnvironment: selectedEnvironment) }, - label: { Text("Apply Changes") } + label: { Text(LocalText.genericChangeApply) } ) .buttonStyle(SolidCapsuleButtonStyle(width: 220)) } diff --git a/apple/OmnivoreKit/Sources/App/Views/Highlights/HighlightsListViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/Highlights/HighlightsListViewModel.swift index 349cc6c5b..7a251029b 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Highlights/HighlightsListViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Highlights/HighlightsListViewModel.swift @@ -68,7 +68,7 @@ struct HighlightListItemParams: Identifiable { highlightItems = highlights.map { HighlightListItemParams( highlightID: $0.unwrappedID, - title: "Highlight", + title: LocalText.genericHighlight, annotation: $0.annotation ?? "", quote: $0.quote ?? "", labels: $0.labels.asArray(of: LinkedItemLabel.self), diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index 6c58731dd..69bcd13a0 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -324,7 +324,7 @@ import Views viewModel.itemToSnoozeID = item.id viewModel.snoozePresented = true } label: { - Label { Text("Snooze") } icon: { Image.moon } + Label { Text(LocalText.genericSnooze) } icon: { Image.moon } } } if let author = item.author { @@ -401,7 +401,7 @@ import Views viewModel.itemToSnoozeID = item.id viewModel.snoozePresented = true } label: { - Label { Text("Snooze") } icon: { Image.moon } + Label { Text(LocalText.genericSnooze) } icon: { Image.moon } }.tint(.appYellow48) } } diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewMac.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewMac.swift index 5731ddde1..b0e4e91f9 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewMac.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewMac.swift @@ -78,7 +78,7 @@ import Views viewModel.itemToSnoozeID = item.id viewModel.snoozePresented = true } label: { - Label { Text("Snooze") } icon: { Image.moon } + Label { Text(LocalText.genericSnooze) } icon: { Image.moon } } } } diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/LibrarySearchView.swift b/apple/OmnivoreKit/Sources/App/Views/Home/LibrarySearchView.swift index b6e06cb44..202f468dc 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/LibrarySearchView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/LibrarySearchView.swift @@ -91,7 +91,7 @@ } listBody .navigationTitle("Search") - .navigationBarItems(trailing: Button(action: { dismiss() }, label: { Text("Close") })) + .navigationBarItems(trailing: Button(action: { dismiss() }, label: { Text(LocalText.genericClose) })) .navigationBarTitleDisplayMode(NavigationBarItem.TitleDisplayMode.inline) .searchable(text: $viewModel.searchTerm, placement: .navigationBarDrawer(displayMode: .always)) { ForEach(viewModel.items) { item in diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift index d3b8adde3..676435c27 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift @@ -21,9 +21,9 @@ struct ApplyLabelsView: View { var confirmButtonText: String { switch self { case .item, .highlight: - return "Save" + return LocalText.genericSave case .list: - return "Done" + return LocalText.doneGeneric } } } diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift index c4dac6a0b..30e7163c3 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift @@ -186,7 +186,7 @@ struct CreateLabelView: View { description: nil ) }, - label: { Text("Create").foregroundColor(.appGrayTextContrast) } + label: { Text(LocalText.genericCreate).foregroundColor(.appGrayTextContrast) } ) .opacity(shouldDisableCreateButton ? 0.2 : 1) .disabled(shouldDisableCreateButton) diff --git a/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift b/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift index 5eeafbe4c..e7f6a4308 100644 --- a/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift @@ -204,7 +204,7 @@ struct LinkItemDetailView: View { } else { HStack(alignment: .center) { Spacer() - Text("Loading...") + Text(LocalText.genericLoading) Spacer() } } diff --git a/apple/OmnivoreKit/Sources/App/Views/LinkedItemMetadataEditView.swift b/apple/OmnivoreKit/Sources/App/Views/LinkedItemMetadataEditView.swift index 4af279429..11cbb47d4 100644 --- a/apple/OmnivoreKit/Sources/App/Views/LinkedItemMetadataEditView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/LinkedItemMetadataEditView.swift @@ -36,7 +36,7 @@ struct LinkedItemMetadataEditView: View { ScrollView(showsIndicators: false) { VStack(alignment: .center, spacing: 16) { VStack(alignment: .leading, spacing: 6) { - Text("Title") + Text(LocalText.genericTitle) .font(.appFootnote) .foregroundColor(.appGrayTextContrast) TextField("", text: $viewModel.title) @@ -44,7 +44,7 @@ struct LinkedItemMetadataEditView: View { } VStack(alignment: .leading, spacing: 6) { - Text("Author") + Text(LocalText.genericAuthor) .font(.appFootnote) .foregroundColor(.appGrayTextContrast) TextField("", text: $viewModel.author) @@ -52,7 +52,7 @@ struct LinkedItemMetadataEditView: View { } VStack(alignment: .leading, spacing: 6) { - Text("Description") + Text(LocalText.genericDescription) .font(.appFootnote) .foregroundColor(.appGrayTextContrast) TextEditor(text: $viewModel.description) @@ -98,7 +98,7 @@ struct LinkedItemMetadataEditView: View { viewModel.submit(dataService: dataService, item: item) presentationMode.wrappedValue.dismiss() }, - label: { Text("Save").foregroundColor(.appGrayTextContrast) } + label: { Text(LocalText.genericSave).foregroundColor(.appGrayTextContrast) } ) } ToolbarItem(placement: .barLeading) { @@ -120,7 +120,7 @@ struct LinkedItemMetadataEditView: View { viewModel.submit(dataService: dataService, item: item) presentationMode.wrappedValue.dismiss() }, - label: { Text("Save").foregroundColor(.appGrayTextContrast) } + label: { Text(LocalText.genericSave).foregroundColor(.appGrayTextContrast) } ) Button( diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift index 9cf579550..5f86e102f 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift @@ -153,7 +153,7 @@ struct ProfileView: View { .alert(isPresented: $showLogoutConfirmation) { Alert( title: Text(LocalText.profileConfirmLogoutMessage), - primaryButton: .destructive(Text("Confirm")) { + primaryButton: .destructive(Text(LocalText.genericConfirm)) { authenticator.logout(dataService: dataService) }, secondaryButton: .cancel() @@ -161,7 +161,7 @@ struct ProfileView: View { } } } - .navigationTitle("Profile") + .navigationTitle(LocalText.genericProfile) } } diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupView.swift index c076ce392..e1d55f92b 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupView.swift @@ -165,7 +165,7 @@ struct RecommendationGroupView: View { private var innerBody: some View { Group { - Section("Name") { + Section(LocalText.genericName) { Text(viewModel.recommendationGroup.name) } @@ -195,7 +195,7 @@ struct RecommendationGroupView: View { } .alert(isPresented: $viewModel.showLeaveGroup) { Alert( - title: Text(Localtext.clubsLeaveConfirm), + title: Text(LocalText.clubsLeaveConfirm), primaryButton: .destructive(Text(LocalText.clubsLeave)) { Task { let success = await viewModel.leaveGroup(dataService: dataService) diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupsView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupsView.swift index 701510ca1..3c75a2fe3 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/RecommendationGroupsView.swift @@ -62,7 +62,7 @@ struct CreateRecommendationGroupView: View { await viewModel.createGroup(dataService: dataService, name: self.name) } }, label: { - Text("Next") + Text(LocalText.genericNext) }) .disabled(name.isEmpty) ) @@ -72,7 +72,7 @@ struct CreateRecommendationGroupView: View { var body: some View { NavigationView { Form { - TextField("Name", text: $name, prompt: Text(Localtext.clubsName)) + TextField(LocalText.genericName, text: $name, prompt: Text(LocalText.clubsName)) Section("Club Rules") { Toggle("Only admins can post", isOn: $viewModel.onlyAdminCanPost) @@ -91,7 +91,7 @@ struct CreateRecommendationGroupView: View { .alert(isPresented: $viewModel.showCreateError) { Alert( title: Text(viewModel.createGroupError ?? "Error creating group"), - dismissButton: .cancel(Text("Ok")) { + dismissButton: .cancel(Text(LocalText.genericOk)) { viewModel.createGroupError = nil viewModel.showCreateError = false } diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/Subscriptions.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/Subscriptions.swift index b8f1fcc1e..d9fee2c93 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/Subscriptions.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/Subscriptions.swift @@ -60,7 +60,7 @@ struct SubscriptionsView: View { Text(LocalText.subscriptionsErrorRetrieving).multilineTextAlignment(.center) Button( action: { Task { await viewModel.loadSubscriptions(dataService: dataService) } }, - label: { Text("Retry") } + label: { Text(LocalText.genericRetry) } ) .buttonStyle(RoundedRectButtonStyle()) } diff --git a/apple/OmnivoreKit/Sources/App/Views/Registration/CreateProfileView.swift b/apple/OmnivoreKit/Sources/App/Views/Registration/CreateProfileView.swift index 788cc7b01..d637e0e61 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Registration/CreateProfileView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Registration/CreateProfileView.swift @@ -18,7 +18,7 @@ import Views } var submitButtonText: String { - hasSuggestedProfile ? "Confirm" : "Submit" + hasSuggestedProfile ? LocalText.genericConfirm : LocalText.genericSubmit } @Published var loginError: LoginError? @@ -134,7 +134,7 @@ struct CreateProfileView: View { VStack(spacing: 16) { VStack(alignment: .leading, spacing: 6) { - Text("Name") + Text(LocalText.genericName) .font(.appFootnote) .foregroundColor(.appGrayText) #if os(iOS) diff --git a/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailLoginFormView.swift b/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailLoginFormView.swift index 37f162c5b..6770b96d9 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailLoginFormView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailLoginFormView.swift @@ -48,7 +48,7 @@ struct EmailLoginFormView: View { } VStack { VStack(alignment: .leading, spacing: 6) { - Text("Email") + Text(LocalText.genericEmail) .font(.appFootnote) .foregroundColor(.appGrayText) TextField("", text: $email) @@ -64,7 +64,7 @@ struct EmailLoginFormView: View { .padding(.bottom, 8) VStack(alignment: .leading, spacing: 6) { - Text("Password") + Text(LocalText.genericPassword) .font(.appFootnote) .foregroundColor(.appGrayText) SecureField("", text: $password) @@ -88,7 +88,7 @@ struct EmailLoginFormView: View { ) } }, - label: { Text("Submit") } + label: { Text(LocalText.genericSubmit) } ) .buttonStyle(SolidCapsuleButtonStyle(color: .appCtaYellow, width: 300)) @@ -101,7 +101,7 @@ struct EmailLoginFormView: View { Button( action: { viewModel.emailAuthState = .signUp }, label: { - Text(Localtext.registrationNoAccount) + Text(LocalText.registrationNoAccount) .foregroundColor(.appGrayTextContrast) .underline() } diff --git a/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailSignupFormView.swift b/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailSignupFormView.swift index ba6f39cc1..9ae01eb8c 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailSignupFormView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Registration/EmailAuth/EmailSignupFormView.swift @@ -91,7 +91,7 @@ struct EmailSignupFormView: View { VStack { // Email VStack(alignment: .leading, spacing: 6) { - Text("Email") + Text(LocalText.genericEmail) .font(.appFootnote) .foregroundColor(.appGrayText) TextField("", text: $email) @@ -108,7 +108,7 @@ struct EmailSignupFormView: View { // Password VStack(alignment: .leading, spacing: 6) { - Text("Password") + Text(LocalText.genericPassword) .font(.appFootnote) .foregroundColor(.appGrayText) SecureField("", text: $password) @@ -182,7 +182,7 @@ struct EmailSignupFormView: View { ) } }, - label: { Text("Submit") } + label: { Text(LocalText.genericSubmit) } ) .buttonStyle(SolidCapsuleButtonStyle(color: .appCtaYellow, width: 300)) diff --git a/apple/OmnivoreKit/Sources/App/Views/Registration/NewAppleSignupView.swift b/apple/OmnivoreKit/Sources/App/Views/Registration/NewAppleSignupView.swift index 28ccad613..13e7f0a71 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Registration/NewAppleSignupView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Registration/NewAppleSignupView.swift @@ -48,7 +48,7 @@ struct NewAppleSignupView: View { await viewModel.submitProfile(userProfile: userProfile, authenticator: authenticator) } }, - label: { Text("Continue") } + label: { Text(LocalText.genericContinue) } ) .buttonStyle(SolidCapsuleButtonStyle(color: .appDeepBackground, width: 300)) diff --git a/apple/OmnivoreKit/Sources/App/Views/SelfHostSettingsView.swift b/apple/OmnivoreKit/Sources/App/Views/SelfHostSettingsView.swift index 4cb62cbd7..567663b5c 100644 --- a/apple/OmnivoreKit/Sources/App/Views/SelfHostSettingsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/SelfHostSettingsView.swift @@ -28,7 +28,7 @@ struct SelfHostSettingsView: View { Button(action: { showConfirmAlert = true }, label: { - Text("Save") + Text(LocalText.genericSave) }) .disabled(!allFieldsSet) } @@ -68,7 +68,7 @@ struct SelfHostSettingsView: View { .alert(isPresented: $showConfirmAlert) { Alert( title: Text("Changing your environment settings will close the app."), - dismissButton: .cancel(Text("Ok")) { + dismissButton: .cancel(Text(LocalText.genericOk)) { AppEnvironment.setCustom(serverBaseURL: apiServerAddress, webAppBaseURL: webServerAddress, ttsBaseURL: ttsServerAddress) dataService.switchAppEnvironment(appEnvironment: AppEnvironment.custom) } @@ -80,7 +80,7 @@ struct SelfHostSettingsView: View { .navigationBarItems(leading: Button(action: { dismiss() - }, label: { Text("Cancel") }), + }, label: { Text(LocalText.cancelGeneric) }), trailing: saveButton) } } diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift index 7b4c11e26..35ce3dfc5 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/RecommendToView.swift @@ -81,7 +81,7 @@ struct RecommendToView: View { Button(action: { self.viewModel.showNoteView = true }, label: { - Text("Next") + Text(LocalText.genericNext) .bold() }) .disabled(viewModel.selectedGroups.isEmpty) @@ -99,7 +99,7 @@ struct RecommendToView: View { } } }, label: { - Text("Send") + Text(LocalText.genericSend) .bold() }) .disabled(viewModel.selectedGroups.isEmpty) @@ -200,7 +200,7 @@ struct RecommendToView: View { .alert(isPresented: $viewModel.showError) { Alert( title: Text(LocalText.recommendationError), - dismissButton: .cancel(Text("Ok")) { + dismissButton: .cancel(Text(LocalText.genericOk)) { viewModel.showError = false } ) diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift index 2940049e8..0b6f6d27c 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift @@ -271,7 +271,7 @@ struct WebReaderContainerView: View { .padding(.horizontal) .scaleEffect(navBarVisibilityRatio) #else - Text("Options") + Text(LocalText.genericOptions) #endif } ) @@ -365,7 +365,7 @@ struct WebReaderContainerView: View { if let linkToOpen = linkToOpen { safariWebLink = SafariWebLink(id: UUID(), url: linkToOpen) } - }, label: { Text("Open") }) + }, label: { Text(LocalText.genericOpen) }) Button(action: { UIPasteboard.general.string = item.unwrappedPageURLString showInSnackbar("Link Copied") @@ -381,8 +381,8 @@ struct WebReaderContainerView: View { SafariView(url: $0.url) } #endif - .alert(errorAlertMessage ?? LocalText.readerError, isPresented: $showErrorAlertMessage) { - Button("Ok", role: .cancel, action: { + .alert(errorAlertMessage ?? LocalText.readerError, isPresented: $showErrorAlertMessage) { + Button(LocalText.genericOk, role: .cancel, action: { errorAlertMessage = nil showErrorAlertMessage = false }) diff --git a/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift b/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift index fdebe1931..466627813 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift @@ -71,9 +71,9 @@ struct WelcomeView: View { var footerView: some View { Group { Text(LocalText.welcomeSignupAgreement) - + Text(LocalText.welcomeTitleTermsOfService).underline() - + Text(LocalText.welcomeTitleAndJoiner) - + Text(LocalText.privacyPolicyGeneric).underline() + + Text(LocalText.welcomeTitleTermsOfService).underline() + + Text(LocalText.welcomeTitleAndJoiner) + + Text(LocalText.privacyPolicyGeneric).underline() } .font(.appSubheadline) .confirmationDialog("", isPresented: $showTermsLinks, titleVisibility: .hidden) { diff --git a/apple/OmnivoreKit/Sources/Views/Article/HighlightAnnotationSheet.swift b/apple/OmnivoreKit/Sources/Views/Article/HighlightAnnotationSheet.swift index 3e12773fc..72ad26c2a 100644 --- a/apple/OmnivoreKit/Sources/Views/Article/HighlightAnnotationSheet.swift +++ b/apple/OmnivoreKit/Sources/Views/Article/HighlightAnnotationSheet.swift @@ -30,7 +30,7 @@ public struct HighlightAnnotationSheet: View { Spacer() Label("Note", systemImage: "note.text") Spacer() - Button("Save") { + Button(LocalText.genericSave) { onSave() } } @@ -50,7 +50,7 @@ public struct HighlightAnnotationSheet: View { } .padding() .alert(errorAlertMessage ?? LocalText.readerError, isPresented: $showErrorAlertMessage) { - Button("Ok", role: .cancel, action: { + Button(LocalText.genericOk, role: .cancel, action: { errorAlertMessage = nil showErrorAlertMessage = false }) diff --git a/apple/OmnivoreKit/Sources/Views/Article/OmnivoreWebView.swift b/apple/OmnivoreKit/Sources/Views/Article/OmnivoreWebView.swift index 96d907667..7405e4777 100644 --- a/apple/OmnivoreKit/Sources/Views/Article/OmnivoreWebView.swift +++ b/apple/OmnivoreKit/Sources/Views/Article/OmnivoreWebView.swift @@ -200,7 +200,7 @@ public final class OmnivoreWebView: WKWebView { // on iOS16 we use menuBuilder to create these items } else { let annotate = UIMenuItem(title: "Annotate", action: #selector(annotateSelection)) - let highlight = UIMenuItem(title: "Highlight", action: #selector(highlightSelection)) + let highlight = UIMenuItem(title: LocalText.genericHighlight, action: #selector(highlightSelection)) // let share = UIMenuItem(title: "Share", action: #selector(shareSelection)) UIMenuController.shared.menuItems = [highlight, /* share, */ annotate] @@ -315,7 +315,7 @@ public final class OmnivoreWebView: WKWebView { override public func buildMenu(with builder: UIMenuBuilder) { if #available(iOS 16.0, *) { let annotate = UICommand(title: "Note", action: #selector(annotateSelection)) - let highlight = UICommand(title: "Highlight", action: #selector(highlightSelection)) + let highlight = UICommand(title: LocalText.genericHighlight, action: #selector(highlightSelection)) let remove = UICommand(title: "Remove", action: #selector(removeSelection)) let setLabels = UICommand(title: LocalText.labelsGeneric, action: #selector(setLabels)) diff --git a/apple/OmnivoreKit/Sources/Views/FontSizeAdjustmentPopoverView.swift b/apple/OmnivoreKit/Sources/Views/FontSizeAdjustmentPopoverView.swift index e690cac9c..c10fe5c00 100644 --- a/apple/OmnivoreKit/Sources/Views/FontSizeAdjustmentPopoverView.swift +++ b/apple/OmnivoreKit/Sources/Views/FontSizeAdjustmentPopoverView.swift @@ -175,7 +175,7 @@ public enum WebFont: String, CaseIterable { NavigationLink(destination: fontList) { HStack { - Text("Font") + Text(LocalText.genericFont) Spacer() Image(systemName: "chevron.right") // Button(action: {}, label: { Text("Crimson Text").frame(width: 91) }) diff --git a/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings b/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings index 25186c59c..5b521c4f4 100644 --- a/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings +++ b/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings @@ -193,7 +193,7 @@ "dismissButton" = "Dismiss"; "errorNetwork" = "We are having trouble connecting to the internet."; -// TODO: search navigationTitle, toggle, section, button, Label +// TODO: search navigationTitle, toggle, section, button, Label, title: ", CreateProfileViewModel, TextField, .keyboardShortcut // Unit test Entry -- Do not remove this or add entries after this one. // This allows us to check for syntax errors in this file with a unit test