就像你訪問maps.google.com.tw
或maps.google.co.kr
或maps.google.co.jp
,你可以看到他們自己的語言顯示在每個國家。我可以在Google Maps API中使用哪些屬性來動態設置使用特定語言顯示的Google地圖?如何在Google Maps API中指定語言?
30
A
回答
60
在谷歌地圖API第3版,「語言」屬性添加到腳本標籤。例如,下面我們來設置地圖的地名和導航按鈕顯示俄羅斯:
<script
src="http://maps.google.com/maps/api/js?sensor=false&language=ru-RU"
type="text/javascript"></script>
結果:
7
對於V2地圖API:
可以可選hl
參數添加到包括谷歌地圖API時<script>
標籤,指定域的語言來使用,如下面的例子:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Localization of the Google Maps API</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&hl=ko"
type="text/javascript"></script>
</head>
<body onunload="GUnload()">
<div id="map_canvas" style="width: 400px; height: 300px"></div>
<script type="text/javascript">
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(36.48, 128.00), 7);
map.setUIToDefault();
</script>
</body>
</html>
截圖:
您可能還需要檢查以下資源進一步閱讀:
10
0
語言代碼是IETF語言代碼:
http://en.wikipedia.org/wiki/IETF_language_tag
<script
src="http://maps.google.com/maps/api/js?sensor=false&language=ru-RU"
type="text/javascript"></script>
相關問題
- 1. Google Maps API v3 - 如何指定「VehicleType」
- 2. 如何在Google Translate API .NET中指定源語言?
- 3. Google Maps API v3.5 Geocoder語言選項
- 4. 在Google Maps API v3中爲DirectionsService設置語言
- 5. 在Google Maps API中生成Google Maps URL
- 6. 如何在Google Maps for Android中設置地址的語言?
- 7. Google Maps Engine API指南?
- 8. 使用Google Maps API指示
- 9. Google Maps API行車指南
- 10. Google AJAX中文語言API
- 11. 如何在Google Maps API v2中disableDefaultUI?
- 12. 如何在Google Maps API中使用Webpack?
- 13. Google Maps API與Google Maps Engine?
- 14. 如何將google map v2 api語言更改爲希伯來語
- 15. Google Maps API v2 vs Google Maps API v3?
- 16. 如何在Google Maps API V3中集中圖片定位點?
- 17. Google Maps API google.maps.event未定義
- 18. Google Maps API綁定錯誤
- 19. 如何通過Google Maps指示識別Places API中的設施?
- 20. 如何使用1個手指在Google Maps API(android)上旋轉?
- 21. 如何在Google Maps API中顯示印地語?有人向我推薦地圖的代表語言代碼
- 22. 如何在Google Maps URL中指定抵達日期和時間?
- 23. Google Maps API v2中的setBounds如何?
- 24. 如何在Google Maps API V2中鎖定相機
- 25. Google Maps API OVER_QUERY_LIMIT
- 26. Google Maps API JS
- 27. Google Maps API 3
- 28. Google Maps Places API
- 29. Google maps API javascript
- 30. Google Static Maps Api?
在JavaScript中加載地圖之後沒有辦法設置語言嗎? – Marc 2015-11-19 08:48:39
仍然在尋找動態更改語言或API密鑰的方式。除手動腳本重新連接以外別無他法。 – Rantiev 2017-07-05 15:11:52