Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It would be nice to be able to set the language for the response
https://developers.google.com/maps/documentation/javascript/geocoding
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 paramete
function ip_geoloc_address ($latitude, $longitude, $options =array();)
functionip_geoloc_reverse_geocode ($latitude, $longitude, $options =array();)
for each function you could do something like
// add language if exist
if (isset($options['language'])) {
$lang = $options['language'];
}else { $lang = NULL;}
Comments
Comment #1
RdeBoer1)
function ip_geoloc_reverse_geocode(...)
is used only for the batch reverse geocoding of historic visits, i.e. visits to the site before IPGV&M was enabled. For these historic visigts only an IP address is available (via core's Statistics module, if it was enabled). The IP addresses are converted to lat/long (via Smart IP or GeoIP) and the lat/long in turn are converted to street addresses, via the function you mentioned.Is that what you want the language option for?
Or....
2) Reverse-geocoding of current (and future) visitors is done client-side, i.e. via their browser.
According to https://developers.google.com/maps/documentation/javascript/basics#Local... the language used for maps etc. is the language as set in the visitor's browser.
Are you saying you want to override this and impose another language?
Rik
Comment #3
RdeBoerI've added to the ip_geoloc API the functionality from the original post as described above in 1). However there is currently no config page to pass the language down from. It's purely an API function at the moment. I'm not sure if there should be a UI/config option for a single language to be imposed on all historic IP addresses being reverse-geocoded across the world.
I don't think I'm going to implement the functionality described in 2).
Rik