geocoder-php / Geocoder

The most featured Geocoder library written in PHP.
https://geocoder-php.org
MIT License
3.94k stars 515 forks source link

[Google Maps] Add output language support #940

Open mikebronner opened 5 years ago

mikebronner commented 5 years ago

The following was submitted in the GeocoderLaravel repo by @xSoulRootx (https://github.com/geocoder-php/GeocoderLaravel/issues/144), but probably belongs here:

============

General Information

GeocoderLaravel Version: ^4.0 Laravel Version: 5.7.* PHP Version: 7.2 Operating System and Version: Ubuntu

Issue Description

Output language in reverse query don't work

Resolve

vendor\geocoder-php\google-maps-provider\GoogleMaps.php

in

public function reverseQuery(ReverseQuery $query): Collection

before

return $this->fetchUrl($url, $query->getLocale(), $query->getLimit(), $query->getData('region', $this->region));

add

        if (null !== $query->getLocale()) {
            $url .= '&result_type='.urlencode($resultType);
        } else {
            $url .= '&language='.env('GOOGLE_MAPS_LOCALE', 'en-US');
        }

or something like this

atymic commented 5 years ago

On a side note, most of the google maps tests are failing 🤔

mikebronner commented 5 years ago

Sorry, deleted my comment, I mistakenly thought I was in the other repo.

atymic commented 5 years ago

@mikebronner Seems 10 tests are failing: Screen Shot 2019-06-25 at 9 14 29 am

I'll create a PR to fix them when I have a chance.

atymic commented 5 years ago

@xSoulRootx

Can you verify that you were setting the locale and it is working?

atymic commented 4 years ago

@xSoulRootx

Can you verify that you were setting the locale and it is working