Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google map localization

How do I tell google map's geocoder API to use english not the browser's default languange?

For example, User's OS language is French and when he use the website and querying for london, it returns angleterre, londres

is there a way to force the geocoding to return EN_GB locale? So it returns: United kingdom, london.

And also if the user is Chinese, it'll return everything in chinese. How can I avoid this?

Please help!

Thanks,

like image 225
gumpi Avatar asked Jan 28 '26 16:01

gumpi


1 Answers

Google Geocode API

You can set the language parameter

language (optional) — The language in which to return results. See the supported list of domain languages. Note that we often update supported languages so this list may not be exhaustive. If language is not supplied, the geocoder will attempt to use the native language of the domain from which the request is sent wherever possible.

The map controls, tooltips, and copyrights have been translated for a subset of languages, listed in the spreadsheet below. The API will sense the browser settings of the user and set the language appropriately. It is possible to override the language in the APIs; more information is available in the JavaScript API documentation and the Flash API reference.

For Example:

http://maps.googleapis.com/maps/api/geocode/json?address=japan&sensor=false&language=en

returns in English

http://maps.googleapis.com/maps/api/geocode/json?address=japan&sensor=false&language=zh-CN

returns in Chinese

like image 169
KJYe.Name Avatar answered Jan 30 '26 08:01

KJYe.Name



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!