From 998ed3b307fb2a9f365084f83909f1d250834b01 Mon Sep 17 00:00:00 2001 From: Marcus Kida Date: Mon, 6 Feb 2023 19:57:33 +0100 Subject: [PATCH] chore(Widget): Implement L10n for mock account --- Localization/app.json | 6 ++++++ .../Sources/MastodonLocalization/Generated/Strings.swift | 8 ++++++++ .../Resources/Base.lproj/Localizable.strings | 2 ++ .../MultiFollowersCount/MultiFollowersCountWidget.swift | 5 +++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Localization/app.json b/Localization/app.json index d6f19a3b0..48f31c813 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -826,6 +826,12 @@ "title": "FOLLOWERS", "followers_today": "%s followers today" }, + "multiple_followers": { + "mock_user": { + "display_name": "Another follower", + "account_name": "another@follower.social" + } + }, "latest_followers": { "title": "Latest followers", "last_update": "Last update: %s" diff --git a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift index 1cab66ca5..f0b3bc02e 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift +++ b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift @@ -1502,6 +1502,14 @@ public enum L10n { /// Latest followers public static let title = L10n.tr("Localizable", "Widget.LatestFollowers.Title", fallback: "Latest followers") } + public enum MultipleFollowers { + public enum MockUser { + /// another@follower.social + public static let accountName = L10n.tr("Localizable", "Widget.MultipleFollowers.MockUser.AccountName", fallback: "another@follower.social") + /// Another follower + public static let displayName = L10n.tr("Localizable", "Widget.MultipleFollowers.MockUser.DisplayName", fallback: "Another follower") + } + } } public enum A11y { public enum Plural { diff --git a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings index 2083555bc..d118b86b7 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings +++ b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings @@ -522,5 +522,7 @@ You can’t go wrong with any of our recommend servers, so regardless of which o "Widget.Common.UserNotLoggedIn" = "Please open Mastodon to log in to an Account."; "Widget.FollowersCount.Title" = "FOLLOWERS"; "Widget.FollowersCount.FollowersToday" = "%@ followers today"; +"Widget.MultipleFollowers.MockUser.DisplayName" = "Another follower"; +"Widget.MultipleFollowers.MockUser.AccountName" = "another@follower.social"; "Widget.LatestFollowers.Title" = "Latest followers"; "Widget.LatestFollowers.LastUpdate" = "Last update: %@"; diff --git a/WidgetExtension/Variants/MultiFollowersCount/MultiFollowersCountWidget.swift b/WidgetExtension/Variants/MultiFollowersCount/MultiFollowersCountWidget.swift index 92bb8b258..d5398b684 100644 --- a/WidgetExtension/Variants/MultiFollowersCount/MultiFollowersCountWidget.swift +++ b/WidgetExtension/Variants/MultiFollowersCount/MultiFollowersCountWidget.swift @@ -4,6 +4,7 @@ import WidgetKit import SwiftUI import Intents import MastodonSDK +import MastodonLocalization struct MultiFollowersCountWidgetProvider: IntentTimelineProvider { func placeholder(in context: Context) -> MultiFollowersCountEntry { @@ -116,8 +117,8 @@ private extension MultiFollowersCountWidgetProvider { accounts.append( MultiFollowersEntryAccount( followersCount: 1_200, - displayNameWithFallback: "Another follower", - acct: "@another@follower.social", + displayNameWithFallback: L10n.Widget.MultipleFollowers.MockUser.displayName, + acct: L10n.Widget.MultipleFollowers.MockUser.accountName, avatarImage: UIImage(named: "missingAvatar")!, domain: authBox.domain )