Send the language string to nominatim.
authorTom Hughes <tom@compton.nu>
Tue, 10 Nov 2009 15:05:23 +0000 (15:05 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 10 Nov 2009 15:05:23 +0000 (15:05 +0000)
app/controllers/geocoder_controller.rb

index fdde8285222e614c2f1dab51030fcf9c9c5b9307..c84571407c7accb4f1fcf4332555a2b9d30b84ac 100644 (file)
@@ -232,7 +232,7 @@ class GeocoderController < ApplicationController
     @results = Array.new
 
     # ask nominatim
-    response = fetch_xml("http://nominatim.openstreetmap.org/search?format=xml&q=#{escape_query(query)}#{viewbox}")
+    response = fetch_xml("http://nominatim.openstreetmap.org/search?format=xml&q=#{escape_query(query)}#{viewbox}&accept-language=#{request.user_preferred_languages.join(',')}")
 
     # parse the response
     response.elements.each("searchresults/place") do |place|
@@ -350,7 +350,7 @@ class GeocoderController < ApplicationController
     @results = Array.new
 
     # ask OSM namefinder
-    response = fetch_xml("http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}")
+    response = fetch_xml("http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{request.user_preferred_languages.join(',')}")
 
     # parse the response
     response.elements.each("reversegeocode") do |result|