mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-11 09:28:38 +00:00
fix yandex wheather, for correct lang
This commit is contained in:
parent
466c0e5f68
commit
e9e5a6f739
@ -88,9 +88,9 @@ class YandexWeatherBarItem: CustomButtonTouchBarItem, CLLocationManagerDelegate
|
|||||||
|
|
||||||
func getWeatherUrl() -> String {
|
func getWeatherUrl() -> String {
|
||||||
if location != nil {
|
if location != nil {
|
||||||
return "https://yandex.ru/pogoda/?lat=\(location.coordinate.latitude)&lon=\(location.coordinate.longitude)"
|
return "https://yandex.ru/pogoda/?lat=\(location.coordinate.latitude)&lon=\(location.coordinate.longitude)?lang=ru"
|
||||||
} else {
|
} else {
|
||||||
return "https://yandex.ru/pogoda/" // Yandex will try to determine your location by default
|
return "https://yandex.ru/pogoda/?lang=ru" // Yandex will try to determine your location by default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,9 +131,9 @@ extension String {
|
|||||||
func matchingStrings(regex: String) -> [[String]] {
|
func matchingStrings(regex: String) -> [[String]] {
|
||||||
guard let regex = try? NSRegularExpression(pattern: regex, options: []) else { return [] }
|
guard let regex = try? NSRegularExpression(pattern: regex, options: []) else { return [] }
|
||||||
let nsString = self as NSString
|
let nsString = self as NSString
|
||||||
let results = regex.matches(in: self, options: [], range: NSMakeRange(0, nsString.length))
|
let results = regex.matches(in: self, options: [], range: NSMakeRange(0, nsString.length))
|
||||||
return results.map { result in
|
return results.map { result in
|
||||||
(0..<result.numberOfRanges).map {
|
(0 ..< result.numberOfRanges).map {
|
||||||
result.range(at: $0).location != NSNotFound
|
result.range(at: $0).location != NSNotFound
|
||||||
? nsString.substring(with: result.range(at: $0))
|
? nsString.substring(with: result.range(at: $0))
|
||||||
: ""
|
: ""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user