From 81c04a59c51386f5b74712ff3f368af9f594ad68 Mon Sep 17 00:00:00 2001 From: Silvan Date: Thu, 2 Mar 2023 15:40:34 +0100 Subject: [PATCH] Update index.js This should add a dynamic label for "No results found", related to #328 Disclaimer: not tested, just a "walk by fix", hopefully it fits --- lib/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index ae741997..9e5a85d5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -76,6 +76,7 @@ function getFooterNode() { * @param {String} [options.worldview="us"] Filter results to geographic features whose characteristics are defined differently by audiences belonging to various regional, cultural, or political groups. * @param {Boolean} [options.enableGeolocation=false] If `true` enable user geolocation feature. * @param {('address'|'street'|'place'|'country')} [options.addressAccuracy="street"] The accuracy for the geolocation feature with which we define the address line to fill. The browser API returns the user's position with accuracy, and sometimes we can get the neighbor's address. To prevent receiving an incorrect address, you can reduce the accuracy of the definition. + * @param {String} [options.noResultsLabel="No results found"] Text to display if no results have been found. * @example * var geocoder = new MapboxGeocoder({ accessToken: mapboxgl.accessToken }); * map.addControl(geocoder); @@ -888,7 +889,7 @@ MapboxGeocoder.prototype = { }, _renderNoResults: function(){ - var errorMessage = "
No results found
"; + var errorMessage = `
${this.options.noResultsLabel || 'No results found'}
`; this._renderMessage(errorMessage); },