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

1.4k views Asked by At

Having placeId I need to get place details. I can do this 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 language for place details object?

1

There are 1 answers

2
Dimple On

Google maps provides list of languages you need. Simple adding the &language=(type of language) in script scr

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>