From: Sarah Hoffmann Date: Sun, 23 Jun 2013 20:46:26 +0000 (+0200) Subject: Show more specific boundary type in search results X-Git-Tag: live~4975 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/378869b77dd488b10eabda7f213550b0b815923a Show more specific boundary type in search results --- diff --git a/app/controllers/geocoder_controller.rb b/app/controllers/geocoder_controller.rb index 47befda38..8f02ce51d 100644 --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@ -174,6 +174,10 @@ class GeocoderController < ApplicationController name = place.attributes["display_name"].to_s min_lat,max_lat,min_lon,max_lon = place.attributes["boundingbox"].to_s.split(",") prefix_name = t "geocoder.search_osm_nominatim.prefix.#{klass}.#{type}", :default => type.gsub("_", " ").capitalize + if klass == 'boundary' and type == 'administrative' + rank = (place.attributes["place_rank"].to_i + 1) / 2 + prefix_name = t "geocoder.search_osm_nominatim.admin_levels.level#{rank}", :default => prefix_name + end prefix = t "geocoder.search_osm_nominatim.prefix_format", :name => prefix_name object_type = place.attributes["osm_type"] object_id = place.attributes["osm_id"] diff --git a/config/locales/en.yml b/config/locales/en.yml index 0b30e95a9..f9ea7412c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -922,6 +922,14 @@ en: waterfall: "Waterfall" water_point: "Water Point" weir: "Weir" + admin_levels: + level2: "Country Boundary" + level4: "State Boundary" + level5: "Region Boundary" + level6: "County Boundary" + level8: "City Boundary" + level9: "Village Boundary" + level10: "Suburb Boundary" description: title: osm_nominatim: 'Location from OpenStreetMap Nominatim'