fix: add missing "ago" for timestamp

This commit is contained in:
CMK 2021-06-17 14:19:43 +08:00
parent c7edf45164
commit cd31d79357
5 changed files with 10 additions and 2 deletions

View File

@ -174,7 +174,8 @@
}, },
"timeline": { "timeline": {
"timestamp": { "timestamp": {
"now": "Now" "now": "Now",
"time_ago": "%s ago"
}, },
"loader": { "loader": {
"load_missing_posts": "Load missing posts", "load_missing_posts": "Load missing posts",

View File

@ -22,7 +22,8 @@ extension Date {
if earlierDate.timeIntervalSince(latest) >= -60 { if earlierDate.timeIntervalSince(latest) >= -60 {
return L10n.Common.Controls.Timeline.Timestamp.now return L10n.Common.Controls.Timeline.Timestamp.now
} else { } else {
return latest.shortTimeAgo(since: earlierDate) let interval = latest.shortTimeAgo(since: earlierDate) // 1s
return L10n.Common.Controls.Timeline.Timestamp.timeAgo(interval) // 1s ago
} }
} }

View File

@ -383,6 +383,10 @@ internal enum L10n {
internal enum Timestamp { internal enum Timestamp {
/// Now /// Now
internal static let now = L10n.tr("Localizable", "Common.Controls.Timeline.Timestamp.Now") internal static let now = L10n.tr("Localizable", "Common.Controls.Timeline.Timestamp.Now")
/// %@ ago
internal static func timeAgo(_ p1: Any) -> String {
return L10n.tr("Localizable", "Common.Controls.Timeline.Timestamp.TimeAgo", String(describing: p1))
}
} }
} }
} }

View File

@ -133,6 +133,7 @@ Your account looks like this to them.";
"Common.Controls.Timeline.Loader.LoadingMissingPosts" = "Loading missing posts..."; "Common.Controls.Timeline.Loader.LoadingMissingPosts" = "Loading missing posts...";
"Common.Controls.Timeline.Loader.ShowMoreReplies" = "Show more replies"; "Common.Controls.Timeline.Loader.ShowMoreReplies" = "Show more replies";
"Common.Controls.Timeline.Timestamp.Now" = "Now"; "Common.Controls.Timeline.Timestamp.Now" = "Now";
"Common.Controls.Timeline.Timestamp.TimeAgo" = "%@ ago";
"Common.Countable.Photo.Multiple" = "photos"; "Common.Countable.Photo.Multiple" = "photos";
"Common.Countable.Photo.Single" = "photo"; "Common.Countable.Photo.Single" = "photo";
"Scene.Compose.Accessibility.AppendAttachment" = "Append attachment"; "Scene.Compose.Accessibility.AppendAttachment" = "Append attachment";

View File

@ -133,6 +133,7 @@ Your account looks like this to them.";
"Common.Controls.Timeline.Loader.LoadingMissingPosts" = "Loading missing posts..."; "Common.Controls.Timeline.Loader.LoadingMissingPosts" = "Loading missing posts...";
"Common.Controls.Timeline.Loader.ShowMoreReplies" = "Show more replies"; "Common.Controls.Timeline.Loader.ShowMoreReplies" = "Show more replies";
"Common.Controls.Timeline.Timestamp.Now" = "Now"; "Common.Controls.Timeline.Timestamp.Now" = "Now";
"Common.Controls.Timeline.Timestamp.TimeAgo" = "%@ ago";
"Common.Countable.Photo.Multiple" = "photos"; "Common.Countable.Photo.Multiple" = "photos";
"Common.Countable.Photo.Single" = "photo"; "Common.Countable.Photo.Single" = "photo";
"Scene.Compose.Accessibility.AppendAttachment" = "Append attachment"; "Scene.Compose.Accessibility.AppendAttachment" = "Append attachment";