How can I get details via getDetails in a specific language?

Site Availability I need to get site details. I can do it with the following code:

        var service = new google.maps.places.PlacesService(document.createElement("div"));
        service.getDetails({
            placeId: locationReference
        }, parseLocationDetailResponse.bind(null, function(addressObject) {
            deferred.resolve(addressObject);
        }));

      

How can I manually specify the language for the place details object?

+3


source to share


1 answer


Google Maps provides a list of the languages ​​you need. Simple add &language=(type of language)

to scriptscr



function initialize() {
  var mapOptions = {
    zoom: 8,
    center: new google.maps.LatLng(-34.397, 150.644)
  };
  var map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);
}

google.maps.event.addDomListener(window, 'load', initialize);
      

 html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }
      

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&language=ja"></script>
<div id="map-canvas"></div>
      

Run codeHide result


+1


source







All Articles