Description
When creating an event, the location field autocomplete saves the place name in the user's browser language. An Italian user searching "London" gets "Londra" stored in the event. An English user then searching "London" finds nothing — the text doesn't match.
Steps to reproduce
- Open the create event form with a browser set to Italian or other language
- Type "London" in the location field
- Select the first result
- The stored location string is "Londra, Greater London, Inghilterra, Regno Unito"
Root cause
FormGeoSearchField uses leaflet-geosearch's OpenStreetMapProvider with no accept-language parameter:
// src/components/common/form/FormGeoSearchField.tsx
return new OpenStreetMapProvider(); // no accept-language
leaflet-geosearch calls Nominatim via the browser's fetch. The browser automatically attaches an Accept-Language HTTP header (e.g. it for Italian), and Nominatim honours it — returning "Londra", "San Paolo", "Monaco di Baviera". This header cannot be suppressed or overridden from JavaScript (it is a forbidden header name); the only way to override it is via Nominatim's accept-language query parameter, which takes priority over the HTTP header.
There are 3 ways to fix this; number 1 in my opinion is the best:
Proposed fixes
-
Bypass leaflet-geosearch and query Nominatim directly. leaflet-geosearch is a thin wrapper (URL builder + response mapper) — it adds no meaningful logic here beyond what a direct fetch provides. Querying directly gives full control over all params, removes the dependency, and also allows removing the unused leaflet-geosearch/dist/geosearch.css import.
-
Force a non-existent language code in the provider params:
new OpenStreetMapProvider({ params: { "accept-language": "xx" } })
Nominatim fails to find a translation for xx and falls back to the place's local name field (e.g. "München", "Roma"). Simple one-liner, but relies on undocumented fallback behaviour.
-
Add namedetails: 1 to the provider params:
new OpenStreetMapProvider({ params: { namedetails: 1 } })
Nominatim then includes a namedetails object in each result. raw.namedetails.name is always the local name, regardless of browser language. Downside: option.label (built from display_name) is still in the browser's language, so the display label would need to be reconstructed manually from raw fields.
Description
When creating an event, the location field autocomplete saves the place name in the user's browser language. An Italian user searching "London" gets "Londra" stored in the event. An English user then searching "London" finds nothing — the text doesn't match.
Steps to reproduce
Root cause
FormGeoSearchFieldusesleaflet-geosearch'sOpenStreetMapProviderwith noaccept-languageparameter:leaflet-geosearchcalls Nominatim via the browser'sfetch. The browser automatically attaches anAccept-LanguageHTTP header (e.g.itfor Italian), and Nominatim honours it — returning "Londra", "San Paolo", "Monaco di Baviera". This header cannot be suppressed or overridden from JavaScript (it is a forbidden header name); the only way to override it is via Nominatim'saccept-languagequery parameter, which takes priority over the HTTP header.There are 3 ways to fix this; number 1 in my opinion is the best:
Proposed fixes
Bypass
leaflet-geosearchand query Nominatim directly.leaflet-geosearchis a thin wrapper (URL builder + response mapper) — it adds no meaningful logic here beyond what a directfetchprovides. Querying directly gives full control over all params, removes the dependency, and also allows removing the unusedleaflet-geosearch/dist/geosearch.cssimport.Force a non-existent language code in the provider params:
Nominatim fails to find a translation for
xxand falls back to the place's localnamefield (e.g. "München", "Roma"). Simple one-liner, but relies on undocumented fallback behaviour.Add
namedetails: 1to the provider params:Nominatim then includes a
namedetailsobject in each result.raw.namedetails.nameis always the local name, regardless of browser language. Downside:option.label(built fromdisplay_name) is still in the browser's language, so the display label would need to be reconstructed manually fromrawfields.