Skip to content

fix(geocoding): support configured google maps locale in geocoding re…#279

Open
spanchenko wants to merge 1 commit into
fleetbase:mainfrom
spanchenko:fix/google-maps-locale
Open

fix(geocoding): support configured google maps locale in geocoding re…#279
spanchenko wants to merge 1 commit into
fleetbase:mainfrom
spanchenko:fix/google-maps-locale

Conversation

@spanchenko

Copy link
Copy Markdown

Description

Currently, Google Maps geocoding and reverse-geocoding requests in FleetOps always return address details and street names in English. This happens because Geocoding.php hardcodes 'en' as the locale for StatefulGeocoder and passes null as the region to the GoogleMaps provider, ignoring the system-configured services.google_maps.locale setting.

This PR introduces dynamic locale support by retrieving the configured locale (config('services.google_maps.locale', env('GOOGLE_MAPS_LOCALE', 'en'))) and passing it to both the GoogleMaps provider (for region bias) and StatefulGeocoder` (for localized language response).

Changes

  • Added Geocoding::getLocale() helper method to retrieve the configured locale.
  • Updated geocode(), reverseFromQuery(), and reverseFromCoordinates() in Geocoding.php to use getLocale() instead of hardcoded 'en' and null region parameters.

How to Test

  1. Configure Google Maps in System Settings (Settings -> Services -> Google Maps) with API key and set google_maps_locale to a non-English locale (e.g. ru, es, fr).
  2. Search for or save a new place via reverse geocoding or geocoder lookup.
  3. Verify that returned street names and address components are rendered in the configured locale instead of English.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant