From cd31d793574216251e7466056a19df3100e89db2 Mon Sep 17 00:00:00 2001 From: CMK Date: Thu, 17 Jun 2021 14:19:43 +0800 Subject: [PATCH] fix: add missing "ago" for timestamp --- Localization/app.json | 3 ++- Mastodon/Extension/Date.swift | 3 ++- Mastodon/Generated/Strings.swift | 4 ++++ Mastodon/Resources/ar.lproj/Localizable.strings | 1 + Mastodon/Resources/en.lproj/Localizable.strings | 1 + 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Localization/app.json b/Localization/app.json index 3e90f799f..90a63fc18 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -174,7 +174,8 @@ }, "timeline": { "timestamp": { - "now": "Now" + "now": "Now", + "time_ago": "%s ago" }, "loader": { "load_missing_posts": "Load missing posts", diff --git a/Mastodon/Extension/Date.swift b/Mastodon/Extension/Date.swift index c1d73a438..daa5eab6c 100644 --- a/Mastodon/Extension/Date.swift +++ b/Mastodon/Extension/Date.swift @@ -22,7 +22,8 @@ extension Date { if earlierDate.timeIntervalSince(latest) >= -60 { return L10n.Common.Controls.Timeline.Timestamp.now } else { - return latest.shortTimeAgo(since: earlierDate) + let interval = latest.shortTimeAgo(since: earlierDate) // 1s + return L10n.Common.Controls.Timeline.Timestamp.timeAgo(interval) // 1s ago } } diff --git a/Mastodon/Generated/Strings.swift b/Mastodon/Generated/Strings.swift index 34556e8a6..072105193 100644 --- a/Mastodon/Generated/Strings.swift +++ b/Mastodon/Generated/Strings.swift @@ -383,6 +383,10 @@ internal enum L10n { internal enum 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)) + } } } } diff --git a/Mastodon/Resources/ar.lproj/Localizable.strings b/Mastodon/Resources/ar.lproj/Localizable.strings index a95c2cbce..3d976d72a 100644 --- a/Mastodon/Resources/ar.lproj/Localizable.strings +++ b/Mastodon/Resources/ar.lproj/Localizable.strings @@ -133,6 +133,7 @@ Your account looks like this to them."; "Common.Controls.Timeline.Loader.LoadingMissingPosts" = "Loading missing posts..."; "Common.Controls.Timeline.Loader.ShowMoreReplies" = "Show more replies"; "Common.Controls.Timeline.Timestamp.Now" = "Now"; +"Common.Controls.Timeline.Timestamp.TimeAgo" = "%@ ago"; "Common.Countable.Photo.Multiple" = "photos"; "Common.Countable.Photo.Single" = "photo"; "Scene.Compose.Accessibility.AppendAttachment" = "Append attachment"; diff --git a/Mastodon/Resources/en.lproj/Localizable.strings b/Mastodon/Resources/en.lproj/Localizable.strings index a95c2cbce..3d976d72a 100644 --- a/Mastodon/Resources/en.lproj/Localizable.strings +++ b/Mastodon/Resources/en.lproj/Localizable.strings @@ -133,6 +133,7 @@ Your account looks like this to them."; "Common.Controls.Timeline.Loader.LoadingMissingPosts" = "Loading missing posts..."; "Common.Controls.Timeline.Loader.ShowMoreReplies" = "Show more replies"; "Common.Controls.Timeline.Timestamp.Now" = "Now"; +"Common.Controls.Timeline.Timestamp.TimeAgo" = "%@ ago"; "Common.Countable.Photo.Multiple" = "photos"; "Common.Countable.Photo.Single" = "photo"; "Scene.Compose.Accessibility.AppendAttachment" = "Append attachment";