我正在使用Google Places API网络服务,特别是nearbysearch
来搜索我周围的地方。但是,我得到的一些地方名称是英语以外的语言,有些是中文和阿拉伯语,我试图在网址中加入language=en
。但是,没有运气。值得一提的是,如果我在www.google.com/maps
我正在使用的网址:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=25.1677738,55.4030409&radius=500&type=food&language=en&name=&key=YourKey
请注意,我已从网址中删除了我的密钥。
这是我使用阿拉伯语地名
获得的结果的一部分{
"geometry" : {
"location" : {
"lat" : 25.167926,
"lng" : 55.4015231
}
},
"icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",
"id" : "328ca6a7bb4dd48eb44215ed32fa5676fca8e462",
"name" : "سوبر ماركت بوماز ٢٤ساعة",
"place_id" : "ChIJlcEHXrVmXz4RJH7IVn7Rps4",
"reference" : "CoQBfwAAAI8pnOqGRA6E71Mmztnk8ueSA7kS9bn5idY3S5V0_D_JZP2F9knryHUervQXA_RZL3-9KZJH55NrX0dz4p1R1GUQbGz4jXGoDQMJemisTLpiu41dm8-wgZT6XzXsDUeLLo6QbENam3hM2gCXPzpjTu4F7GsV4t4bIX5FhDQ-SufVEhDYboMkA1reMj20kM4AAvzGGhStwclS0fE9rWQkn5LTUcxiio-3vA",
"scope" : "GOOGLE",
"types" : [
"grocery_or_supermarket",
"food",
"store",
"point_of_interest",
"establishment"
],
"vicinity" : "U2 - Italy U17 - Dubai"
}
答案 0 :(得分:0)
Looked around the community for a while and found this a post that is regarding the inconsistency in the language used in Google Places API results. And as per the answer, it seems that it is actually a correct behavior, from the answer:
Even if you specify a language, it will return the response in that language only if there is one available, if not it will return the response in the language it was originally entered in.
There are workarounds included in there that I think that would be helpful for you. Hope this helps. Good luck. :)