Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google.maps.places.Autocomplete localization

In my app I'm using google.maps.places.Autocomplete.getPlace() in order to get info such the name of a city, the problem is that the informations retrieved are localized according to the "language" parameter passed via querystring when importing the library, instead I would like to have them always in english, while preserving localization in the autocomplete and the rendered map (that is, if the user is italian he will see for example "Venezia" in the UI, but in my client-side api I will get "Venice")... how can I do?

like image 611
daveoncode Avatar asked Aug 27 '13 19:08

daveoncode


People also ask

How does Google address autocomplete work?

Autocomplete predictions reflect real searches that have been done on Google. To determine what predictions to show, our systems look for common queries that match what someone starts to enter into the search box but also consider: The language of the query. The location a query is coming from.

How Use Google places autocomplete Android?

The autocomplete widget is a search dialog with built-in autocomplete functionality. As a user enters search terms, the widget presents a list of predicted places to choose from. When the user makes a selection, a Place instance is returned, which your app can then use to get details about the selected place.


1 Answers

Okay, I found it here: https://developers.google.com/maps/documentation/javascript/basics#Localization

So basically you need to provide language parameter when loading Google API:

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?language=en">
like image 153
Kamil Avatar answered Sep 28 '22 10:09

Kamil