summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@update.uu.se>2020-10-08 23:29:17 +0200
committerMarcus Lundblad <ml@update.uu.se>2020-11-26 22:04:06 +0100
commit48ba70e81e272288a31afd516ada564c428eeb6a (patch)
treed6843ba3ab30b95dd7cc2422d7b1634cb44abd0d
parent35f1fae01869e0a0da30d3981738a51b891a7791 (diff)
downloadgnome-maps-wip/mlundblad/localized-names-from-overpass.tar.gz
overpass: Use localized name tag when available...wip/mlundblad/localized-names-from-overpass
-rw-r--r--src/overpass.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/overpass.js b/src/overpass.js
index af1ea389..f97132b2 100644
--- a/src/overpass.js
+++ b/src/overpass.js
@@ -22,6 +22,7 @@ const Geocode = imports.gi.GeocodeGlib;
const GObject = imports.gi.GObject;
const Soup = imports.gi.Soup;
+const OSMNames = imports.osmNames;
const PhotonParser = imports.photonParser;
const Place = imports.place;
const Utils = imports.utils;
@@ -200,8 +201,9 @@ var Overpass = GObject.registerClass({
if (!(element && element.tags))
return;
- if (element.tags.name)
- place.name = element.tags.name;
+ let name = this._getLocalizedName(element.tags, place);
+ if (name)
+ place.name = name;
if (element.tags.population)
place.population = element.tags.population;
if (element.tags['contact:website'])
@@ -230,6 +232,13 @@ var Overpass = GObject.registerClass({
place.note = element.tags.note;
}
+ _getLocalizedName(tags, place) {
+ let language = Utils.getLanguage();
+
+ return OSMNames.getNameForLanguageAndCountry(tags, language,
+ place.country_code);
+ }
+
_getQueryUrl(osmType, osmId) {
return Format.vprintf('%s?data=%s', [BASE_URL,
this._generateOverpassQuery(osmType,