reverseGeocodeLocation returns placemark with some info in arabic and some in english

467 Views Asked by At

I have implemented reverseGeocodeLocation to get address from latitude and longitude. It's working fine.

I have change language to arabic like this: NSUserDefaults.standardUserDefaults().setObject(["ar"], forKey: "AppleLanguages")

Now, i'm calling reverseGeocodeLocation function and getting result in arabic language.

But, for some latitude-longitude it's returns some info in arabic and some in english language. For example: Latitude: 21.1591493 Longitude: 72.6823397 City: Surat

Returns:
placemark.name = 394550
placemark.locality = Surat [English]
placemark.administrativeArea = غوجارات [Arabic]
placemark.country = الهند [Arabic]

So, Question is:
why i am getting strange result for some locations?
What is workaround to get all info in arabic?

Note: I'm using Apple CLGeocoder's reverseGeocodeLocation method, NOT Google api. So don't confuse.

1

There are 1 best solutions below

2
On

Answer for 1 question.

It may be possible that google don't have the name english language that's why its returning in arabic. btw the default domain for the Geocoding Service is United States.

Answer for 2 question.

You can also set the Geocoding Service to return results biased to a particular region explicitly using the region parameter. This parameter takes a region code, specified as a IANA language region subtag.

you need to pass region code parameter in request. In your case it will region=ar.

for more info go to documentation.