javascript Google Maps API v3.5 Geocoder 语言选项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6464788/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 20:46:43  来源:igfitidea点击:

Google Maps API v3.5 Geocoder language option

javascriptgoogle-maps-api-3

提问by Veselin

I use Google Maps API to get city name in 2 different languages by users' coordinates. Before version 3.5 of the API I was able to use language option in geocoder's request, but since June 8, 2011 this option is removed.

Can someone give me any idea how can I get the city name in two or more different languages with maps' geocoder?

I included the js script with language option something like this - http://maps.google.com/maps/api/js?sensor=false&language=ja

我使用 Google Maps API 通过用户坐标获取 2 种不同语言的城市名称。在 API 3.5 版之前,我可以在地理编码器的请求中使用语言选项,但自 2011 年 6 月 8 日起,此选项已被删除。

有人可以告诉我如何使用地图的地理编码器以两种或多种不同语言获取城市名称吗?

我包含了带有语言选项的 js 脚本 - http://maps.google.com/maps/api/js?sensor=false&language=ja

回答by Lucamug

It seems that the feature has been removed:

似乎该功能已被删除:

We made this change to simplify the API. The Geocoder uses the browser's preferred language, or language specified when loading the API" (Source)

我们进行了此更改以简化 API。地理编码器使用浏览器的首选语言,或加载 API 时指定的语言”(来源

It still work if used directly:

如果直接使用它仍然有效:

http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false&language=ja

http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false&language=ja

http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false&language=en

http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false&language=en