mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-01-31 09:35:13 +01:00
chore: update project for new i18n resources
This commit is contained in:
parent
fee8aec3df
commit
ddd1d0f6e4
@ -7,12 +7,12 @@
|
||||
<key>AppShared.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>32</integer>
|
||||
<integer>31</integer>
|
||||
</dict>
|
||||
<key>CoreDataStack.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>31</integer>
|
||||
<integer>32</integer>
|
||||
</dict>
|
||||
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
@ -77,7 +77,7 @@
|
||||
<key>MastodonIntent.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>33</integer>
|
||||
<integer>30</integer>
|
||||
</dict>
|
||||
<key>MastodonIntents.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
@ -97,7 +97,7 @@
|
||||
<key>ShareActionExtension.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>30</integer>
|
||||
<integer>33</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
|
@ -88,9 +88,7 @@ extension RecommendAccountSection {
|
||||
withURL: URL(string: user.header)!,
|
||||
placeholderImage: UIImage.placeholder(color: .systemFill),
|
||||
imageTransition: .crossDissolve(0.2)
|
||||
) { [weak cell] _ in
|
||||
// guard let cell = cell else { return }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
static func configureFollowButton(
|
||||
|
@ -79,13 +79,13 @@ extension NotificationSection {
|
||||
let createAt = notification.createAt
|
||||
let actionText = notification.notificationType.actionText
|
||||
cell.actionLabel.text = actionText
|
||||
cell.timestampLabel.text = createAt.timeAgoSinceNow
|
||||
cell.timestampLabel.text = createAt.localizedTimeAgoSinceNow
|
||||
AppContext.shared.timestampUpdatePublisher
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak cell] _ in
|
||||
guard let cell = cell else { return }
|
||||
cell.actionLabel.text = actionText
|
||||
cell.timestampLabel.text = createAt.timeAgoSinceNow
|
||||
cell.timestampLabel.text = createAt.localizedTimeAgoSinceNow
|
||||
}
|
||||
.store(in: &cell.disposeBag)
|
||||
|
||||
|
@ -953,11 +953,9 @@ extension StatusSection {
|
||||
cell.statusView.pollCountdownSubscription = nil
|
||||
cell.statusView.pollCountdownLabel.text = L10n.Common.Controls.Status.Poll.closed
|
||||
} else if let expiresAt = poll.expiresAt {
|
||||
cell.statusView.pollCountdownLabel.text = L10n.Common.Controls.Status.Poll.timeLeft(expiresAt.shortTimeAgoSinceNow)
|
||||
cell.statusView.pollCountdownLabel.text = expiresAt.localizedTimeLeft()
|
||||
cell.statusView.pollCountdownSubscription = AppContext.shared.timestampUpdatePublisher
|
||||
.sink { _ in
|
||||
cell.statusView.pollCountdownLabel.text = L10n.Common.Controls.Status.Poll.timeLeft(expiresAt.shortTimeAgoSinceNow)
|
||||
}
|
||||
.sink { _ in cell.statusView.pollCountdownLabel.text = expiresAt.localizedTimeLeft() }
|
||||
} else {
|
||||
cell.statusView.pollCountdownSubscription = nil
|
||||
cell.statusView.pollCountdownLabel.text = "-"
|
||||
@ -1039,7 +1037,7 @@ extension StatusSection {
|
||||
}()
|
||||
cell.statusView.actionToolbarContainer.replyButton.setTitle(replyCountTitle, for: .normal)
|
||||
cell.statusView.actionToolbarContainer.replyButton.accessibilityValue = status.repliesCount.flatMap {
|
||||
L10n.Common.Controls.Timeline.Accessibility.countReplies($0.intValue)
|
||||
L10n.Plural.Count.reblog($0.intValue)
|
||||
} ?? nil
|
||||
// set reblog
|
||||
let isReblogged = status.rebloggedBy.flatMap { $0.contains(where: { $0.id == requestUserID }) } ?? false
|
||||
@ -1052,7 +1050,7 @@ extension StatusSection {
|
||||
cell.statusView.actionToolbarContainer.reblogButton.accessibilityLabel = isReblogged ? L10n.Common.Controls.Status.Actions.unreblog : L10n.Common.Controls.Status.Actions.reblog
|
||||
cell.statusView.actionToolbarContainer.reblogButton.accessibilityValue = {
|
||||
guard status.reblogsCount.intValue > 0 else { return nil }
|
||||
return L10n.Common.Controls.Timeline.Accessibility.countReblogs(status.reblogsCount.intValue)
|
||||
return L10n.Plural.Count.reblog(status.reblogsCount.intValue)
|
||||
}()
|
||||
|
||||
// disable reblog if needs (except self)
|
||||
@ -1077,7 +1075,7 @@ extension StatusSection {
|
||||
cell.statusView.actionToolbarContainer.favoriteButton.accessibilityLabel = isLike ? L10n.Common.Controls.Status.Actions.unfavorite : L10n.Common.Controls.Status.Actions.favorite
|
||||
cell.statusView.actionToolbarContainer.favoriteButton.accessibilityValue = {
|
||||
guard status.favouritesCount.intValue > 0 else { return nil }
|
||||
return L10n.Common.Controls.Timeline.Accessibility.countReblogs(status.favouritesCount.intValue)
|
||||
return L10n.Plural.Count.favorite(status.favouritesCount.intValue)
|
||||
}()
|
||||
Publishers.CombineLatest(
|
||||
dependency.context.blockDomainService.blockedDomains.setFailureType(to: ManagedObjectObserver.Error.self),
|
||||
|
@ -13,28 +13,56 @@ extension Date {
|
||||
static let relativeTimestampFormatter: RelativeDateTimeFormatter = {
|
||||
let formatter = RelativeDateTimeFormatter()
|
||||
formatter.dateTimeStyle = .numeric
|
||||
formatter.unitsStyle = .abbreviated
|
||||
formatter.unitsStyle = .full
|
||||
return formatter
|
||||
}()
|
||||
|
||||
var localizedSlowedTimeAgoSinceNow: String {
|
||||
return self.localizedSlowedTimeAgo(since: Date())
|
||||
return self.localizedTimeAgo(since: Date(), isSlowed: true)
|
||||
|
||||
}
|
||||
|
||||
func localizedSlowedTimeAgo(since date: Date) -> String {
|
||||
var localizedTimeAgoSinceNow: String {
|
||||
return self.localizedTimeAgo(since: Date(), isSlowed: false)
|
||||
}
|
||||
|
||||
func localizedTimeAgo(since date: Date, isSlowed: Bool) -> String {
|
||||
let earlierDate = date < self ? date : self
|
||||
let latestDate = earlierDate == date ? self : date
|
||||
|
||||
if earlierDate.timeIntervalSince(latestDate) >= -60 {
|
||||
if isSlowed, earlierDate.timeIntervalSince(latestDate) >= -60 {
|
||||
return L10n.Common.Controls.Timeline.Timestamp.now
|
||||
} else {
|
||||
return Date.relativeTimestampFormatter.localizedString(for: earlierDate, relativeTo: latestDate)
|
||||
}
|
||||
}
|
||||
|
||||
func timeLeft() -> String {
|
||||
return ""
|
||||
}
|
||||
|
||||
extension Date {
|
||||
|
||||
func localizedTimeLeft() -> String {
|
||||
let date = Date()
|
||||
let earlierDate = date < self ? date : self
|
||||
let latestDate = earlierDate == date ? self : date
|
||||
|
||||
let components = Calendar.current.dateComponents([.year, .month, .day, .minute, .second], from: earlierDate, to: latestDate)
|
||||
|
||||
if components.year! > 0 {
|
||||
return L10n.Date.Year.left(components.second!)
|
||||
} else if components.month! > 0 {
|
||||
return L10n.Date.Month.left(components.month!)
|
||||
} else if components.day! > 0 {
|
||||
return L10n.Date.Day.left(components.day!)
|
||||
} else if components.hour! > 0 {
|
||||
return L10n.Date.Hour.left(components.hour!)
|
||||
} else if components.minute! > 0 {
|
||||
return L10n.Date.Minute.left(components.minute!)
|
||||
} else if components.second! > 0 {
|
||||
return L10n.Date.Year.left(components.second!)
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -397,11 +397,11 @@ extension ComposeViewController {
|
||||
case _ where count < 0:
|
||||
self.composeToolbarView.characterCountLabel.font = .monospacedDigitSystemFont(ofSize: 24, weight: .bold)
|
||||
self.composeToolbarView.characterCountLabel.textColor = Asset.Colors.danger.color
|
||||
self.composeToolbarView.characterCountLabel.accessibilityLabel = L10n.Scene.Compose.Accessibility.inputLimitExceedsCount(abs(count))
|
||||
self.composeToolbarView.characterCountLabel.accessibilityLabel = L10n.A11y.Plural.Count.inputLimitExceeds(abs(count))
|
||||
default:
|
||||
self.composeToolbarView.characterCountLabel.font = .monospacedDigitSystemFont(ofSize: 15, weight: .regular)
|
||||
self.composeToolbarView.characterCountLabel.textColor = Asset.Colors.Label.secondary.color
|
||||
self.composeToolbarView.characterCountLabel.accessibilityLabel = L10n.Scene.Compose.Accessibility.inputLimitRemainsCount(count)
|
||||
self.composeToolbarView.characterCountLabel.accessibilityLabel = L10n.A11y.Plural.Count.inputLimitRemains(count)
|
||||
}
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
@ -75,7 +75,7 @@ final class ComposeToolbarView: UIView {
|
||||
label.font = .systemFont(ofSize: 15, weight: .regular)
|
||||
label.text = "500"
|
||||
label.textColor = Asset.Colors.Label.secondary.color
|
||||
label.accessibilityLabel = L10n.Scene.Compose.Accessibility.inputLimitRemainsCount(500)
|
||||
label.accessibilityLabel = L10n.A11y.Plural.Count.inputLimitRemains(500)
|
||||
return label
|
||||
}()
|
||||
|
||||
|
@ -166,7 +166,7 @@ extension HashtagTimelineViewController {
|
||||
.prefix(2)
|
||||
.compactMap({ Int($0.accounts) })
|
||||
.reduce(0, +)
|
||||
subtitle = L10n.Scene.Hashtag.prompt("\(peopleTalkingNumber)")
|
||||
subtitle = L10n.Plural.peopleTalking(peopleTalkingNumber)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ extension ProfileViewController {
|
||||
let text = count.flatMap { MastodonMetricFormatter().string(from: $0) } ?? "-"
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.postDashboardMeterView.numberLabel.text = text
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.postDashboardMeterView.isAccessibilityElement = true
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.postDashboardMeterView.accessibilityLabel = L10n.Scene.Profile.Dashboard.Accessibility.countPosts(count ?? 0)
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.postDashboardMeterView.accessibilityLabel = L10n.Plural.Count.post(count ?? 0)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
viewModel.followingCount
|
||||
@ -531,7 +531,7 @@ extension ProfileViewController {
|
||||
let text = count.flatMap { MastodonMetricFormatter().string(from: $0) } ?? "-"
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.followingDashboardMeterView.numberLabel.text = text
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.followingDashboardMeterView.isAccessibilityElement = true
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.followingDashboardMeterView.accessibilityLabel = L10n.Scene.Profile.Dashboard.Accessibility.countFollowing(count ?? 0)
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.followingDashboardMeterView.accessibilityLabel = L10n.Plural.Count.following(count ?? 0)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
viewModel.followersCount
|
||||
@ -540,7 +540,7 @@ extension ProfileViewController {
|
||||
let text = count.flatMap { MastodonMetricFormatter().string(from: $0) } ?? "-"
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.followersDashboardMeterView.numberLabel.text = text
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.followersDashboardMeterView.isAccessibilityElement = true
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.followersDashboardMeterView.accessibilityLabel = L10n.Scene.Profile.Dashboard.Accessibility.countFollowers(count ?? 0)
|
||||
self.profileHeaderViewController.profileHeaderView.statusDashboardView.followersDashboardMeterView.accessibilityLabel = L10n.Plural.Count.follower(count ?? 0)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
viewModel.needsPagingEnabled
|
||||
|
@ -63,7 +63,7 @@ final class SearchViewModel: NSObject {
|
||||
snapshot.appendSections([.main])
|
||||
snapshot.appendItems(response.value, toSection: .main)
|
||||
dataSource.apply(snapshot, animatingDifferences: false, completion: nil)
|
||||
case .failure(let error):
|
||||
case .failure:
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -99,7 +99,7 @@ final class SearchViewModel: NSObject {
|
||||
switch result {
|
||||
case .success(let userIDs):
|
||||
self.receiveAccounts(ids: userIDs)
|
||||
case .failure(let error):
|
||||
case .failure:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ final class StatusView: UIView {
|
||||
let label = UILabel()
|
||||
label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 12, weight: .regular))
|
||||
label.textColor = Asset.Colors.Label.secondary.color
|
||||
label.text = L10n.Common.Controls.Status.Poll.timeLeft("6 hours")
|
||||
label.text = "1 day left"
|
||||
return label
|
||||
}()
|
||||
let pollVoteButton: UIButton = {
|
||||
|
@ -97,7 +97,7 @@ extension ThreadViewController {
|
||||
self.titleView.update(title: "", subtitle: nil)
|
||||
return
|
||||
}
|
||||
let mastodonContent = MastodonContent(content: title, emojis: emojiMeta ?? [:])
|
||||
let mastodonContent = MastodonContent(content: title, emojis: emojiMeta)
|
||||
do {
|
||||
let metaContent = try MastodonMetaContent.convert(document: mastodonContent)
|
||||
self.titleView.update(titleMetaContent: metaContent, subtitle: nil)
|
||||
|
@ -88,7 +88,7 @@ class ThreadViewModel {
|
||||
}
|
||||
self.rootNode.value = RootNode(domain: status.domain, statusID: status.id, replyToID: status.inReplyToID)
|
||||
self.navigationBarTitle.value = L10n.Scene.Thread.title(status.author.displayNameWithFallback)
|
||||
self.navigationBarTitleEmojiMeta.value = status.author.emojiMeta ?? [:]
|
||||
self.navigationBarTitleEmojiMeta.value = status.author.emojiMeta
|
||||
}
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
@ -65,7 +65,7 @@ extension APIService.APIError: LocalizedError {
|
||||
case .badRequest: return "Request invalid."
|
||||
case .badResponse: return "Response invalid."
|
||||
case .requestThrottle: return "Request too frequency."
|
||||
case .voteExpiredPoll: return L10n.Common.Alerts.VoteFailure.pollExpired
|
||||
case .voteExpiredPoll: return L10n.Common.Alerts.VoteFailure.pollEnded
|
||||
case .mastodonAPIError(let error):
|
||||
guard let responseError = error.mastodonError else {
|
||||
return nil
|
||||
|
@ -35,9 +35,6 @@ extension PlaybackState: CustomStringConvertible {
|
||||
case .paused: return "paused"
|
||||
case .stopped: return "stopped"
|
||||
case .failed: return "failed"
|
||||
default:
|
||||
assertionFailure()
|
||||
return "<nil>"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,11 +169,11 @@ extension ShareViewController {
|
||||
case _ where count < 0:
|
||||
self.composeToolbarView.characterCountLabel.font = .monospacedDigitSystemFont(ofSize: 24, weight: .bold)
|
||||
self.composeToolbarView.characterCountLabel.textColor = Asset.Colors.danger.color
|
||||
self.composeToolbarView.characterCountLabel.accessibilityLabel = L10n.Scene.Compose.Accessibility.inputLimitExceedsCount(abs(count))
|
||||
self.composeToolbarView.characterCountLabel.accessibilityLabel = L10n.A11y.Plural.Count.inputLimitExceeds(abs(count))
|
||||
default:
|
||||
self.composeToolbarView.characterCountLabel.font = .monospacedDigitSystemFont(ofSize: 15, weight: .regular)
|
||||
self.composeToolbarView.characterCountLabel.textColor = Asset.Colors.Label.secondary.color
|
||||
self.composeToolbarView.characterCountLabel.accessibilityLabel = L10n.Scene.Compose.Accessibility.inputLimitRemainsCount(count)
|
||||
self.composeToolbarView.characterCountLabel.accessibilityLabel = L10n.A11y.Plural.Count.inputLimitRemains(count)
|
||||
}
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
@ -46,7 +46,7 @@ final class ComposeToolbarView: UIView {
|
||||
label.font = .systemFont(ofSize: 15, weight: .regular)
|
||||
label.text = "500"
|
||||
label.textColor = Asset.Colors.Label.secondary.color
|
||||
label.accessibilityLabel = L10n.Scene.Compose.Accessibility.inputLimitRemainsCount(500)
|
||||
label.accessibilityLabel = L10n.A11y.Plural.Count.inputLimitRemains(500)
|
||||
return label
|
||||
}()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user