简体   繁体   中英

Google Maps API not returning English country name

I use the below API link to retrieve JSON based on longitude and latitude; however, I notice that for different users it doesn't always return the JSON in English format. I have already added the "language=en"

https://maps.googleapis.com/maps/api/geocode/json?latlng=" + latitude + "," + longitude + "&key=xxx&language=en"

There is no reason why your request would not return the results you can expect from what is explained in the documentation .

  • The geocoder does its best to provide a street address that is readable for both the user and locals. To achieve that goal, it returns street addresses in the local language, transliterated to a script readable by the user if necessary, observing the preferred language. All other addresses are returned in the preferred language. Address components are all returned in the same language, which is chosen from the first component .

  • If a name is not available in the preferred language, the geocoder uses the closest match .

  • The preferred language has a small influence on the set of results that the API chooses to return , and the order in which they are returned. The geocoder interprets abbreviations differently depending on language, such as the abbreviations for street types, or synonyms that may be valid in one language but not in another. For example, utca and tér are synonyms for street in Hungarian.

The list of supported languages is here: https://developers.google.com/maps/faq?hl=en#languagesupport

replace "language=en" with "language=en_AU" set language code with specific country code

check here for language code: https://developers.google.com/maps/faq#languagesupport

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM