//....
directionsDisplay = new google.maps.DirectionsRenderer();
directionsDisplay.setMap(map);
directionsService = new google.maps.DirectionsService();
var request = {
origin : new google.maps.LatLng(origin.lat, origin.lng),
destination : new google.maps.LatLng(destination.lat, destination.lng),
travelMode : google.maps.DirectionsTravelMode.DRIVING,
unitSystem : google.maps.DirectionsUnitSystem.METRIC,
region: 'de'
};
directionsService.route(request, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(result);
}
});
//....
作为结果,我得到了类似于这样的东西。
Head southwest on 吳江路/吴江路 toward 泰兴路/泰興路
Turn left at 茂名北路
Continue onto 茂名南路
Turn right at 淮海中路
Slight left to stay on 淮海中路
Turn left at 华山路/華山路
我的浏览器上的指示是英语,而我的法国同事在他们的法国火狐浏览器上是法语,街道名称是中文的,我原以为我请求的是德语信息
region: 'de'
现在好了,也许中文街道名称在德语中不可用,但将区域设置为gb、en甚至zh似乎没有任何作用。我真的希望文本只是一种语言,最好是英语。编辑我非常确定街道名称是英语的,因为当我使用地理编码器时,结果是英语的,例如
Shimen Road (No.1)
编辑2使用http://maps.google.com/maps/api/js?sensor=false&
language=cs,我可以强制将指示转换为某种语言,但街道名称仍然是中文的。使用地理编码器API,我可以接收到已翻译成英语/德语/法语的中文街道名称(如果缺少德语/法语翻译,则回退到英语),所以为什么方向街道名称会被困在中文中就不合理了。这可能只是谷歌方面的一个缺陷/故意,但我有点怀疑。是否有原因?