- Issue created by @tanc
- 🇮🇹Italy itamair
Thanks for reporting this @tanc. Your looks a good point ... I will inspect this better.
Did you already looked if we could implement an hook altering what is passed to the provider, if not already there? - 🇳🇱Netherlands ekes
I think there are two answers to this.
One is that the photon provider should probably implement getHandlerWrapper() and check getCurrentLanguage() is in the list of known languages. If not is should fallback to a hard coded (or configurable) language.
The second is you don't always want to geocode for the getCurrentLanguage, even more so as it defaults to Interface language. You might know what the target language that you want results in... the specific use case I have in mind here is address completion for entities, and translation based on the entity language.
For this second more advanced case it would be helpful to be able to access the geocodeQuery method on the Provider. Then a Geocoder/Query (or specifically Gecoder/GeocodeQuery) can created by the caller withLocale() for that query. Doing this would also be an absolute bonus for geocoders that implement additional functionality (withBounds(), or non-standard parameters like the Nominatim provider's countrycode search restriction which requires withData() added).
Thinking aloud. It would feel like path of least resistance, as there are already providers for Gecoder PHP and GeoPHP, additional interface that Provider's (the Geocoder PHP ones) could implement. Just need thinking about how it works with the caching and throttling (though it might be nice to move that to - Drupal custom - Middleware but as suggested in Geocoder PHP's docs -- it's probably possible to keep the present set-up, though reading the code I realize the caching currently doesn't take into account the locale changing?).Thoughts on both welcome. I kinda need the second so will be making some sort of patch I guess. If it's a good one that works for the module that'd be best!
- Status changed to Fixed
over 1 year ago 10:19pm 30 November 2023 - 🇮🇹Italy itamair
Thanks for your inputs. I dedicated much of my time this evening on this and just pushed an additional commit (both in
8.x-4.x-dev and 8.x-3.x-dev) that is fully accomplishing this feature request.
From the 8.x-3.37 and 8.x-4.12 releases a new Geocoder Additions Options tab is going to be available (with fairly detailed instructions) in every Geocoder Provider settings implementing the ProviderUsingHandlerWithAdapterBase (thus Photon included) where a specific Locale options can be set, to override the default behaviour matching the Current Interface language code/id, and that will be applied in the Geocoder Query withLocale() method ...
(screenshot attached)My regards
- Status changed to Active
over 1 year ago 11:24am 1 December 2023 - 🇳🇱Netherlands ekes
Ah cool I'll have a look. I've got some time I can spend on this (or something else) so that's a bonus.
- Status changed to Fixed
over 1 year ago 11:53am 1 December 2023 - 🇳🇱Netherlands ekes
Oop cached value in the browser. I'll make a follow-up. The specific issue Tanc reported is fixed.
Automatically closed - issue fixed for 2 weeks with no activity.