chore: use i18n strings for report flow
This commit is contained in:
parent
11762100eb
commit
70a6e11d30
@ -9,6 +9,7 @@ import os.log
|
|||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
|
import MastodonLocalization
|
||||||
|
|
||||||
public protocol DiscoveryIntroBannerViewDelegate: AnyObject {
|
public protocol DiscoveryIntroBannerViewDelegate: AnyObject {
|
||||||
func discoveryIntroBannerView(_ bannerView: DiscoveryIntroBannerView, closeButtonDidPressed button: UIButton)
|
func discoveryIntroBannerView(_ bannerView: DiscoveryIntroBannerView, closeButtonDidPressed button: UIButton)
|
||||||
@ -26,7 +27,7 @@ public final class DiscoveryIntroBannerView: UIView {
|
|||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 16, weight: .regular))
|
label.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 16, weight: .regular))
|
||||||
label.textColor = Asset.Colors.Label.primary.color
|
label.textColor = Asset.Colors.Label.primary.color
|
||||||
label.text = "These are the posts gaining traction in your corner of Mastodon." // TODO: i18n
|
label.text = L10n.Scene.Discovery.intro
|
||||||
label.numberOfLines = 0
|
label.numberOfLines = 0
|
||||||
return label
|
return label
|
||||||
}()
|
}()
|
||||||
|
@ -44,7 +44,7 @@ final class ProfilePagingViewModel: NSObject {
|
|||||||
let barItems: [TMBarItemable] = {
|
let barItems: [TMBarItemable] = {
|
||||||
let items = [
|
let items = [
|
||||||
TMBarItem(title: L10n.Scene.Profile.SegmentedControl.posts),
|
TMBarItem(title: L10n.Scene.Profile.SegmentedControl.posts),
|
||||||
TMBarItem(title: L10n.Scene.Profile.SegmentedControl.postsAndReplies), // TODO: i18n
|
TMBarItem(title: L10n.Scene.Profile.SegmentedControl.postsAndReplies),
|
||||||
TMBarItem(title: L10n.Scene.Profile.SegmentedControl.media),
|
TMBarItem(title: L10n.Scene.Profile.SegmentedControl.media),
|
||||||
TMBarItem(title: L10n.Scene.Profile.SegmentedControl.about),
|
TMBarItem(title: L10n.Scene.Profile.SegmentedControl.about),
|
||||||
]
|
]
|
||||||
|
@ -14,6 +14,7 @@ import MastodonSDK
|
|||||||
import OrderedCollections
|
import OrderedCollections
|
||||||
import os.log
|
import os.log
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import MastodonLocalization
|
||||||
|
|
||||||
class ReportViewModel {
|
class ReportViewModel {
|
||||||
|
|
||||||
@ -53,8 +54,7 @@ class ReportViewModel {
|
|||||||
|
|
||||||
// setup reason viewModel
|
// setup reason viewModel
|
||||||
if status != nil {
|
if status != nil {
|
||||||
// TODO: i18n
|
reportReasonViewModel.headline = L10n.Scene.Report.StepOne.whatsWrongWithThisPost
|
||||||
reportReasonViewModel.headline = "What’s wrong with post?"
|
|
||||||
} else {
|
} else {
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
let managedObjectContext = context.managedObjectContext
|
let managedObjectContext = context.managedObjectContext
|
||||||
@ -63,9 +63,9 @@ class ReportViewModel {
|
|||||||
return user?.acctWithDomain
|
return user?.acctWithDomain
|
||||||
}
|
}
|
||||||
if let username = _username {
|
if let username = _username {
|
||||||
reportReasonViewModel.headline = "What’s wrong with @\(username)?"
|
reportReasonViewModel.headline = L10n.Scene.Report.StepOne.whatsWrongWithThisUsername(username)
|
||||||
} else {
|
} else {
|
||||||
reportReasonViewModel.headline = "What’s wrong with this account?"
|
reportReasonViewModel.headline = L10n.Scene.Report.StepOne.whatsWrongWithThisAccount
|
||||||
}
|
}
|
||||||
} // end Task
|
} // end Task
|
||||||
}
|
}
|
||||||
|
@ -15,18 +15,17 @@ struct ReportReasonView: View {
|
|||||||
|
|
||||||
@ObservedObject var viewModel: ReportReasonViewModel
|
@ObservedObject var viewModel: ReportReasonViewModel
|
||||||
|
|
||||||
// TODO: i18n
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView(.vertical) {
|
ScrollView(.vertical) {
|
||||||
HStack {
|
HStack {
|
||||||
VStack(alignment: .leading, spacing: 8) {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
Text("Step 1 of 4")
|
Text(L10n.Scene.Report.StepOne.step1Of4)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
||||||
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
||||||
Text(viewModel.headline)
|
Text(viewModel.headline)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.primary.color))
|
.foregroundColor(Color(Asset.Colors.Label.primary.color))
|
||||||
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 28, weight: .bold)) as CTFont))
|
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 28, weight: .bold)) as CTFont))
|
||||||
Text("Select the best match")
|
Text(L10n.Scene.Report.StepOne.selectTheBestMatch)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
||||||
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import UIKit
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
import MastodonLocalization
|
||||||
|
|
||||||
final class ReportReasonViewModel: ObservableObject {
|
final class ReportReasonViewModel: ObservableObject {
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ final class ReportReasonViewModel: ObservableObject {
|
|||||||
// input
|
// input
|
||||||
let context: AppContext
|
let context: AppContext
|
||||||
|
|
||||||
@Published var headline = "What's wrong with this account?"
|
@Published var headline = L10n.Scene.Report.StepOne.whatsWrongWithThisAccount
|
||||||
@Published var serverRules: [Mastodon.Entity.Instance.Rule]?
|
@Published var serverRules: [Mastodon.Entity.Instance.Rule]?
|
||||||
|
|
||||||
@Published var bottomPaddingHeight: CGFloat = .zero
|
@Published var bottomPaddingHeight: CGFloat = .zero
|
||||||
@ -43,26 +44,26 @@ extension ReportReasonViewModel {
|
|||||||
var title: String {
|
var title: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .dislike:
|
case .dislike:
|
||||||
return "I don’t like it"
|
return L10n.Scene.Report.StepOne.iDontLikeIt
|
||||||
case .spam:
|
case .spam:
|
||||||
return "It’s spam"
|
return L10n.Scene.Report.StepOne.itsSpam
|
||||||
case .violateRule:
|
case .violateRule:
|
||||||
return "It violates server rules"
|
return L10n.Scene.Report.StepOne.itViolatesServerRules
|
||||||
case .other:
|
case .other:
|
||||||
return "It’s something else"
|
return L10n.Scene.Report.StepOne.itsSomethingElse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var subtitle: String {
|
var subtitle: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .dislike:
|
case .dislike:
|
||||||
return "It is not something you want to see"
|
return L10n.Scene.Report.StepOne.itIsNotSomethingYouWantToSee
|
||||||
case .spam:
|
case .spam:
|
||||||
return "Malicious links, fake engagement, or repetetive replies"
|
return L10n.Scene.Report.StepOne.maliciousLinksFakeEngagementOrRepetetiveReplies
|
||||||
case .violateRule:
|
case .violateRule:
|
||||||
return "You are aware that it breaks specific rules"
|
return L10n.Scene.Report.StepOne.youAreAwareThatItBreaksSpecificRules
|
||||||
case .other:
|
case .other:
|
||||||
return "The issue does not fit into other categories"
|
return L10n.Scene.Report.StepOne.theIssueDoesNotFitIntoOtherCategories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import MastodonLocalization
|
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
import MastodonUI
|
import MastodonUI
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
|
import MastodonLocalization
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
|
||||||
struct ReportResultView: View {
|
struct ReportResultView: View {
|
||||||
@ -42,7 +42,6 @@ struct ReportResultView: View {
|
|||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: i18n
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView(.vertical) {
|
ScrollView(.vertical) {
|
||||||
HStack {
|
HStack {
|
||||||
@ -56,7 +55,7 @@ struct ReportResultView: View {
|
|||||||
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
||||||
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
||||||
} else {
|
} else {
|
||||||
Text(verbatim: "When you see something you don’t like on Mastodon, you can remove the person from your experience.")
|
Text(verbatim: L10n.Scene.Report.StepFinal.whenYouSeeSomethingYouDontLikeOnMastodonYouCanRemoveThePersonFromYourExperience)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
||||||
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
||||||
}
|
}
|
||||||
@ -68,7 +67,7 @@ struct ReportResultView: View {
|
|||||||
VStack(spacing: 32) {
|
VStack(spacing: 32) {
|
||||||
// Follow
|
// Follow
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
Text("Unfollow @\(viewModel.username)")
|
Text(L10n.Scene.Report.StepFinal.unfollowUser("@\(viewModel.username)"))
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.primary.color))
|
.foregroundColor(Color(Asset.Colors.Label.primary.color))
|
||||||
ReportActionButton(
|
ReportActionButton(
|
||||||
@ -82,10 +81,10 @@ struct ReportResultView: View {
|
|||||||
|
|
||||||
// Mute
|
// Mute
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
Text("Mute @\(viewModel.username)")
|
Text(L10n.Scene.Report.StepFinal.muteUser("@\(viewModel.username)"))
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.primary.color))
|
.foregroundColor(Color(Asset.Colors.Label.primary.color))
|
||||||
Text(verbatim: "You won’t see their posts or reblogs in your home feed. They won’t know they’ve been muted.")
|
Text(verbatim: L10n.Scene.Report.StepFinal.youWontSeeTheirPostsOrReblogsInYourHomeFeedTheyWontKnowTheyVeBeenMuted)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
||||||
.font(Font(UIFontMetrics(forTextStyle: .subheadline).scaledFont(for: .systemFont(ofSize: 13, weight: .regular)) as CTFont))
|
.font(Font(UIFontMetrics(forTextStyle: .subheadline).scaledFont(for: .systemFont(ofSize: 13, weight: .regular)) as CTFont))
|
||||||
ReportActionButton(
|
ReportActionButton(
|
||||||
@ -99,10 +98,10 @@ struct ReportResultView: View {
|
|||||||
|
|
||||||
// Block
|
// Block
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
Text("Block @\(viewModel.username)")
|
Text(L10n.Scene.Report.StepFinal.blockUser("@\(viewModel.username)"))
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.primary.color))
|
.foregroundColor(Color(Asset.Colors.Label.primary.color))
|
||||||
Text(verbatim: "They will no longer be able to follow or see your posts, but they can see if they’ve been blocked.")
|
Text(verbatim: L10n.Scene.Report.StepFinal.theyWillNoLongerBeAbleToFollowOrSeeYourPostsButTheyCanSeeIfTheyveBeenBlocked)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
||||||
.font(Font(UIFontMetrics(forTextStyle: .subheadline).scaledFont(for: .systemFont(ofSize: 13, weight: .regular)) as CTFont))
|
.font(Font(UIFontMetrics(forTextStyle: .subheadline).scaledFont(for: .systemFont(ofSize: 13, weight: .regular)) as CTFont))
|
||||||
ReportActionButton(
|
ReportActionButton(
|
||||||
|
@ -14,6 +14,7 @@ import os.log
|
|||||||
import UIKit
|
import UIKit
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
import MastodonUI
|
import MastodonUI
|
||||||
|
import MastodonLocalization
|
||||||
|
|
||||||
class ReportResultViewModel: ObservableObject {
|
class ReportResultViewModel: ObservableObject {
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ class ReportResultViewModel: ObservableObject {
|
|||||||
let isReported: Bool
|
let isReported: Bool
|
||||||
|
|
||||||
var headline: String {
|
var headline: String {
|
||||||
isReported ? "Thanks for reporting, we’ll look into this." : "Don’t want to see this?"
|
isReported ? L10n.Scene.Report.reportSentTitle : L10n.Scene.Report.StepFinal.dontWantToSeeThis
|
||||||
}
|
}
|
||||||
@Published var bottomPaddingHeight: CGFloat = .zero
|
@Published var bottomPaddingHeight: CGFloat = .zero
|
||||||
@Published var backgroundColor: UIColor = Asset.Scene.Report.background.color
|
@Published var backgroundColor: UIColor = Asset.Scene.Report.background.color
|
||||||
|
@ -15,18 +15,17 @@ struct ReportServerRulesView: View {
|
|||||||
|
|
||||||
@ObservedObject var viewModel: ReportServerRulesViewModel
|
@ObservedObject var viewModel: ReportServerRulesViewModel
|
||||||
|
|
||||||
// TODO: i18n
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView(.vertical) {
|
ScrollView(.vertical) {
|
||||||
HStack {
|
HStack {
|
||||||
VStack(alignment: .leading, spacing: 8) {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
Text("Step 2 of 4")
|
Text(L10n.Scene.Report.StepTwo.step2Of4)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
||||||
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
||||||
Text(viewModel.headline)
|
Text(viewModel.headline)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.primary.color))
|
.foregroundColor(Color(Asset.Colors.Label.primary.color))
|
||||||
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 28, weight: .bold)) as CTFont))
|
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 28, weight: .bold)) as CTFont))
|
||||||
Text("Select all that apply")
|
Text(L10n.Scene.Report.StepTwo.selectAllThatApply)
|
||||||
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
.foregroundColor(Color(Asset.Colors.Label.secondary.color))
|
||||||
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
.font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont))
|
||||||
}
|
}
|
||||||
@ -49,7 +48,7 @@ struct ReportServerRulesView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ReportServerRulesRowView(
|
ReportServerRulesRowView(
|
||||||
title: "I just don’t like it",
|
title: L10n.Scene.Report.StepTwo.iJustDonTLikeIt,
|
||||||
isSelect: viewModel.isDislike
|
isSelect: viewModel.isDislike
|
||||||
)
|
)
|
||||||
.background(
|
.background(
|
||||||
|
@ -9,6 +9,7 @@ import UIKit
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
import MastodonLocalization
|
||||||
|
|
||||||
final class ReportServerRulesViewModel: ObservableObject {
|
final class ReportServerRulesViewModel: ObservableObject {
|
||||||
|
|
||||||
@ -16,8 +17,8 @@ final class ReportServerRulesViewModel: ObservableObject {
|
|||||||
|
|
||||||
// input
|
// input
|
||||||
let context: AppContext
|
let context: AppContext
|
||||||
|
|
||||||
@Published var headline = "Which rules are being violated?"
|
@Published var headline = L10n.Scene.Report.StepTwo.whichRulesAreBeingViolated
|
||||||
@Published var serverRules: [Mastodon.Entity.Instance.Rule] = []
|
@Published var serverRules: [Mastodon.Entity.Instance.Rule] = []
|
||||||
|
|
||||||
@Published var bottomPaddingHeight: CGFloat = .zero
|
@Published var bottomPaddingHeight: CGFloat = .zero
|
||||||
|
@ -16,7 +16,7 @@ extension ReportStatusViewModel {
|
|||||||
|
|
||||||
static let reportItemHeaderContext = ReportItem.HeaderContext(
|
static let reportItemHeaderContext = ReportItem.HeaderContext(
|
||||||
primaryLabelText: L10n.Scene.Report.content1,
|
primaryLabelText: L10n.Scene.Report.content1,
|
||||||
secondaryLabelText: "Step 3 of 4"
|
secondaryLabelText: L10n.Scene.Report.StepThree.step3Of4
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupDiffableDataSource(
|
func setupDiffableDataSource(
|
||||||
|
@ -15,8 +15,8 @@ import MastodonLocalization
|
|||||||
extension ReportSupplementaryViewModel {
|
extension ReportSupplementaryViewModel {
|
||||||
|
|
||||||
static let reportItemHeaderContext = ReportItem.HeaderContext(
|
static let reportItemHeaderContext = ReportItem.HeaderContext(
|
||||||
primaryLabelText: "Is there anything else we should know?",
|
primaryLabelText: L10n.Scene.Report.StepFour.isThereAnythingElseWeShouldKnow,
|
||||||
secondaryLabelText: "Step 4 of 4"
|
secondaryLabelText: L10n.Scene.Report.StepFour.step4Of4
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupDiffableDataSource(
|
func setupDiffableDataSource(
|
||||||
|
@ -216,7 +216,7 @@ extension ActionToolbarContainer {
|
|||||||
public func configureReply(count: Int, isEnabled: Bool) {
|
public func configureReply(count: Int, isEnabled: Bool) {
|
||||||
let title = ActionToolbarContainer.title(from: count)
|
let title = ActionToolbarContainer.title(from: count)
|
||||||
replyButton.setTitle(title, for: .normal)
|
replyButton.setTitle(title, for: .normal)
|
||||||
replyButton.accessibilityLabel = "\(count) reply" // TODO: i18n
|
replyButton.accessibilityLabel = L10n.Plural.Count.reply(count)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func configureReblog(count: Int, isEnabled: Bool, isHighlighted: Bool) {
|
public func configureReblog(count: Int, isEnabled: Bool, isHighlighted: Bool) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user