apply generic local text values

This commit is contained in:
Satindar Dhillon 2023-01-25 13:09:19 -08:00
parent 1cbaa87101
commit dcf40c1daa
29 changed files with 60 additions and 59 deletions

View file

@ -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)

View file

@ -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) }
)
}
}

View file

@ -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,

View file

@ -18,7 +18,7 @@ enum PrimaryContentCategory: Identifiable, Hashable, Equatable {
case .feed:
return "Home"
case .profile:
return "Profile"
return LocalText.genericProfile
}
}

View file

@ -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))
}

View file

@ -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),

View file

@ -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)
}
}

View file

@ -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 }
}
}
}

View file

@ -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

View file

@ -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
}
}
}

View file

@ -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)

View file

@ -204,7 +204,7 @@ struct LinkItemDetailView: View {
} else {
HStack(alignment: .center) {
Spacer()
Text("Loading...")
Text(LocalText.genericLoading)
Spacer()
}
}

View file

@ -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(

View file

@ -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)
}
}

View file

@ -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)

View file

@ -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
}

View file

@ -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())
}

View file

@ -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)

View file

@ -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()
}

View file

@ -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))

View file

@ -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))

View file

@ -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)
}
}

View file

@ -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
}
)

View file

@ -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
})

View file

@ -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) {

View file

@ -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
})

View file

@ -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))

View file

@ -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) })

View file

@ -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