forked from zelo72/mastodon-ios
chore: using i18n strings
This commit is contained in:
parent
05c5b77bbd
commit
e119a06bba
|
@ -8,6 +8,7 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonLocalization
|
||||
|
||||
final class FamiliarFollowersViewController: UIViewController, NeedsDependency {
|
||||
|
||||
|
@ -38,7 +39,8 @@ extension FamiliarFollowersViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
title = "Followers you familiar"
|
||||
title = L10n.Scene.Familiarfollowers.title
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
|
|
|
@ -43,7 +43,7 @@ extension FollowerListViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
title = L10n.Scene.Profile.Dashboard.followers
|
||||
title = L10n.Scene.Follower.title
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
|
|
|
@ -43,7 +43,7 @@ extension FollowingListViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
title = L10n.Scene.Profile.Dashboard.following
|
||||
title = L10n.Scene.Following.title
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
|
|
|
@ -47,7 +47,7 @@ extension FavoritedByViewController {
|
|||
}
|
||||
#endif
|
||||
|
||||
title = "Favorited By"
|
||||
title = L10n.Scene.FavoritedBy.title
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
|
|
|
@ -47,7 +47,7 @@ extension RebloggedByViewController {
|
|||
}
|
||||
#endif
|
||||
|
||||
title = "Favorited By"
|
||||
title = L10n.Scene.RebloggedBy.title
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// MastodonLocalization+Bundle.swift
|
||||
//
|
||||
//
|
||||
// Created by MainasuK on 2022-5-17.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum MastodonLocalization {
|
||||
public static var bundle: Bundle {
|
||||
Bundle.module
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ extension FamiliarFollowersDashboardView {
|
|||
public func configure(familiarFollowers: Mastodon.Entity.FamiliarFollowers?) {
|
||||
assert(Thread.isMainThread)
|
||||
|
||||
let accounts = familiarFollowers?.accounts.prefix(4) ?? []
|
||||
let accounts = familiarFollowers?.accounts ?? []
|
||||
|
||||
viewModel.avatarURLs = accounts.map { $0.avatarImageURL() }
|
||||
viewModel.names = accounts.map { $0.displayNameWithFallback }
|
||||
|
|
|
@ -10,6 +10,7 @@ import UIKit
|
|||
import Combine
|
||||
import CoreDataStack
|
||||
import MastodonMeta
|
||||
import MastodonLocalization
|
||||
|
||||
extension FamiliarFollowersDashboardView {
|
||||
public final class ViewModel: ObservableObject {
|
||||
|
@ -32,6 +33,9 @@ extension FamiliarFollowersDashboardView.ViewModel {
|
|||
UIContentSizeCategory.publisher
|
||||
)
|
||||
.sink { avatarURLs, backgroundColor, contentSizeCategory in
|
||||
// only using first 4 items
|
||||
let avatarURLs = avatarURLs.prefix(4)
|
||||
|
||||
view.avatarContainerView.subviews.forEach { $0.removeFromSuperview() }
|
||||
|
||||
let initialOffset = min(12 * 1.5, UIFontMetrics(forTextStyle: .headline).scaledValue(for: 12)) // max 1.5x
|
||||
|
@ -82,12 +86,12 @@ extension FamiliarFollowersDashboardView.ViewModel {
|
|||
|
||||
switch names.count {
|
||||
case 1..<3:
|
||||
return "Followed by \(firstTwoNames)"
|
||||
case 3:
|
||||
return "Followed by \(firstTwoNames), and another mutual"
|
||||
return L10n.Scene.Familiarfollowers.followedByNames(firstTwoNames)
|
||||
default:
|
||||
// Note: SwiftGen generates wrong formate argv for "%1$@"
|
||||
let remains = count - 2
|
||||
return "Followed by \(firstTwoNames), and \(remains) mutuals"
|
||||
let format = MastodonLocalization.bundle.localizedString(forKey: "plural.count.followed_by_and_mutual", value: nil, table: "Localizable")
|
||||
return String(format: format, locale: .current, arguments: [firstTwoNames, remains])
|
||||
}
|
||||
}()
|
||||
let document = MastodonContent(content: content, emojis: emojis)
|
||||
|
|
|
@ -666,12 +666,11 @@ extension StatusView.ViewModel {
|
|||
let meidaAccessibilityLabel = $mediaViewConfigurations
|
||||
.map { configurations -> String? in
|
||||
let count = configurations.count
|
||||
// TODO: i18n
|
||||
return count > 0 ? "\(count) media" : nil
|
||||
return L10n.Plural.Count.media(count)
|
||||
}
|
||||
|
||||
// TODO: Toolbar
|
||||
|
||||
|
||||
Publishers.CombineLatest3(
|
||||
authorAccessibilityLabel,
|
||||
contentAccessibilityLabel,
|
||||
|
|
Loading…
Reference in New Issue