从Google地图中删除本地语言标签

时间:2017-08-29 13:15:51

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

如果你看到了 Google Maps Image标签文本是英文和其他语言(泰卢固语)。是否有方法仅以英文显示标签文本并隐藏或删除其他语言标签文本。?

由于

2 个答案:

答案 0 :(得分:1)

您可以将其设置为删除本地语言

language=uk

https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&language=uk&region=EG&callback=initMap

然后它只会显示英文。

答案 1 :(得分:0)

是的,当然!

设置标签的语言非常简单。您可能需要在下载google maps api时添加参数语言。以下是英语请求的示例:

<script async defer
    src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&language=en&region=EG&callback=initMap"></script>

这是一份带有英文标签的埃及的完整代码:

&#13;
&#13;
// This example displays a map with the language set to Arabic and the
// regions set to Egypt. These settings are specified in the HTML script
// element when loading the Google Maps JavaScript API.
// Setting the language shows the map in the language of your choice.
// Setting the region biases the geocoding results to that region.
// In addition, the page's html element sets the text direction to
// right-to-left.
function initMap() {
  var cairo = {lat: 30.064742, lng: 31.249509};

  var map = new google.maps.Map(document.getElementById('map'), {
    scaleControl: true,
    center: cairo,
    zoom: 10
  });

  var infowindow = new google.maps.InfoWindow;
  infowindow.setContent('<b>القاهرة</b>');

  var marker = new google.maps.Marker({map: map, position: cairo});
  marker.addListener('click', function() {
    infowindow.open(map, marker);
  });
}
&#13;
/* Always set the map height explicitly to define the size of the div
 * element that contains the map. */
#map {
  height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}
&#13;
<div id="map"></div>
<!-- Replace the value of the key parameter with your own API key. -->
<script async defer
    src="https://maps.googleapis.com/maps/api/js?&language=en&region=EG&callback=initMap"></script>
&#13;
&#13;
&#13;

如果您有疑问,请告诉我,

斯芬克斯