From f56d7ebaa87ea27e7462acb8d660b4dd7d1cd6bb Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Sun, 30 Jun 2024 18:54:47 +0200 Subject: [PATCH] Throw in some localization (IOS-284) --- .../input/Base.lproj/app.json | 25 +++++++++++++++++++ Localization/app.json | 5 ++++ .../Generated/Strings.swift | 12 +++++++++ .../Resources/Base.lproj/Localizable.strings | 21 +++++++++------- .../View/Content/StatusCardControl.swift | 4 +-- 5 files changed, 56 insertions(+), 11 deletions(-) diff --git a/Localization/StringsConvertor/input/Base.lproj/app.json b/Localization/StringsConvertor/input/Base.lproj/app.json index 9e94951d8..710062c52 100644 --- a/Localization/StringsConvertor/input/Base.lproj/app.json +++ b/Localization/StringsConvertor/input/Base.lproj/app.json @@ -232,6 +232,11 @@ "edit_history": { "title": "Edit History", "original_post": "Original Post · %s" + }, + "card": { + "publisher_date": "%s · %s", + "by": "By", + "by_author": "By %s" } }, "friendship": { @@ -751,6 +756,7 @@ "title": "Settings", "general": "General", "notifications": "Notifications", + "privacy_safety": "Privacy & Safety", "support_mastodon": "Support Mastodon", "about_mastodon": "About Mastodon", "server_details": "Server Details", @@ -821,6 +827,25 @@ "go_to_settings": "Go to Notification Settings" } + }, + "privacy_safety": { + "title": "Privacy & Safety", + "preset": { + "title": "Preset", + "open_and_public": "Open & Public", + "private_and_restricted": "Private & Restricted", + "custom": "Custom" + }, + "default_post_visibility": { + "title": "Default Post Visibility", + "public": "Public", + "followers_only": "Followers Only", + "only_people_mentioned": "Only People Mentioned" + }, + "manually_approve_follow_requests": "Manually Approve Follow Requests", + "show_followers_and_following": "Show Followers & Following", + "suggest_my_account_to_others": "Suggest My Account to Others", + "appear_in_search_engines": "Appear in Search Engines" } }, "report": { diff --git a/Localization/app.json b/Localization/app.json index 5fb6d48c4..710062c52 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -232,6 +232,11 @@ "edit_history": { "title": "Edit History", "original_post": "Original Post · %s" + }, + "card": { + "publisher_date": "%s · %s", + "by": "By", + "by_author": "By %s" } }, "friendship": { diff --git a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift index f65b29721..1fe0a1283 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift +++ b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift @@ -411,6 +411,18 @@ public enum L10n { /// Boosts public static let reblogsTitle = L10n.tr("Localizable", "Common.Controls.Status.Buttons.ReblogsTitle", fallback: "Boosts") } + public enum Card { + /// By + public static let by = L10n.tr("Localizable", "Common.Controls.Status.Card.By", fallback: "By") + /// By %@ + public static func byAuthor(_ p1: Any) -> String { + return L10n.tr("Localizable", "Common.Controls.Status.Card.ByAuthor", String(describing: p1), fallback: "By %@") + } + /// %@ · %@ + public static func publisherDate(_ p1: Any, _ p2: Any) -> String { + return L10n.tr("Localizable", "Common.Controls.Status.Card.PublisherDate", String(describing: p1), String(describing: p2), fallback: "%@ · %@") + } + } public enum EditHistory { /// Original Post · %@ public static func originalPost(_ p1: Any) -> String { diff --git a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings index 4e233ec8d..85d1bdd6c 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings +++ b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings @@ -136,6 +136,9 @@ Please check your internet connection."; "Common.Controls.Status.Buttons.EditHistoryTitle" = "Edit History"; "Common.Controls.Status.Buttons.FavoritesTitle" = "Favorites"; "Common.Controls.Status.Buttons.ReblogsTitle" = "Boosts"; +"Common.Controls.Status.Card.By" = "By"; +"Common.Controls.Status.Card.ByAuthor" = "By %@"; +"Common.Controls.Status.Card.PublisherDate" = "%@ · %@"; "Common.Controls.Status.ContentWarning" = "Content Warning"; "Common.Controls.Status.EditHistory.OriginalPost" = "Original Post · %@"; "Common.Controls.Status.EditHistory.Title" = "Edit History"; @@ -562,19 +565,19 @@ If you disagree with the policy for **%@**, you can go back and pick a different "Scene.Settings.Overview.ServerDetails" = "Server Details"; "Scene.Settings.Overview.SupportMastodon" = "Support Mastodon"; "Scene.Settings.Overview.Title" = "Settings"; -"Scene.Settings.PrivacySafety.Title" = "Privacy & Safety"; -"Scene.Settings.PrivacySafety.Preset.Title" = "Preset"; -"Scene.Settings.PrivacySafety.Preset.OpenAndPublic" = "Open & Public"; -"Scene.Settings.PrivacySafety.Preset.PrivateAndRestricted" = "Private & Restricted"; -"Scene.Settings.PrivacySafety.Preset.Custom" = "Custom"; -"Scene.Settings.PrivacySafety.DefaultPostVisibility.Title" = "Default Post Visibility"; -"Scene.Settings.PrivacySafety.DefaultPostVisibility.Public" = "Public"; +"Scene.Settings.PrivacySafety.AppearInSearchEngines" = "Appear in Search Engines"; "Scene.Settings.PrivacySafety.DefaultPostVisibility.FollowersOnly" = "Followers Only"; "Scene.Settings.PrivacySafety.DefaultPostVisibility.OnlyPeopleMentioned" = "Only People Mentioned"; +"Scene.Settings.PrivacySafety.DefaultPostVisibility.Public" = "Public"; +"Scene.Settings.PrivacySafety.DefaultPostVisibility.Title" = "Default Post Visibility"; "Scene.Settings.PrivacySafety.ManuallyApproveFollowRequests" = "Manually Approve Follow Requests"; +"Scene.Settings.PrivacySafety.Preset.Custom" = "Custom"; +"Scene.Settings.PrivacySafety.Preset.OpenAndPublic" = "Open & Public"; +"Scene.Settings.PrivacySafety.Preset.PrivateAndRestricted" = "Private & Restricted"; +"Scene.Settings.PrivacySafety.Preset.Title" = "Preset"; "Scene.Settings.PrivacySafety.ShowFollowersAndFollowing" = "Show Followers & Following"; "Scene.Settings.PrivacySafety.SuggestMyAccountToOthers" = "Suggest My Account to Others"; -"Scene.Settings.PrivacySafety.AppearInSearchEngines" = "Appear in Search Engines"; +"Scene.Settings.PrivacySafety.Title" = "Privacy & Safety"; "Scene.Settings.ServerDetails.About" = "About"; "Scene.Settings.ServerDetails.AboutInstance.LegalNotice" = "A legal notice"; "Scene.Settings.ServerDetails.AboutInstance.MessageAdmin" = "Message Admin"; @@ -615,4 +618,4 @@ If you disagree with the policy for **%@**, you can go back and pick a different "Widget.MultipleFollowers.ConfigurationDescription" = "Show number of followers for multiple accounts."; "Widget.MultipleFollowers.ConfigurationDisplayName" = "Multiple followers"; "Widget.MultipleFollowers.MockUser.AccountName" = "another@follower.social"; -"Widget.MultipleFollowers.MockUser.DisplayName" = "Another follower"; +"Widget.MultipleFollowers.MockUser.DisplayName" = "Another follower"; \ No newline at end of file diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift index 4d5634e3c..7703a924a 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift @@ -227,9 +227,9 @@ public final class StatusCardControl: UIControl { headerContentStackView.addGestureRecognizer(tapGestureRecognizer) } else { if let author = card.authors?.first, let authorName = author.name, authorName.isEmpty == false { - authorLabel.text = "by \(authorName)" + authorLabel.text = L10n.Common.Controls.Status.Card.byAuthor(authorName) } else if let authorName = card.authorName, authorName.isEmpty == false { - authorLabel.text = "by \(authorName)" + authorLabel.text = L10n.Common.Controls.Status.Card.byAuthor(authorName) } else { authorLabel.text = url?.host }