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'
},
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) {
this._map.fitBounds(result.geocode.bbox, {
maxZoom: 17