Skip to content

Commit 1e139a1

Browse files
committed
Make nominatim search provider locale aware
1 parent 805b71c commit 1e139a1

16 files changed

+187
-7
lines changed

js/SearchProviders.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Format of search results:
7272
import axios from 'axios';
7373
import {addSearchResults, SearchResultType} from "qwc2/actions/search";
7474
import CoordinatesUtils from 'qwc2/utils/CoordinatesUtils';
75+
import LocaleUtils from 'qwc2/utils/LocaleUtils';
7576

7677
function coordinatesSearch(text, requestId, searchOptions, dispatch) {
7778
const displaycrs = searchOptions.displaycrs || "EPSG:4326";
@@ -239,7 +240,7 @@ function nominatimSearchResults(obj, requestId) {
239240
groups[entry.class] = {
240241
id: "nominatimgroup" + (groupcounter++),
241242
// capitalize class
242-
title: entry.class.charAt(0).toUpperCase() + entry.class.slice(1),
243+
title: LocaleUtils.trWithFallback("search.nominatim." + entry.class, entry.class.charAt(0).toUpperCase() + entry.class.slice(1)),
243244
items: []
244245
};
245246
results.push(groups[entry.class]);
@@ -290,11 +291,12 @@ function nominatimSearchResults(obj, requestId) {
290291

291292
function nominatimSearch(text, requestId, searchOptions, dispatch) {
292293
axios.get("//nominatim.openstreetmap.org/search", {params: {
293-
q: text,
294-
addressdetails: 1,
295-
polygon_geojson: 1,
296-
limit: 20,
297-
format: 'json'
294+
'q': text,
295+
'addressdetails': 1,
296+
'polygon_geojson': 1,
297+
'limit': 20,
298+
'format': 'json',
299+
'accept-language': LocaleUtils.lang()
298300
}}).then(response => dispatch(nominatimSearchResults(response.data, requestId)));
299301
}
300302

static/translations/cs-CZ.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "",
30+
"nominatim": {
31+
"amenity": "",
32+
"boundary": "",
33+
"building": "",
34+
"landuse": "",
35+
"leisure": "",
36+
"place": "",
37+
"highway": "",
38+
"natural": "",
39+
"railway": "",
40+
"tourism": ""
41+
},
3042
"all": "Vše",
3143
"enablelayer": "",
3244
"existinglayer": "",

static/translations/de-CH.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "",
30+
"nominatim": {
31+
"amenity": "Annehmlichkeit",
32+
"boundary": "Grenze",
33+
"building": "Gebäude",
34+
"landuse": "Landnutzung",
35+
"leisure": "Freizeit",
36+
"place": "Ort",
37+
"highway": "Autobahn",
38+
"natural": "Natur",
39+
"railway": "Eisenbahn",
40+
"tourism": "Tourismus"
41+
},
3042
"all": "Alle",
3143
"enablelayer": "Ebene einschalten",
3244
"existinglayer": "Die Ebene existiert bereits in der Karte",

static/translations/de-DE.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "Koordinaten",
30+
"nominatim": {
31+
"amenity": "Annehmlichkeit",
32+
"boundary": "Grenze",
33+
"building": "Gebäude",
34+
"landuse": "Landnutzung",
35+
"leisure": "Freizeit",
36+
"place": "Ort",
37+
"highway": "Autobahn",
38+
"natural": "Natur",
39+
"railway": "Eisenbahn",
40+
"tourism": "Tourismus"
41+
},
3042
"all": "Alle",
3143
"enablelayer": "Ebene einschalten",
3244
"existinglayer": "Die Ebene existiert bereits in der Karte",

static/translations/en-US.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "Coordinates",
30+
"nominatim": {
31+
"amenity": "Amenity",
32+
"boundary": "Boundary",
33+
"building": "Building",
34+
"landuse": "Land use",
35+
"leisure": "Leisure",
36+
"place": "Place",
37+
"highway": "Highway",
38+
"natural": "Natural",
39+
"railway": "Railway",
40+
"tourism": "Tourism"
41+
},
3042
"all": "All",
3143
"enablelayer": "Enable layer",
3244
"existinglayer": "The layer already exists in the map",

static/translations/es-ES.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "",
30+
"nominatim": {
31+
"amenity": "",
32+
"boundary": "",
33+
"building": "",
34+
"landuse": "",
35+
"leisure": "",
36+
"place": "",
37+
"highway": "",
38+
"natural": "",
39+
"railway": "",
40+
"tourism": ""
41+
},
3042
"all": "Todo",
3143
"enablelayer": "Habilitar capa",
3244
"existinglayer": "La capa ya existe en el mapa",

static/translations/fr-FR.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "Coordonnées",
30+
"nominatim": {
31+
"amenity": "",
32+
"boundary": "",
33+
"building": "",
34+
"landuse": "",
35+
"leisure": "",
36+
"place": "",
37+
"highway": "",
38+
"natural": "",
39+
"railway": "",
40+
"tourism": ""
41+
},
3042
"all": "Tous",
3143
"enablelayer": "Activer la couche",
3244
"existinglayer": "La couche existe déjà dans la carte",

static/translations/it-IT.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "Coordinate",
30+
"nominatim": {
31+
"amenity": "Amenità",
32+
"boundary": "Confine",
33+
"building": "Costruzione",
34+
"landuse": "Utilizzo terreno",
35+
"leisure": "Svago",
36+
"place": "Località",
37+
"highway": "Autostrata",
38+
"natural": "Natura",
39+
"railway": "Ferrovia",
40+
"tourism": "Turismo"
41+
},
3042
"all": "Tutti",
3143
"enablelayer": "Attivare il livello",
3244
"existinglayer": "Il livello esiste già nella mappa",

static/translations/pl-PL.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "",
30+
"nominatim": {
31+
"amenity": "",
32+
"boundary": "",
33+
"building": "",
34+
"landuse": "",
35+
"leisure": "",
36+
"place": "",
37+
"highway": "",
38+
"natural": "",
39+
"railway": "",
40+
"tourism": ""
41+
},
3042
"all": "Wszystko",
3143
"enablelayer": "Włącz warstwę",
3244
"existinglayer": "",

static/translations/pt-BR.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "",
30+
"nominatim": {
31+
"amenity": "",
32+
"boundary": "",
33+
"building": "",
34+
"landuse": "",
35+
"leisure": "",
36+
"place": "",
37+
"highway": "",
38+
"natural": "",
39+
"railway": "",
40+
"tourism": ""
41+
},
3042
"all": "Todos",
3143
"enablelayer": "Ativar a camada",
3244
"existinglayer": "A camada já existe no mapa",

static/translations/pt-PT.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "",
30+
"nominatim": {
31+
"amenity": "",
32+
"boundary": "",
33+
"building": "",
34+
"landuse": "",
35+
"leisure": "",
36+
"place": "",
37+
"highway": "",
38+
"natural": "",
39+
"railway": "",
40+
"tourism": ""
41+
},
3042
"all": "Todos",
3143
"enablelayer": "Ativar a camada",
3244
"existinglayer": "A camada já existe no mapa",

static/translations/ro-RO.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "Coordonate",
30+
"nominatim": {
31+
"amenity": "",
32+
"boundary": "",
33+
"building": "",
34+
"landuse": "",
35+
"leisure": "",
36+
"place": "",
37+
"highway": "",
38+
"natural": "",
39+
"railway": "",
40+
"tourism": ""
41+
},
3042
"all": "Toate",
3143
"enablelayer": "Activare strat",
3244
"existinglayer": "Strat existent",

static/translations/ru-RU.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "",
30+
"nominatim": {
31+
"amenity": "",
32+
"boundary": "",
33+
"building": "",
34+
"landuse": "",
35+
"leisure": "",
36+
"place": "",
37+
"highway": "",
38+
"natural": "",
39+
"railway": "",
40+
"tourism": ""
41+
},
3042
"all": "Всё",
3143
"enablelayer": "",
3244
"existinglayer": "",

static/translations/sv-SE.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "Koordinater",
30+
"nominatim": {
31+
"amenity": "",
32+
"boundary": "",
33+
"building": "",
34+
"landuse": "",
35+
"leisure": "",
36+
"place": "",
37+
"highway": "",
38+
"natural": "",
39+
"railway": "",
40+
"tourism": ""
41+
},
3042
"all": "",
3143
"enablelayer": "",
3244
"existinglayer": "",

static/translations/tr-TR.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
},
2828
"search": {
2929
"coordinates": "",
30+
"nominatim": {
31+
"amenity": "",
32+
"boundary": "",
33+
"building": "",
34+
"landuse": "",
35+
"leisure": "",
36+
"place": "",
37+
"highway": "",
38+
"natural": "",
39+
"railway": "",
40+
"tourism": ""
41+
},
3042
"all": "Tümü",
3143
"enablelayer": "Geçerli katman",
3244
"existinglayer": "Katman zaten haritada mevcut",

static/translations/tsconfig.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@
1717
],
1818
"extra_strings": [
1919
"appmenu.items.ExternalLink",
20-
"search.coordinates"
20+
"search.coordinates",
21+
"search.nominatim.amenity",
22+
"search.nominatim.boundary",
23+
"search.nominatim.building",
24+
"search.nominatim.landuse",
25+
"search.nominatim.leisure",
26+
"search.nominatim.place",
27+
"search.nominatim.highway",
28+
"search.nominatim.natural",
29+
"search.nominatim.railway",
30+
"search.nominatim.tourism"
2131
],
2232
"overrides": [
2333
"bottombar.viewertitle_label"

0 commit comments

Comments
 (0)