diff options
-rw-r--r-- | src/org/traccar/Context.java | 2 | ||||
-rw-r--r-- | src/org/traccar/geocoder/NominatimGeocoder.java | 9 | ||||
-rw-r--r-- | test/org/traccar/geocoder/GeocoderTest.java | 2 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java index 348b7edc2..bfef3807b 100644 --- a/src/org/traccar/Context.java +++ b/src/org/traccar/Context.java @@ -222,7 +222,7 @@ public final class Context { int cacheSize = config.getInteger("geocoder.cacheSize"); switch (type) { case "nominatim": - geocoder = new NominatimGeocoder(url, key, cacheSize); + geocoder = new NominatimGeocoder(url, key, language, cacheSize); break; case "gisgraphy": geocoder = new GisgraphyGeocoder(url, cacheSize); diff --git a/src/org/traccar/geocoder/NominatimGeocoder.java b/src/org/traccar/geocoder/NominatimGeocoder.java index 4f33468fd..051727e93 100644 --- a/src/org/traccar/geocoder/NominatimGeocoder.java +++ b/src/org/traccar/geocoder/NominatimGeocoder.java @@ -19,7 +19,7 @@ import javax.json.JsonObject; public class NominatimGeocoder extends JsonGeocoder { - private static String formatUrl(String url, String key) { + private static String formatUrl(String url, String key, String language) { if (url == null) { url = "http://nominatim.openstreetmap.org/reverse"; } @@ -27,11 +27,14 @@ public class NominatimGeocoder extends JsonGeocoder { if (key != null) { url += "&key=" + key; } + if (language != null) { + url += "&accept-language=" + language; + } return url; } - public NominatimGeocoder(String url, String key, int cacheSize) { - super(formatUrl(url, key), cacheSize); + public NominatimGeocoder(String url, String key, String language, int cacheSize) { + super(formatUrl(url, key, language), cacheSize); } @Override diff --git a/test/org/traccar/geocoder/GeocoderTest.java b/test/org/traccar/geocoder/GeocoderTest.java index 6f4fc1710..40b6fd75d 100644 --- a/test/org/traccar/geocoder/GeocoderTest.java +++ b/test/org/traccar/geocoder/GeocoderTest.java @@ -45,7 +45,7 @@ public class GeocoderTest { } public void testNominatim() throws InterruptedException { - Geocoder geocoder = new NominatimGeocoder(null, null, 0); + Geocoder geocoder = new NominatimGeocoder(null, null, null, 0); geocoder.getAddress(new AddressFormat(), 40.7337807, -73.9974401, new Geocoder.ReverseGeocoderCallback() { @Override |