2011-07-08 24 views
0

有没有我可以在谷歌地图地理编码器(V3)使用任何属性来动态地设置结果(google.maps.GeocoderResult)语言?不使用HTML头纸条标记<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&amp;language=vi-VN"></script>谷歌地图API地址解析器(V3),如何设置语言上google.maps.GeocoderResult

例如

var G = new google.maps.Geocoder(); // google geocoder 
G.geocode({'location': ll/*, 'language':'vi-VN'*/}, function(results, status) { 
if (status == google.maps.GeocoderStatus.OK) { 
    if (results[0]) {     
     me.set({'locate':results[0].address_components}); 
     me.set({'address':results[0].formatted_address}); 
    } else { 
     alert("No results found"); 
    } 
} else { 
    alert("Geocoder failed due to: " + status); 
} 

原因我想建立一个区域树连接点具有如图所示相同区域

 us 
    / \ 
    new york ... 
    /\ 
    p1 p2 

,P1和P2在同一地区'纽约'

谢谢

回答

0

我相信在v2中可以做到这一点,但在v3中,这些选择是浏览器首选项,通过API脚本URL中的参数进行语言本地化以及通过API脚本URL中的参数进行区域本地化。

如果你想分享你的使用情况的详细信息,有可能拿出一个解决方案/解决方法。

+0

@Tritt:谢谢你的建议,我有更新一些信息 –

+0

为什么要动态设置语言? p1和p2在同一个区域。好。所以呢?为什么要用除了用户通过浏览器偏好选择的语言以外的其他语言显示结果? – Trott