shmidt / GooglePlacesSearchController

Google Places autocompleting address search controller
MIT License
194 stars 44 forks source link

Get result of delegate in user language #37

Closed Dave181295 closed 2 years ago

Dave181295 commented 2 years ago

if the search is in arabic/hebrew the result will still be in English, please add a parameter let us change the result's language

Dave181295 commented 2 years ago

Okay I checked your code and you should change

private static var deviceLanguage: String? {
        return (Locale.current as NSLocale).object(forKey: NSLocale.Key.languageCode) as? String
    }

With this approach

 private static var deviceLanguage: String? {
       return NSLocale.preferredLanguages[0].split(separator: "-").map{String($0)}[0]

    }