Add localization to "No such user"-alert (IOS-141)

This commit is contained in:
Nathan Mattes 2023-09-17 14:40:23 +02:00
parent 15436738d5
commit 7abc536d01
4 changed files with 26 additions and 8 deletions

View File

@ -651,15 +651,17 @@
} }
}, },
"searching": { "searching": {
"segment": { "posts": "Posts with \"%@\"",
"all": "All", "people": "People with \"%@\"",
"people": "People", "profile": "Go to @%@@%@",
"hashtags": "Hashtags", "url": "Open Link",
"posts": "Posts"
},
"empty_state": { "empty_state": {
"no_results": "No results" "no_results": "No results"
}, },
"no_user": {
"title": "No User Account Found",
"message": "There's no Useraccount \"%@\" on %@"
}
"recent_search": "Recent searches", "recent_search": "Recent searches",
"clear": "Clear" "clear": "Clear"
} }

View File

@ -3,6 +3,7 @@
import UIKit import UIKit
import MastodonCore import MastodonCore
import MastodonSDK import MastodonSDK
import MastodonLocalization
protocol SearchResultsOverviewTableViewControllerDeleagte: AnyObject { protocol SearchResultsOverviewTableViewControllerDeleagte: AnyObject {
func showPeople(_ viewController: UIViewController) func showPeople(_ viewController: UIViewController)
@ -256,8 +257,11 @@ class SearchResultsOverviewTableViewController: UIViewController, NeedsDependenc
showProfile(for: account) showProfile(for: account)
} else { } else {
await MainActor.run { await MainActor.run {
let alertController = UIAlertController(title: "No User Account", message: "There's no Useraccount \"\(username)\" on \(domain)", preferredStyle: .alert) let alertTitle = L10n.Scene.Search.Searching.NoUser.title
let okAction = UIAlertAction(title: "OK", style: .default) let alertMessage = L10n.Scene.Search.Searching.NoUser.message(username, domain)
let alertController = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: .alert)
let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default)
alertController.addAction(okAction) alertController.addAction(okAction)
coordinator.present(scene: .alertController(alertController: alertController), transition: .alertController(animated: true)) coordinator.present(scene: .alertController(alertController: alertController), transition: .alertController(animated: true))
} }

View File

@ -1299,6 +1299,14 @@ public enum L10n {
/// No results /// No results
public static let noResults = L10n.tr("Localizable", "Scene.Search.Searching.EmptyState.NoResults", fallback: "No results") public static let noResults = L10n.tr("Localizable", "Scene.Search.Searching.EmptyState.NoResults", fallback: "No results")
} }
public enum NoUser {
/// There's no Useraccount "%@" on %@
public static func message(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "Scene.Search.Searching.NoUser.Message", String(describing: p1), String(describing: p2), fallback: "There's no Useraccount \"%@\" on %@")
}
/// No User Account Found
public static let title = L10n.tr("Localizable", "Scene.Search.Searching.NoUser.Title", fallback: "No User Account Found")
}
} }
} }
public enum ServerPicker { public enum ServerPicker {

View File

@ -447,6 +447,10 @@ uploaded to Mastodon.";
"Scene.Search.Searching.People" = "People with \"%@\""; "Scene.Search.Searching.People" = "People with \"%@\"";
"Scene.Search.Searching.Profile" = "Go to @%@@%@"; "Scene.Search.Searching.Profile" = "Go to @%@@%@";
"Scene.Search.Searching.Url" = "Open Link"; "Scene.Search.Searching.Url" = "Open Link";
"Scene.Search.Searching.NoUser.Title" = "No User Account Found";
"Scene.Search.Searching.NoUser.Message" = "There's no Useraccount \"%@\" on %@";
"Scene.Search.Title" = "Search"; "Scene.Search.Title" = "Search";
"Scene.ServerPicker.Button.Category.Academia" = "academia"; "Scene.ServerPicker.Button.Category.Academia" = "academia";
"Scene.ServerPicker.Button.Category.Activism" = "activism"; "Scene.ServerPicker.Button.Category.Activism" = "activism";