【问题标题】:Google Map API geocoder language not workingGoogle Map API 地理编码器语言不起作用
【发布时间】:2015-06-24 07:46:18
【问题描述】:

我用不同的语言向 Google Map API 地理编码器发出 2 个请求:

geocoder.geocode({
    'latLng': latlng,
    'language': 'en'
}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
        $address_en.val(results[0].formatted_address);
    }
});

geocoder.geocode({
    'latLng': latlng,
    'language': 'ja'
}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
        $address_ja.val(results[0].formatted_address);
    }
});

但地理编码器在两个请求中都使用默认语言

--- 更新:---

我在新的 API documentation (Reference) 中没有看到 language 参数。 但它更早存在。

我在Changelog找到它:

3.5 2011 年 6 月 8 日

显着变化:

  • 删除了 GeocoderRequest 的“语言”选项

现在可以做吗?

【问题讨论】:

    标签: javascript google-maps google-maps-api-3


    【解决方案1】:

    google.maps.GeocoderRequest 对象没有 language 属性。

    地址将由地理编码器使用浏览器的首选语言设置或在使用语言参数加载 API JavaScript 时指定的语言返回。 (欲了解更多信息,请参阅Localization。)

    来源:https://developers.google.com/maps/documentation/javascript/geocoding

    【讨论】:

      猜你喜欢
      • 2013-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多