forked from shadowfacts/Tusker
Use server language preference for default search token suggestion
This commit is contained in:
parent
1c36312850
commit
380f878d81
|
@ -65,12 +65,13 @@ class MastodonSearchController: UISearchController {
|
|||
searchText.isEmpty || $0.contains(searchText)
|
||||
}))
|
||||
|
||||
// TODO: use default language from preferences
|
||||
var langSuggestions = [String]()
|
||||
if searchText.isEmpty || "language:en".contains(searchText) {
|
||||
langSuggestions.append("language:en")
|
||||
let defaultLanguage = searchResultsController.mastodonController.accountPreferences.serverDefaultLanguage ?? "en"
|
||||
let languageToken = "language:\(defaultLanguage)"
|
||||
if searchText.isEmpty || languageToken.contains(searchText) {
|
||||
langSuggestions.append(languageToken)
|
||||
}
|
||||
if searchText != "en",
|
||||
if searchText != defaultLanguage,
|
||||
let match = languageRegex.firstMatch(in: searchText, range: NSRange(location: 0, length: searchText.utf16.count)) {
|
||||
let identifier = (searchText as NSString).substring(with: match.range(at: 1))
|
||||
if #available(iOS 16.0, *) {
|
||||
|
|
Loading…
Reference in New Issue