]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/query.js
Replace use of I18n in javascript with OSM.i18n
[rails.git] / app / assets / javascripts / index / query.js
index c0395c70182438a55854a8ce2068f552807d2f6b..7900574000e1c37fce7ebbedc837f4d97c22cae7 100644 (file)
@@ -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) {
           $("<li>")
             .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) {
           $("<li>")
             .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) {
 
         $("<li>")
           .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);
       });
   }