use more LocalText

This commit is contained in:
Satindar Dhillon 2023-01-25 10:59:38 -08:00
parent 3b5350eced
commit c486167969
10 changed files with 34 additions and 51 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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