From 1cbaa871018a3b73d613e501d356132beb927531 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Wed, 25 Jan 2023 12:45:12 -0800 Subject: [PATCH] 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