How to indicate the language in the Google Maps API?
Solution 1
In Google Maps API v3, add "language" attribute to script tag. For example, the following will set map to display Russian in location names and navigation buttons:
<script
src="http://maps.google.com/maps/api/js?sensor=false&language=ru-RU"
type="text/javascript"></script>
Result:
Solution 2
In Google Maps v3, you can use the "language" parameter:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=en"></script>
Language codes list: https://developers.google.com/maps/faq#languagesupport
More info: http://googlegeodevelopers.blogspot.com/2009/10/maps-api-v3-now-speaks-your-language.html
Solution 3
For the V2 Maps API:
You can add an optional hl
parameter to the <script>
tag when including the Google Maps API, specifying the domain language to use, as in the following example:
<!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>
Screenshot:
You may also want to check out the following resources for further reading:
Matt
Updated on November 19, 2020Comments
-
Matt over 3 years
Just like you visit
maps.google.com.tw
ormaps.google.co.kr
ormaps.google.co.jp
, you can see their own language shown on every country. Is there any property that I can use in Google Maps API to dynamically set google maps using specific language to display? -
Matt about 14 yearsThanks for the quick and accurate response.
-
Matt almost 14 yearsAfter I test, in v3, language "hl" parameter doesn't support yet.
-
Marc over 8 yearsIs there no way to set the language after the map has been loaded, in Javascript?
-
Rantiev almost 7 yearsStill finding the way to change language dynamically or API key as well. See no way except manual script reconnection.