X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/3d3b2b47964ec91ef1ab1946b7258a06665caced..e2e61692ea04fc156221082aeddc21ea18facdec:/app/assets/javascripts/index/query.js diff --git a/app/assets/javascripts/index/query.js b/app/assets/javascripts/index/query.js index ee9d3f415..790057400 100644 --- a/app/assets/javascripts/index/query.js +++ b/app/assets/javascripts/index/query.js @@ -68,12 +68,14 @@ OSM.Query = function (map) { const tags = feature.tags; let prefix = ""; - if (tags.boundary === "administrative" && tags.admin_level) { - prefix = I18n.t("geocoder.search_osm_nominatim.admin_levels.level" + tags.admin_level, { - defaultValue: I18n.t("geocoder.search_osm_nominatim.prefix.boundary.administrative") + if (tags.boundary === "administrative" && (tags.border_type || tags.admin_level)) { + prefix = OSM.i18n.t("geocoder.search_osm_nominatim.border_types." + tags.border_type, { + defaultValue: OSM.i18n.t("geocoder.search_osm_nominatim.admin_levels.level" + tags.admin_level, { + defaultValue: OSM.i18n.t("geocoder.search_osm_nominatim.prefix.boundary.administrative") + }) }); } else { - const prefixes = I18n.t("geocoder.search_osm_nominatim.prefix"); + const prefixes = OSM.i18n.t("geocoder.search_osm_nominatim.prefix"); for (const key in tags) { const value = tags[key]; @@ -98,7 +100,7 @@ OSM.Query = function (map) { } if (!prefix) { - prefix = I18n.t("javascripts.query." + feature.type); + prefix = OSM.i18n.t("javascripts.query." + feature.type); } return prefix; @@ -211,14 +213,14 @@ OSM.Query = function (map) { if (results.remark) { $("
  • ") .addClass("list-group-item") - .text(I18n.t("javascripts.query.error", { server: url, error: results.remark })) + .text(OSM.i18n.t("javascripts.query.error", { server: url, error: results.remark })) .appendTo($ul); } if ($ul.find("li").length === 0) { $("
  • ") .addClass("list-group-item") - .text(I18n.t("javascripts.query.nothing_found")) + .text(OSM.i18n.t("javascripts.query.nothing_found")) .appendTo($ul); } }) @@ -229,7 +231,7 @@ OSM.Query = function (map) { $("
  • ") .addClass("list-group-item") - .text(I18n.t("javascripts.query.error", { server: url, error: error.message })) + .text(OSM.i18n.t("javascripts.query.error", { server: url, error: error.message })) .appendTo($ul); }); } @@ -326,7 +328,7 @@ OSM.Query = function (map) { const params = new URLSearchParams(path.substring(path.indexOf("?"))), latlng = L.latLng(params.get("lat"), params.get("lon")); - if (!window.location.hash && !noCentre && !map.getBounds().contains(latlng)) { + if (!location.hash && !noCentre && !map.getBounds().contains(latlng)) { OSM.router.withoutMoveListener(function () { map.setView(latlng, 15); });