-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Accept Language in Geolocators #6982
Add support for Accept Language in Geolocators #6982
Conversation
I'm here a little bit splitted what the correct language to send to this controller should be. Is it really the accept language of the browser sending us or when used inside translateable form if we should send then the language to the controller of that content. That would mean on a german form they may need to input @sulu/core-developer what do you think? |
By default, I would recommend using the locale of the request to avoid inconsistencies, such as displaying an English address in a German format. However, I would still provide the option to always use the browser language, in case the project requires it. |
1daa928
to
3e41ac6
Compare
1411405
to
766a304
Compare
Co-authored-by: Prokyonn <daniel.mathis@sector8.eu>
What's in this PR?
Both Nominatim and Google Geolocator support additional parameters to optimize the result of the query, this PR adds a new optional parameter to the GeolocatorInterface::locate method to pass additional options specific for a single query.
As an initial implementation this PR adds the ability to pass to the geolocator an "accept language" string.
Why?
Google Geolocator, if you don't pass the language query string parameter or an Accept-Language http header, tries to infer the desired results' language from the remote IP that it's calling its API, but the server in which runs the Sulu instance may not be located in the same country of the user, this gives a wrong output (wrong labels and/or wrong order).
Example Usage