Modder
Modder

Reputation: 893

Google Map API geocoder language not working

I make 2 requests to Google Map API geocoder in different languages:

geocoder.geocode({
    'latLng': latlng,
    'language': 'en'
}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
        $address_en.val(results[0].formatted_address);
    }
});

geocoder.geocode({
    'latLng': latlng,
    'language': 'ja'
}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
        $address_ja.val(results[0].formatted_address);
    }
});

But geocoder use default language in both request.

--- Update: ---

I don’t see language parameter in new API documentation (Reference). But it existed earlier.

I found it in Changelog:

3.5 June 8, 2011

Noticeable changes:

  • Removed GeocoderRequest’s "language" option

Is it possible to do this now?

Upvotes: 3

Views: 1341

Answers (1)

MrUpsidown
MrUpsidown

Reputation: 22487

The google.maps.GeocoderRequest object does not have a language property.

The addresses will be returned by the Geocoder using the browser's preferred language setting, or the language specified when loading the API JavaScript using the language parameter. (For more information, see Localization.)

Source: https://developers.google.com/maps/documentation/javascript/geocoding

Upvotes: 2

Related Questions