[gnome-maps/wip/mlundblad/localized-names-from-overpass] WIP: overpass: Use localized name tag when available...
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/localized-names-from-overpass] WIP: overpass: Use localized name tag when available...
- Date: Thu, 8 Oct 2020 21:30:28 +0000 (UTC)
commit 823394a82257faefe64ba70ba90e873cd6de7671
Author: Marcus Lundblad <ml update uu se>
Date: Thu Oct 8 23:29:17 2020 +0200
WIP: overpass: Use localized name tag when available...
src/overpass.js | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/overpass.js b/src/overpass.js
index af1ea389..a692d112 100644
--- a/src/overpass.js
+++ b/src/overpass.js
@@ -200,8 +200,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);
+ if (name)
+ place.name = name;
if (element.tags.population)
place.population = element.tags.population;
if (element.tags['contact:website'])
@@ -230,6 +231,18 @@ var Overpass = GObject.registerClass({
place.note = element.tags.note;
}
+ _getLocalizedName(tags) {
+ let language = Utils.getLanguage();
+
+ Utils.debug('tags: ' + JSON.stringify(tags, null, 2));
+ Utils.debug('language: ' + language);
+
+ if (tags['name:' + language])
+ return tags['name:' + language];
+ else
+ return tags.name;
+ }
+
_getQueryUrl(osmType, osmId) {
return Format.vprintf('%s?data=%s', [BASE_URL,
this._generateOverpassQuery(osmType,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]