Allow translation of the search field placeholder text

It was not translated before, since the string was coming from an
external dependency.
This commit is contained in:
Henrik Fehlauer 2020-06-01 18:00:00 +00:00
parent fd97019fdc
commit f23e3751b5
2 changed files with 10 additions and 0 deletions

View file

@ -9,6 +9,15 @@ BR.Search = L.Control.Geocoder.extend({
position: 'topleft' position: 'topleft'
}, },
initialize: function(options) {
L.Control.Geocoder.prototype.initialize.call(this, options);
L.setOptions(this, {
// i18next.t will only return 'undefined' if it is called in a static context
// (e.g. when added directly to "options:" above), so we have to call it here
placeholder: i18next.t('map.geocoder-placeholder')
});
},
markGeocode: function(result) { markGeocode: function(result) {
this._map.fitBounds(result.geocode.bbox, { this._map.fitBounds(result.geocode.bbox, {
maxZoom: 17 maxZoom: 17

View file

@ -91,6 +91,7 @@
"draw-route-start": "Draw route (D key)", "draw-route-start": "Draw route (D key)",
"draw-route-stop": "Stop drawing route (ESC key)", "draw-route-stop": "Stop drawing route (ESC key)",
"enter-poi-name": "Enter Point of Interest name", "enter-poi-name": "Enter Point of Interest name",
"geocoder-placeholder": "Search…",
"hikebike-hillshading": "Hillshading", "hikebike-hillshading": "Hillshading",
"hiking": "Hiking", "hiking": "Hiking",
"layer": { "layer": {