chore: update i18n

This commit is contained in:
CMK 2021-08-09 15:14:08 +08:00
parent ef3c2a580b
commit 53647dfb0e
7 changed files with 275 additions and 40 deletions

View File

@ -2,6 +2,50 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>a11y.plural.count.input_limit_exceeds</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>Input limit exceeds %#@character_count@</string>
<key>character_count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>0 characters</string>
<key>one</key>
<string>1 character</string>
<key>few</key>
<string>%ld characters</string>
<key>many</key>
<string>%ld characters</string>
<key>other</key>
<string>%ld characters</string>
</dict>
</dict>
<key>a11y.plural.count.input_limit_remains</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>Input limit remains %#@character_count@</string>
<key>character_count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>0 characters</string>
<key>one</key>
<string>1 character</string>
<key>few</key>
<string>%ld characters</string>
<key>many</key>
<string>%ld characters</string>
<key>other</key>
<string>%ld characters</string>
</dict>
</dict>
<key>plural.count.metric_formatted.post</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
@ -23,6 +67,28 @@
<key>other</key>
<string>posts</string>
</dict>
</dict>
<key>plural.count.post</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@post_count@</string>
<key>post_count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>0 posts</string>
<key>one</key>
<string>1 post</string>
<key>few</key>
<string>%ld posts</string>
<key>many</key>
<string>%ld posts</string>
<key>other</key>
<string>%ld posts</string>
</dict>
</dict>
<key>plural.count.favorite</key>
<dict>
@ -134,5 +200,181 @@
<string>%ld people talking</string>
</dict>
</dict>
<key>plural.count.following</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count_following@</string>
<key>count_following</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>0 following</string>
<key>one</key>
<string>1 following</string>
<key>few</key>
<string>%ld following</string>
<key>many</key>
<string>%ld following</string>
<key>other</key>
<string>%ld following</string>
</dict>
</dict>
<key>plural.count.follower</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count_follower@</string>
<key>count_follower</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>0 followers</string>
<key>one</key>
<string>1 follower</string>
<key>few</key>
<string>%ld followers</string>
<key>many</key>
<string>%ld followers</string>
<key>other</key>
<string>%ld followers</string>
</dict>
</dict>
<key>date.year.left</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count_year_left@</string>
<key>count_year_left</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>0 years left</string>
<key>one</key>
<string>1 year left</string>
<key>few</key>
<string>%ld years left</string>
<key>many</key>
<string>%ld years left</string>
<key>other</key>
<string>%ld years left</string>
</dict>
</dict>
<key>date.month.left</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count_month_left@</string>
<key>count_month_left</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>0 months left</string>
<key>one</key>
<string>1 months left</string>
<key>few</key>
<string>%ld months left</string>
<key>many</key>
<string>%ld months left</string>
<key>other</key>
<string>%ld months left</string>
</dict>
</dict>
<key>date.day.left</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count_day_left@</string>
<key>count_day_left</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>0 days left</string>
<key>one</key>
<string>1 day left</string>
<key>few</key>
<string>%ld days left</string>
<key>many</key>
<string>%ld days left</string>
<key>other</key>
<string>%ld days left</string>
</dict>
</dict>
<key>date.hour.left</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count_hour_left@</string>
<key>count_hour_left</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>0 hours left</string>
<key>one</key>
<string>1 hour left</string>
<key>few</key>
<string>%ld hours left</string>
<key>many</key>
<string>%ld hours left</string>
<key>other</key>
<string>%ld hours left</string>
</dict>
</dict>
<key>date.minute.left</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count_minute_left@</string>
<key>count_minute_left</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>0 minutes left</string>
<key>one</key>
<string>1 minute left</string>
<key>few</key>
<string>%ld minutes left</string>
<key>many</key>
<string>%ld minutes left</string>
<key>other</key>
<string>%ld minutes left</string>
</dict>
</dict>
<key>date.second.left</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count_second_left@</string>
<key>count_second_left</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>0 seconds left</string>
<key>one</key>
<string>1 second left</string>
<key>few</key>
<string>%ld seconds left</string>
<key>many</key>
<string>%ld seconds left</string>
<key>other</key>
<string>%ld seconds left</string>
</dict>
</dict>
</dict>
</plist>

View File

@ -13,7 +13,7 @@
},
"vote_failure": {
"title": "Vote Failure",
"poll_expired": "The poll has expired"
"poll_ended": "The poll has ended"
},
"discard_post_content": {
"title": "Discard Draft",
@ -130,7 +130,6 @@
"media_content_warning": "Tap anywhere to reveal",
"poll": {
"vote": "Vote",
"time_left": "%s left",
"closed": "Closed"
},
"actions": {
@ -171,8 +170,7 @@
"timeline": {
"filtered": "Filtered",
"timestamp": {
"now": "Now",
"time_ago": "%s ago"
"now": "Now"
},
"loader": {
"load_missing_posts": "Load missing posts",
@ -187,11 +185,6 @@
"user_blocked_warning": "You cant view %ss profile\n until they unblock you.",
"suspended_warning": "This user has been suspended.",
"user_suspended_warning": "%ss account has been suspended."
},
"accessibility": {
"count_replies": "%s replies",
"count_reblogs": "%s reblogs",
"count_favorites": "%s favorites"
}
}
}
@ -383,9 +376,7 @@
"custom_emoji_picker": "Custom Emoji Picker",
"enable_content_warning": "Enable Content Warning",
"disable_content_warning": "Disable Content Warning",
"post_visibility_menu": "Post Visibility Menu",
"input_limit_remains_count": "Input limit remains %ld",
"input_limit_exceeds_count": "Input limit exceeds %ld"
"post_visibility_menu": "Post Visibility Menu"
},
"keyboard": {
"discard_post": "Discard Post",
@ -400,12 +391,7 @@
"dashboard": {
"posts": "posts",
"following": "following",
"followers": "followers",
"accessibility": {
"count_posts": "%ld posts",
"count_following": "%ld following",
"count_followers": "%ld followers"
}
"followers": "followers"
},
"fields": {
"add_row": "Add Row",
@ -463,9 +449,6 @@
"clear": "Clear"
}
},
"hashtag": {
"prompt": "%s people talking"
},
"favorite": {
"title": "Your Favorites"
},

View File

@ -7,12 +7,12 @@
<key>AppShared.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>32</integer>
<integer>30</integer>
</dict>
<key>CoreDataStack.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>33</integer>
<integer>34</integer>
</dict>
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
<dict>
@ -37,7 +37,7 @@
<key>Mastodon - ca.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>30</integer>
<integer>29</integer>
</dict>
<key>Mastodon - en.xcscheme_^#shared#^_</key>
<dict>
@ -67,7 +67,7 @@
<key>Mastodon - zh_Hans.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>29</integer>
<integer>28</integer>
</dict>
<key>Mastodon.xcscheme_^#shared#^_</key>
<dict>
@ -77,7 +77,7 @@
<key>MastodonIntent.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>31</integer>
<integer>32</integer>
</dict>
<key>MastodonIntents.xcscheme_^#shared#^_</key>
<dict>
@ -97,7 +97,7 @@
<key>ShareActionExtension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>35</integer>
<integer>31</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>

View File

@ -390,14 +390,14 @@ extension StatusSection {
StatusSection.configureStatusViewAuthor(cell: cell, status: status)
// set timestamp
let createdAt = (status.reblog ?? status).createdAt
cell.statusView.dateLabel.text = createdAt.slowedTimeAgoSinceNow
cell.statusView.dateLabel.text = createdAt.localizedSlowedTimeAgoSinceNow
cell.statusView.dateLabel.accessibilityValue = createdAt.timeAgoSinceNow
AppContext.shared.timestampUpdatePublisher
.receive(on: RunLoop.main) // will be paused when scrolling (on purpose)
.sink { [weak cell] _ in
guard let cell = cell else { return }
cell.statusView.dateLabel.text = createdAt.slowedTimeAgoSinceNow
cell.statusView.dateLabel.accessibilityLabel = createdAt.slowedTimeAgoSinceNow
cell.statusView.dateLabel.text = createdAt.localizedSlowedTimeAgoSinceNow
cell.statusView.dateLabel.accessibilityLabel = createdAt.localizedSlowedTimeAgoSinceNow
}
.store(in: &cell.disposeBag)
// set content

View File

@ -10,21 +10,31 @@ import DateToolsSwift
extension Date {
var slowedTimeAgoSinceNow: String {
return self.slowedTimeAgo(since: Date())
static let relativeTimestampFormatter: RelativeDateTimeFormatter = {
let formatter = RelativeDateTimeFormatter()
formatter.dateTimeStyle = .numeric
formatter.unitsStyle = .abbreviated
return formatter
}()
var localizedSlowedTimeAgoSinceNow: String {
return self.localizedSlowedTimeAgo(since: Date())
}
func slowedTimeAgo(since date: Date) -> String {
func localizedSlowedTimeAgo(since date: Date) -> String {
let earlierDate = date < self ? date : self
let latest = earlierDate == date ? self : date
let latestDate = earlierDate == date ? self : date
if earlierDate.timeIntervalSince(latest) >= -60 {
if earlierDate.timeIntervalSince(latestDate) >= -60 {
return L10n.Common.Controls.Timeline.Timestamp.now
} else {
let interval = latest.shortTimeAgo(since: earlierDate) // 1s
return L10n.Common.Controls.Timeline.Timestamp.timeAgo(interval) // 1s ago
return Date.relativeTimestampFormatter.localizedString(for: earlierDate, relativeTo: latestDate)
}
}
func timeLeft() -> String {
return ""
}
}

View File

@ -212,7 +212,7 @@ extension ComposeViewModel: UITableViewDataSource {
assertionFailure()
}
// set date
cell.statusView.dateLabel.text = status.createdAt.slowedTimeAgoSinceNow
cell.statusView.dateLabel.text = status.createdAt.localizedSlowedTimeAgoSinceNow
}
return cell
case .status:

View File

@ -101,7 +101,7 @@ final class StatusNode: ASCellNode {
.font: UIFont.systemFont(ofSize: 13, weight: .regular)
])
// set date
dateTextNode.attributedText = NSAttributedString(string: timestamp.slowedTimeAgoSinceNow, attributes: [
dateTextNode.attributedText = NSAttributedString(string: timestamp.localizedSlowedTimeAgoSinceNow, attributes: [
.foregroundColor: Asset.Colors.Label.secondary.color,
.font: UIFont.systemFont(ofSize: 13, weight: .regular)
])
@ -131,7 +131,7 @@ final class StatusNode: ASCellNode {
timestampSubscription = AppContext.shared.timestampUpdatePublisher
.sink { [weak self] _ in
guard let self = self else { return }
self.dateTextNode.attributedText = NSAttributedString(string: self.timestamp.slowedTimeAgoSinceNow, attributes: [
self.dateTextNode.attributedText = NSAttributedString(string: self.timestamp.localizedSlowedTimeAgoSinceNow, attributes: [
.foregroundColor: Asset.Colors.Label.secondary.color,
.font: UIFont.systemFont(ofSize: 13, weight: .regular)
])