mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-02-03 10:47:35 +01:00
Locale notfound/placeholder-texts (IOS-37)
This commit is contained in:
parent
8b1316814a
commit
1829793ac5
@ -875,6 +875,16 @@
|
||||
"configuration": {
|
||||
"display_name": "Hashtag",
|
||||
"description": "Shows a recent status with the selected hashtag."
|
||||
},
|
||||
"not_found": {
|
||||
"account_name": "John Mastodon",
|
||||
"account": "@johnMastodon@no-such.account",
|
||||
"content": "Sorry, we didn't find a status with <a>#%@</a>. Please try a <a>#DifferentHashtag</a> or check the Widget-settings."
|
||||
},
|
||||
"placeholder": {
|
||||
"account_name": "John Mastodon",
|
||||
"account": "@johnMastodon@no-such.account",
|
||||
"content": "This is how a status with a <a>#hashtag</a> would look like. Of course you can decide about the <a>#hashtag</a>"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1550,6 +1550,24 @@ public enum L10n {
|
||||
/// Hashtag
|
||||
public static let displayName = L10n.tr("Localizable", "Widget.Hashtag.Configuration.DisplayName", fallback: "Hashtag")
|
||||
}
|
||||
public enum NotFound {
|
||||
/// @johnMastodon@no-such.account
|
||||
public static let account = L10n.tr("Localizable", "Widget.Hashtag.NotFound.Account", fallback: "@johnMastodon@no-such.account")
|
||||
/// John Mastodon
|
||||
public static let accountName = L10n.tr("Localizable", "Widget.Hashtag.NotFound.AccountName", fallback: "John Mastodon")
|
||||
/// Sorry, we didn't find a status with <a>#%@</a>. Please try a <a>#DifferentHashtag</a> or check the Widget-settings.
|
||||
public static func content(_ p1: Any) -> String {
|
||||
return L10n.tr("Localizable", "Widget.Hashtag.NotFound.Content", String(describing: p1), fallback: "Sorry, we didn't find a status with <a>#%@</a>. Please try a <a>#DifferentHashtag</a> or check the Widget-settings.")
|
||||
}
|
||||
}
|
||||
public enum Placeholder {
|
||||
/// @johnMastodon@no-such.account
|
||||
public static let account = L10n.tr("Localizable", "Widget.Hashtag.Placeholder.Account", fallback: "@johnMastodon@no-such.account")
|
||||
/// John Mastodon
|
||||
public static let accountName = L10n.tr("Localizable", "Widget.Hashtag.Placeholder.AccountName", fallback: "John Mastodon")
|
||||
/// This is how a status with a <a>#hashtag</a> would look like. Of course you can decide about the <a>#hashtag</a>
|
||||
public static let content = L10n.tr("Localizable", "Widget.Hashtag.Placeholder.Content", fallback: "This is how a status with a <a>#hashtag</a> would look like. Of course you can decide about the <a>#hashtag</a>")
|
||||
}
|
||||
}
|
||||
public enum LatestFollowers {
|
||||
/// Show latest followers.
|
||||
|
@ -545,3 +545,11 @@ uploaded to Mastodon.";
|
||||
"Widget.MultipleFollowers.MockUser.DisplayName" = "Another follower";
|
||||
"Widget.Hashtag.Configuration.Description" = "Shows a recent status with the selected hashtag";
|
||||
"Widget.Hashtag.Configuration.DisplayName" = "Hashtag";
|
||||
|
||||
"Widget.Hashtag.NotFound.AccountName" = "John Mastodon";
|
||||
"Widget.Hashtag.NotFound.Account" = "@johnMastodon@no-such.account";
|
||||
"Widget.Hashtag.NotFound.Content" = "Sorry, we didn't find a status with <a>#%@</a>. Please try a <a>#DifferentHashtag</a> or check the Widget-settings.";
|
||||
|
||||
"Widget.Hashtag.Placeholder.AccountName" = "John Mastodon";
|
||||
"Widget.Hashtag.Placeholder.Account" = "@johnMastodon@no-such.account";
|
||||
"Widget.Hashtag.Placeholder.Content" = "This is how a status with a <a>#hashtag</a> would look like. Of course you can decide about the <a>#hashtag</a>";
|
||||
|
@ -545,3 +545,11 @@ uploaded to Mastodon.";
|
||||
"Widget.MultipleFollowers.MockUser.DisplayName" = "Another follower";
|
||||
"Widget.Hashtag.Configuration.Description" = "Shows a recent status with the selected hashtag";
|
||||
"Widget.Hashtag.Configuration.DisplayName" = "Hashtag";
|
||||
|
||||
"Widget.Hashtag.NotFound.AccountName" = "John Mastodon";
|
||||
"Widget.Hashtag.NotFound.Account" = "@johnMastodon@no-such.account";
|
||||
"Widget.Hashtag.NotFound.Content" = "Sorry, we didn't find a status with <a>#%@</a>. Please try a <a>#DifferentHashtag</a> or check the Widget-settings.";
|
||||
|
||||
"Widget.Hashtag.Placeholder.AccountName" = "John Mastodon";
|
||||
"Widget.Hashtag.Placeholder.Account" = "@johnMastodon@no-such.account";
|
||||
"Widget.Hashtag.Placeholder.Content" = "This is how a status with a <a>#hashtag</a> would look like. Of course you can decide about the <a>#hashtag</a>";
|
||||
|
@ -37,14 +37,15 @@ extension HashtagWidgetProvider {
|
||||
}
|
||||
}
|
||||
|
||||
Task {
|
||||
let desiredHashtag: String
|
||||
let desiredHashtag: String
|
||||
|
||||
if let hashtag = configuration.hashtag {
|
||||
desiredHashtag = hashtag
|
||||
} else {
|
||||
return completion(.notFound)
|
||||
}
|
||||
if let hashtag = configuration.hashtag {
|
||||
desiredHashtag = hashtag
|
||||
} else {
|
||||
return completion(.notFound("hashtag"))
|
||||
}
|
||||
|
||||
Task {
|
||||
|
||||
do {
|
||||
let mostRecentStatuses = try await WidgetExtension.appContext
|
||||
@ -78,12 +79,12 @@ extension HashtagWidgetProvider {
|
||||
|
||||
completion(hashtagTimelineEntry)
|
||||
} else {
|
||||
let noStatusFound = HashtagWidgetTimelineEntry.notFound
|
||||
let noStatusFound = HashtagWidgetTimelineEntry.notFound(desiredHashtag)
|
||||
|
||||
completion(noStatusFound)
|
||||
}
|
||||
} catch {
|
||||
completion(.notFound)
|
||||
completion(.notFound(desiredHashtag))
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,31 +98,30 @@ struct HashtagWidgetTimelineEntry: TimelineEntry {
|
||||
var hashtag: HashtagEntry
|
||||
|
||||
static var placeholder: Self {
|
||||
//TODO: @zeitschlag Add Localization
|
||||
HashtagWidgetTimelineEntry(
|
||||
date: .now,
|
||||
hashtag: HashtagEntry(
|
||||
accountName: "John Mastodon",
|
||||
account: "@johnmastodon@mastodon.social",
|
||||
content: "Caturday is the best day of the week #CatsOfMastodon",
|
||||
accountName: L10n.Widget.Hashtag.Placeholder.accountName,
|
||||
account: L10n.Widget.Hashtag.Placeholder.account,
|
||||
content: L10n.Widget.Hashtag.Placeholder.content,
|
||||
reblogCount: 13,
|
||||
favoriteCount: 12,
|
||||
hashtag: "#CatsOfMastodon",
|
||||
timestamp: .now.addingTimeInterval(-3600 * 18)
|
||||
hashtag: "#hashtag",
|
||||
timestamp: .now.addingTimeInterval(-3600 * 12)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
static var notFound: Self {
|
||||
static func notFound(_ hashtag: String? = nil) -> Self {
|
||||
HashtagWidgetTimelineEntry(
|
||||
date: .now,
|
||||
hashtag: HashtagEntry(
|
||||
accountName: "Not Found",
|
||||
account: "404",
|
||||
content: "Couldn't find a status, sorryyyyyyy",
|
||||
accountName: L10n.Widget.Hashtag.NotFound.accountName,
|
||||
account: L10n.Widget.Hashtag.NotFound.account,
|
||||
content: L10n.Widget.Hashtag.NotFound.content(hashtag ?? "hashtag"),
|
||||
reblogCount: 0,
|
||||
favoriteCount: 0,
|
||||
hashtag: "",
|
||||
hashtag: hashtag ?? "",
|
||||
timestamp: .now
|
||||
)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user