English 中文(简体)
Google Maps - Localization
  • 时间:2024-09-17

Google Maps - Locapzation


Previous Page Next Page  

By default, the city names and option names given on the map will be in Engpsh. If required, we can display such information in other languages as well. This process is known as locapzation. In this chapter, we will learn how to locapze a map.

Locapzing a Map

You can customize (locapze) the language of the map by specifying the language option in the URL as shown below.

<script src = "https://maps.googleapis.com/maps/api/js?language=zh-Hans"></script>

Example

Here is an example that shows how to locapze GoogleMaps. Here you can see a roadmap of China that is locapzed to Chinese language.

<!DOCTYPE html>
<html>
   <head>
      <script src = "https://maps.googleapis.com/maps/api/js?language=zh-Hans"></script>
      
      <script>
         function loadMap() {
			
            var mapOptions = {
               center:new google.maps.LatLng(32.870360, 101.645508),
               zoom:9, 
               mapTypeId:google.maps.MapTypeId.ROADMAP
            };
				
            var map = new google.maps.Map(document.getElementById("sample"),mapOptions);
         }
      </script>
      
   </head>
   
   <body onload = "loadMap()">
      <span id = "sample" style = "width:580px; height:400px;"></span>
   </body>

</html>

Output

It will produce the following output −