如何在运行中更改Google地图的语言? [英] How can I change the language of Google Maps on the run?

查看:125
本文介绍了如何在运行中更改Google地图的语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想翻译地理编码并以两种语言获取地址,即阿拉伯语和英语,所以我想用一种语言获取它,然后更改API的语言并获取其他语言的地址,因为我无法找到一个参数发送给地理编码器以确定语言。
有什么建议吗?

I wan't to reverse geocode and get the address in two languages arabic and english so I want to get it in one language then change the language of the API and get the address in the other language, as I can't find a parameter to send to geocoder to determine the language. Any suggestions?

推荐答案

当您通过追加语言= XX 到API URL,其中 XX 是双字符语言代码( en 用于英语, ar 用于阿拉伯语等)到API调用中的URL。请参阅 http://code.google.com/apis/maps/documentation/javascript/basics .html#本地化以获取文档。

This won't let you change it on the fly, and I don't think you can do that. You can try loading the API a second time after getting the initial info you need in one language. But that seems likely to cause problems.

这不会让您在运行中更改它,我认为您不能这样做。在用一种语言获取所需的初始信息后,您可以再次尝试加载API。但这似乎可能会导致问题。

更简单的方法是创建一个单独的页面,为您提供一种Web服务。它接受两个参数:语言代码和地址。它使用请求的语言代码加载API,并反向地址解析地址,提供结果。你的页面会调用这个类似Web服务的东西两次,每种语言一次,然后根据需要使用结果。

A cleaner way to do it might be to create a separate page that acts as a sort of web service for you. It accepts two parameters: A language code and an address. It loads the API using the language code requested, and reverse geocodes the address, providing the result. Your page would call this web service-like thing twice, once for each language, and then use the results as desired.

这篇关于如何在运行中更改Google地图的语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆