2017-08-29 8 views

答えて

0

はい、もちろんです!

ラベルの言語を設定するのは非常に簡単です。 google maps apiをダウンロードするときには、パラメータ言語を追加する必要があります。ここでは英語での要求の例である:

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

そして、これは英語のラベルを持つエジプトの完全なコードです:

// 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); 
 
    }); 
 
}
/* 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; 
 
}
<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>

あなたには、いくつかの質問がある場合を教えてください、

スフィンクス

+0

スクリプトをこのmaps.googleapis.com/maps/api/js?&language=en®ion=IN&callback=initMapに変更しましたが、英語とテルグ語(時にはヒンディー語)が表示されます。問題はヒンディー語またはテルグ語のみを表示せず、英語のみを表示することです。 – nopapa

+0

完全なコード(またはマップを初期化する部分だけでなく、スクリプトがマップ上の大きな変更を...)を私に与えると、より効率的になります。私はすでにあなたにもっとお手伝いすることはできません。あなたは私の実行スニペットと同じ結果を持っていますか?スニペットを実行すると同じ結果になります。次のドキュメントを参照してください。https://google-developers.appspot.com/maps/documentation/javascript/examples/map-rtl –

+0

そして、私のコードは、あなたが言語と地域の属性の違いでスニペットに書いたものと同じです。私は何も見つけられなかったドキュメントを調べました。 英語のラベルのみを表示することができますか? – nopapa

0

あなたは、それは英語のみが表示されますローカル言語に

language=uk 

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

を削除するには、これを設定することができます。

関連する問題