From da11d83b1a00a0b79be58160c1216f92d6f555ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 8 Mar 2018 07:50:38 +0100 Subject: [PATCH 01/13] Write reported non-translated strings to a SQLite db --- lib/modulekit/lang | 2 +- src/language.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/modulekit/lang b/lib/modulekit/lang index 80118dbc..832b12cc 160000 --- a/lib/modulekit/lang +++ b/lib/modulekit/lang @@ -1 +1 @@ -Subproject commit 80118dbcaafa9ab95298be95548126071efc069f +Subproject commit 832b12cc0d0ac674339e1ed722d2800ab0d8885b diff --git a/src/language.php b/src/language.php index 35852bf7..da93d2e7 100644 --- a/src/language.php +++ b/src/language.php @@ -4,3 +4,29 @@ register_hook('options_save', function ($options) { $_SESSION['ui_lang'] = $options['ui_lang']; } }); + +register_hook('lang_report_non_translated', function ($strings, $ui_lang) { + if (!is_writeable('data')) { + return; + } + + $db = new PDO('sqlite:data/lang.db'); + + $res = $db->query('select 1 from lang_non_translated'); + if (!$res) { + $query = <<query($query); + } + + foreach ($strings as $k => $count) { + $query = 'insert or replace into lang_non_translated values (' . $db->quote($k) . ', ' . $db->quote($ui_lang) . ', coalesce((select count + ' . $db->quote($count) . ' from lang_non_translated where str=' . $db->quote($k) . ' and lang=' . $db->quote($ui_lang) . '), ' . $db->quote($count) . '))'; + $db->query($query); + } +}); From eaa07fc44c078732834a4ffc598ae9dc52b4ffda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 8 Mar 2018 13:07:59 +0100 Subject: [PATCH 02/13] Language: update non translated values only when count>0 --- src/language.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/language.php b/src/language.php index da93d2e7..61995493 100644 --- a/src/language.php +++ b/src/language.php @@ -26,7 +26,9 @@ EOT; } foreach ($strings as $k => $count) { - $query = 'insert or replace into lang_non_translated values (' . $db->quote($k) . ', ' . $db->quote($ui_lang) . ', coalesce((select count + ' . $db->quote($count) . ' from lang_non_translated where str=' . $db->quote($k) . ' and lang=' . $db->quote($ui_lang) . '), ' . $db->quote($count) . '))'; - $db->query($query); + if ($count > 0) { + $query = 'insert or replace into lang_non_translated values (' . $db->quote($k) . ', ' . $db->quote($ui_lang) . ', coalesce((select count + ' . $db->quote($count) . ' from lang_non_translated where str=' . $db->quote($k) . ' and lang=' . $db->quote($ui_lang) . '), ' . $db->quote($count) . '))'; + $db->query($query); + } } }); From 7ce36bf23f9b087bd7e3b2b18d07c85f52e0b5b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sat, 10 Mar 2018 15:25:11 +0100 Subject: [PATCH 03/13] Found some strings which need to be translated - incl. translation for de, en --- lang/ast.json | 7 ++++++- lang/ca.json | 7 ++++++- lang/cs.json | 7 ++++++- lang/da.json | 7 ++++++- lang/de.json | 7 ++++++- lang/el.json | 7 ++++++- lang/en.json | 7 ++++++- lang/es.json | 7 ++++++- lang/et.json | 7 ++++++- lang/fr.json | 7 ++++++- lang/hu.json | 7 ++++++- lang/it.json | 7 ++++++- lang/ja.json | 7 ++++++- lang/nl.json | 7 ++++++- lang/pl.json | 7 ++++++- lang/pt-br.json | 7 ++++++- lang/ro.json | 7 ++++++- lang/ru.json | 7 ++++++- lang/sr.json | 7 ++++++- lang/template.json | 7 ++++++- lang/uk.json | 7 ++++++- src/CategoryOverpass.js | 6 +++--- src/index.js | 6 +++--- 23 files changed, 132 insertions(+), 27 deletions(-) diff --git a/lang/ast.json b/lang/ast.json index fc4cd28b..4ca40ef9 100644 --- a/lang/ast.json +++ b/lang/ast.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Opciones", "more": "más", "more_categories": "Más categoríes", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "ensin nome", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/ca.json b/lang/ca.json index e9162f62..aea8c0ec 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Opcions", "more": "més", "more_categories": "Més categories", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/cs.json b/lang/cs.json index dbebdfa7..b2960b3a 100644 --- a/lang/cs.json +++ b/lang/cs.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Nastavení", "more": "více", "more_categories": "Více kategorií", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "nepojmenováno", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/da.json b/lang/da.json index e1126f46..887da9a0 100644 --- a/lang/da.json +++ b/lang/da.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Indstillinger", "more": "mere", "more_categories": "Flere kategorier", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "unavngivet", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/de.json b/lang/de.json index 91cebd1b..a6f66402 100644 --- a/lang/de.json +++ b/lang/de.json @@ -8,7 +8,10 @@ "!=1": "Fehler" }, "facilities": "Einrichtungen", + "header:attributes": "Attribute", + "header:osm_meta": "OSM Meta", "images": "Bilder", + "loading": "Laden ...", "main:options": "Optionen", "more": "mehr", "more_categories": "Mehr Kategorien", @@ -26,5 +29,7 @@ "toggle_fullscreen": "(De-)aktiviere Vollbildmodus", "unknown": "unbekannt", "unnamed": "Namenlos", - "wikipedia:no-url-parse": "Konnte Wikipedia Adresse nicht erkennen" + "wikipedia:no-url-parse": "Konnte Wikipedia Adresse nicht erkennen", + "zoom_in_appear": "Zoome hinein um Kartenobjekte zu sehen", + "zoom_in_more": "Zoome hinein für weitere Kartenobjekte" } diff --git a/lang/el.json b/lang/el.json index aec2a1a8..b871e0c4 100644 --- a/lang/el.json +++ b/lang/el.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Επιλογές", "more": "περισσότερα", "more_categories": "Περισσότερες κατηγορίες", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "ανώνυμο", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/en.json b/lang/en.json index ec56263b..483601d2 100644 --- a/lang/en.json +++ b/lang/en.json @@ -8,7 +8,10 @@ "!=1": "Errors" }, "facilities": "Facilities", + "header:attributes": "Attributes", + "header:osm_meta": "OSM Meta", "images": "Images", + "loading": "Loading ...", "main:options": "Options", "more": "more", "more_categories": "More categories", @@ -26,5 +29,7 @@ "toggle_fullscreen": "Toggle full screen mode", "unknown": "unknown", "unnamed": "unnamed", - "wikipedia:no-url-parse": "Could not parse Wikipedia URL" + "wikipedia:no-url-parse": "Could not parse Wikipedia URL", + "zoom_in_appear": "zoom in for map features to appear", + "zoom_in_more": "zoom in for more map features" } diff --git a/lang/es.json b/lang/es.json index 79933900..d909c601 100644 --- a/lang/es.json +++ b/lang/es.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Opciones", "more": "más", "more_categories": "Más categorías", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/et.json b/lang/et.json index 4082cbf9..c512322d 100644 --- a/lang/et.json +++ b/lang/et.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Valikud", "more": "lisaks", "more_categories": "Rohkem kategooriaid", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "nimeta", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/fr.json b/lang/fr.json index 73d585be..bd8ca8c4 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Options", "more": "plus", "more_categories": "Plus de catégories", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "Inconnue", "unnamed": "sans nom", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/hu.json b/lang/hu.json index 975b0c96..5a40fc19 100644 --- a/lang/hu.json +++ b/lang/hu.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Beállítások", "more": "több", "more_categories": "Több kategória", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/it.json b/lang/it.json index eb8f9116..f12357d1 100644 --- a/lang/it.json +++ b/lang/it.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Opzioni", "more": "altri", "more_categories": "Altre categorie", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "privo di nome", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/ja.json b/lang/ja.json index e59c190b..673916b9 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "オプション設定", "more": "もっと", "more_categories": "カテゴリを一覧から追加", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "nameなし", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/nl.json b/lang/nl.json index 856320fd..2b24c2b1 100644 --- a/lang/nl.json +++ b/lang/nl.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Opties", "more": "meer", "more_categories": "Meer categorieën", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "naamloos", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/pl.json b/lang/pl.json index af06944c..102167c3 100644 --- a/lang/pl.json +++ b/lang/pl.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Opcje", "more": "więcej", "more_categories": "Więcej kategorii", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "nienazwane", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/pt-br.json b/lang/pt-br.json index ed9ab5dc..4de7d89b 100644 --- a/lang/pt-br.json +++ b/lang/pt-br.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "", "more": "mais", "more_categories": "", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "sem nome", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/ro.json b/lang/ro.json index 69130b02..379045bf 100644 --- a/lang/ro.json +++ b/lang/ro.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Optiuni", "more": "Mai mult", "more_categories": "Mai multe categorii", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "anonim", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/ru.json b/lang/ru.json index 55358747..6975b404 100644 --- a/lang/ru.json +++ b/lang/ru.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Настройки", "more": "Ещё", "more_categories": "Больше категорий", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "безымянный", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/sr.json b/lang/sr.json index 7004a800..0b6086bc 100644 --- a/lang/sr.json +++ b/lang/sr.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Опције", "more": "још", "more_categories": "Више категорија", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "без имена", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/template.json b/lang/template.json index 69c8559c..5fed86ae 100644 --- a/lang/template.json +++ b/lang/template.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "", "more": "", "more_categories": "", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/lang/uk.json b/lang/uk.json index a697ae44..b84f6266 100644 --- a/lang/uk.json +++ b/lang/uk.json @@ -5,7 +5,10 @@ "default": "", "error": "", "facilities": "", + "header:attributes": "", + "header:osm_meta": "", "images": "", + "loading": "", "main:options": "Налаштування", "more": "Ще", "more_categories": "Більше категорій", @@ -23,5 +26,7 @@ "toggle_fullscreen": "", "unknown": "", "unnamed": "безіменний", - "wikipedia:no-url-parse": "" + "wikipedia:no-url-parse": "", + "zoom_in_appear": "", + "zoom_in_more": "" } diff --git a/src/CategoryOverpass.js b/src/CategoryOverpass.js index da0305ec..0aed8710 100644 --- a/src/CategoryOverpass.js +++ b/src/CategoryOverpass.js @@ -128,7 +128,7 @@ function CategoryOverpass (options, data) { p = document.createElement('div') p.className = 'loadingIndicator' - p.innerHTML = 'Loading...' + p.innerHTML = '' + lang('loading') + '' this.dom.appendChild(p) p = document.createElement('div') @@ -223,12 +223,12 @@ CategoryOverpass.prototype.updateStatus = function () { if (typeof this.data.query === 'object') { var highestZoom = Object.keys(this.data.query).reverse()[0] if (this.map.getZoom() < highestZoom) { - this.domStatus.innerHTML = 'zoom in for more map features' + this.domStatus.innerHTML = lang('zoom_in_more') } } if ('minZoom' in this.data && this.map.getZoom() < this.data.minZoom) { - this.domStatus.innerHTML = 'zoom in for map features to appear' + this.domStatus.innerHTML = lang('zoom_in_appear') } } diff --git a/src/index.js b/src/index.js index 4af743c2..bee2ceb1 100644 --- a/src/index.js +++ b/src/index.js @@ -186,7 +186,7 @@ function show (id, options, callback) { if (options.showDetails) { call_hooks('hide-' + document.getElementById('content').className) document.getElementById('content').className = 'details' - document.getElementById('contentDetails').innerHTML = 'Loading ...' + document.getElementById('contentDetails').innerHTML = lang('loading') } var m = id.match(/^(.*)\/([nwr]\d+)(\/details)?$/) @@ -269,7 +269,7 @@ window.showDetails = function (data, category) { ) h = document.createElement('h3') - h.innerHTML = 'Attributes' + h.innerHTML = lang('header:attributes') dom.appendChild(h) div = document.createElement('dl') @@ -286,7 +286,7 @@ window.showDetails = function (data, category) { dom.appendChild(div) h = document.createElement('h3') - h.innerHTML = 'OSM Meta' + h.innerHTML = lang('header:osm_meta') dom.appendChild(h) div = document.createElement('dl') From dbd27e19fbd659ba55d94d7d04308e0507e4707b Mon Sep 17 00:00:00 2001 From: Igor Eliezer Date: Thu, 29 Mar 2018 18:20:17 -0300 Subject: [PATCH 04/13] Update pt-br.json --- lang/pt-br.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lang/pt-br.json b/lang/pt-br.json index 98ba97c2..81b4659f 100644 --- a/lang/pt-br.json +++ b/lang/pt-br.json @@ -3,15 +3,16 @@ "category-info-tooltip": "Info & Legenda", "closed": "fechado", "default": "padrão", + "edit": "editar", "error": { "message": "Erro", "!=1": "Erros" }, "facilities": "Instalações", + "header:attributes": "Atributos", + "header:osm_meta": "OSM Meta", "images": "Imagens", - "header:attributes": "", - "header:osm_meta": "", - "loading": "", + "loading": "Carregando...", "main:options": "Opções", "more": "mais", "more_categories": "Mais categorias", @@ -30,6 +31,6 @@ "unknown": "desconhecido", "unnamed": "sem nome", "wikipedia:no-url-parse": "Não se pôde analisar URL da Wikipédia", - "zoom_in_appear": "", - "zoom_in_more": "" + "zoom_in_appear": "aproxime para elementos do mapa aparecer", + "zoom_in_more": "aproxime para mais elementos do mapa" } From a04ebaf15efeeff063f0b666d1ffdd9d3b3866bf Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Fri, 30 Mar 2018 18:57:02 +0100 Subject: [PATCH 05/13] pt.json: update to match pt-br.json - add new "edit" key - move "images" key to be in alphabetical order - add translation for "header:osm_meta" key --- lang/pt.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lang/pt.json b/lang/pt.json index 52e7982f..7c1edd92 100644 --- a/lang/pt.json +++ b/lang/pt.json @@ -3,14 +3,15 @@ "category-info-tooltip": "Info & Legenda", "closed": "fechado", "default": "padrão", + "edit": "editar", "error": { "message": "Erro", "!=1": "Erros" }, "facilities": "Instalações", - "images": "Imagens", "header:attributes": "Atributos", - "header:osm_meta": "", + "header:osm_meta": "OSM Meta", + "images": "Imagens", "loading": "A carregar...", "main:options": "Opções", "more": "mais", From 713b3e1084ba62369f1bfbf4dcdfcc765bb3d1ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sun, 1 Apr 2018 20:33:21 +0200 Subject: [PATCH 06/13] wikipedia: fix loading wikidata info --- src/wikipedia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wikipedia.js b/src/wikipedia.js index 7ed479b5..0053b5c7 100644 --- a/src/wikipedia.js +++ b/src/wikipedia.js @@ -168,7 +168,7 @@ register_hook('show-details', function (data, category, dom, callback) { found++ foundPrefixes.push('') - wikidata.load(ob.tags[k], function (err, result) { + wikidata.load(ob.tags.wikidata, function (err, result) { var x if (err) { From 7a881c1094a75343f4724618163381c9f39381ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sun, 1 Apr 2018 20:38:06 +0200 Subject: [PATCH 07/13] ImageLoader: bugfix wikimedia_commons tags --- src/ImageLoader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ImageLoader.js b/src/ImageLoader.js index d4634092..0a0db229 100644 --- a/src/ImageLoader.js +++ b/src/ImageLoader.js @@ -109,7 +109,7 @@ ImageLoader.prototype.loadWikimediaCommons = function (src, callback) { if (this.found.indexOf(d.id) === -1) { this.found.push(d.id) d.type = 'wikimedia' - this.data[id] = d + this.data[d.id] = d } }.bind(this)) } From a8eefdb81d18afbb1087da30592895a736b73bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Mon, 23 Apr 2018 21:17:37 +0200 Subject: [PATCH 08/13] Add a measurement control --- index.php | 2 ++ package.json | 1 + src/index.js | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/index.php b/index.php index 74cd756b..fefcff84 100644 --- a/index.php +++ b/index.php @@ -42,10 +42,12 @@ html_export_var(array( + + diff --git a/package.json b/package.json index 4fdec0b1..51cc2fdd 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "leaflet-polylineoffset": "^1.1.0", "leaflet-textpath": "https://github.com/makinacorpus/Leaflet.TextPath#leaflet0.8-dev", "leaflet.locatecontrol": "^0.61.0", + "leaflet.polylinemeasure": "https://github.com/ppete2/Leaflet.PolylineMeasure.git", "modulekit-tabs": "^0.1.0", "moment": "^2.18.1", "opening_hours": "^3.5.0", diff --git a/src/index.js b/src/index.js index bee2ceb1..c1056d2f 100644 --- a/src/index.js +++ b/src/index.js @@ -52,6 +52,12 @@ window.onload = function () { } function onload2 (initState) { + // Measurement plugin + if (L.control.polylineMeasure) { + L.control.polylineMeasure({ + }).addTo(map); + } + // Add Geo Search var provider = new LeafletGeoSearch.OpenStreetMapProvider() var searchControl = new LeafletGeoSearch.GeoSearchControl({ From 2cf3cf14f5bca3a772b276064eaf0bec6f0c2c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 7 Jun 2018 09:00:07 +0200 Subject: [PATCH 09/13] CategoryOverpass: adapt to overpass-layer v1.0.1 --- package.json | 2 +- src/CategoryOverpass.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 51cc2fdd..fb08b677 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "openstreetbrowser-categories-main": "https://github.com/plepe/openstreetbrowser-categories-main", "openstreetmap-date-parser": "^0.1.0", "openstreetmap-tag-translations": "https://github.com/plepe/openstreetmap-tag-translations", - "overpass-layer": "https://github.com/plepe/overpass-layer", + "overpass-layer": "^1.0.1", "query-string": "^5.0.0", "sheet-router": "^4.2.3", "weight-sort": "^1.3.0" diff --git a/src/CategoryOverpass.js b/src/CategoryOverpass.js index 42fe1165..1a42ed6b 100644 --- a/src/CategoryOverpass.js +++ b/src/CategoryOverpass.js @@ -260,7 +260,8 @@ CategoryOverpass.prototype.open = function () { this.layer.addTo(this.map) if (!this.list) { - this.list = new OverpassLayerList(this.domContent, this.layer) + this.list = new OverpassLayerList(this.layer) + this.list.addTo(this.domContent) this.origGetMarker = this.list._getMarker this.list._getMarker = this._getMarker.bind(this) } From aa680785f8674913feaeb505486fac6ea62d946e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Fri, 8 Jun 2018 07:40:28 +0200 Subject: [PATCH 10/13] Export: download as GeoJSON (on details page) --- lang/ast.json | 3 +++ lang/ca.json | 3 +++ lang/cs.json | 3 +++ lang/da.json | 3 +++ lang/de.json | 2 ++ lang/el.json | 3 +++ lang/en.json | 2 ++ lang/es.json | 3 +++ lang/et.json | 3 +++ lang/fr.json | 3 +++ lang/hu.json | 3 +++ lang/it.json | 3 +++ lang/ja.json | 3 +++ lang/nl.json | 3 +++ lang/pl.json | 3 +++ lang/pt-br.json | 2 ++ lang/pt.json | 2 ++ lang/ro.json | 3 +++ lang/ru.json | 3 +++ lang/sr.json | 3 +++ lang/template.json | 3 +++ lang/uk.json | 3 +++ src/index.js | 18 +++++++++++++++++- 23 files changed, 79 insertions(+), 1 deletion(-) diff --git a/lang/ast.json b/lang/ast.json index 4ca40ef9..6792c3f9 100644 --- a/lang/ast.json +++ b/lang/ast.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/ca.json b/lang/ca.json index aea8c0ec..92fbcbad 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/cs.json b/lang/cs.json index b2960b3a..6a00b20d 100644 --- a/lang/cs.json +++ b/lang/cs.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/da.json b/lang/da.json index 887da9a0..246c041a 100644 --- a/lang/da.json +++ b/lang/da.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/de.json b/lang/de.json index 5b9d4659..36a8c64e 100644 --- a/lang/de.json +++ b/lang/de.json @@ -3,6 +3,7 @@ "category-info-tooltip": "Info & Legende", "closed": "geschlossen", "default": "Standard", + "download:geojson": "Als GeoJSON runterladen", "edit": "bearbeiten", "error": { "message": "Fehler", @@ -10,6 +11,7 @@ }, "facilities": "Einrichtungen", "header:attributes": "Attribute", + "header:export": "Export", "header:osm_meta": "OSM Meta", "images": "Bilder", "loading": "Laden ...", diff --git a/lang/el.json b/lang/el.json index b871e0c4..92acb3fc 100644 --- a/lang/el.json +++ b/lang/el.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/en.json b/lang/en.json index 56ac93ae..62a959c0 100644 --- a/lang/en.json +++ b/lang/en.json @@ -3,6 +3,7 @@ "category-info-tooltip": "Info & Map key", "closed": "closed", "default": "default", + "download:geojson": "Download as GeoJSON", "edit": "edit", "error": { "message": "Error", @@ -10,6 +11,7 @@ }, "facilities": "Facilities", "header:attributes": "Attributes", + "header:export": "Export", "header:osm_meta": "OSM Meta", "images": "Images", "loading": "Loading ...", diff --git a/lang/es.json b/lang/es.json index d909c601..62837550 100644 --- a/lang/es.json +++ b/lang/es.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/et.json b/lang/et.json index c512322d..9e346130 100644 --- a/lang/et.json +++ b/lang/et.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/fr.json b/lang/fr.json index 7db585e8..36c096dc 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -3,9 +3,12 @@ "category-info-tooltip": "Info & Légende", "closed": "Fermé", "default": "Par défaut", + "download:geojson": "", + "edit": "", "error": "Erreur", "facilities": "Aménagements", "header:attributes": "Attributs", + "header:export": "", "header:osm_meta": "Métadonnées OSM", "images": "Images", "loading": "Chargement...", diff --git a/lang/hu.json b/lang/hu.json index 5a40fc19..68765c34 100644 --- a/lang/hu.json +++ b/lang/hu.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/it.json b/lang/it.json index f12357d1..caa1f358 100644 --- a/lang/it.json +++ b/lang/it.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/ja.json b/lang/ja.json index 673916b9..d1d9466f 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/nl.json b/lang/nl.json index 2b24c2b1..0c555511 100644 --- a/lang/nl.json +++ b/lang/nl.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/pl.json b/lang/pl.json index 102167c3..2dbff807 100644 --- a/lang/pl.json +++ b/lang/pl.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/pt-br.json b/lang/pt-br.json index 81b4659f..a465f89c 100644 --- a/lang/pt-br.json +++ b/lang/pt-br.json @@ -3,6 +3,7 @@ "category-info-tooltip": "Info & Legenda", "closed": "fechado", "default": "padrão", + "download:geojson": "", "edit": "editar", "error": { "message": "Erro", @@ -10,6 +11,7 @@ }, "facilities": "Instalações", "header:attributes": "Atributos", + "header:export": "", "header:osm_meta": "OSM Meta", "images": "Imagens", "loading": "Carregando...", diff --git a/lang/pt.json b/lang/pt.json index 7c1edd92..6209ffe5 100644 --- a/lang/pt.json +++ b/lang/pt.json @@ -3,6 +3,7 @@ "category-info-tooltip": "Info & Legenda", "closed": "fechado", "default": "padrão", + "download:geojson": "", "edit": "editar", "error": { "message": "Erro", @@ -10,6 +11,7 @@ }, "facilities": "Instalações", "header:attributes": "Atributos", + "header:export": "", "header:osm_meta": "OSM Meta", "images": "Imagens", "loading": "A carregar...", diff --git a/lang/ro.json b/lang/ro.json index 379045bf..393b5e82 100644 --- a/lang/ro.json +++ b/lang/ro.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/ru.json b/lang/ru.json index 6975b404..1c8389ad 100644 --- a/lang/ru.json +++ b/lang/ru.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/sr.json b/lang/sr.json index 0b6086bc..b53e0904 100644 --- a/lang/sr.json +++ b/lang/sr.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/template.json b/lang/template.json index 5fed86ae..09c4e48c 100644 --- a/lang/template.json +++ b/lang/template.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/lang/uk.json b/lang/uk.json index b84f6266..11018c7e 100644 --- a/lang/uk.json +++ b/lang/uk.json @@ -3,9 +3,12 @@ "category-info-tooltip": "", "closed": "", "default": "", + "download:geojson": "", + "edit": "", "error": "", "facilities": "", "header:attributes": "", + "header:export": "", "header:osm_meta": "", "images": "", "loading": "", diff --git a/src/index.js b/src/index.js index c1056d2f..b64148b0 100644 --- a/src/index.js +++ b/src/index.js @@ -237,7 +237,7 @@ function show (id, options, callback) { } window.showDetails = function (data, category) { - var div, h, dt, dd + var div, h, dt, dd, li, a var k var dom = document.getElementById('contentDetails') @@ -274,6 +274,22 @@ window.showDetails = function (data, category) { } ) + h = document.createElement('h3') + h.innerHTML = lang('header:export') + dom.appendChild(h) + + div = document.createElement('ul') + dom.appendChild(div) + + li = document.createElement('li') + div.appendChild(li) + + a = document.createElement('a') + a.download = data.id + '.json' + a.href = 'data:application/json;charset=UTF-8,' + encodeURIComponent(JSON.stringify(data.object.GeoJSON(), null, ' ')) + a.innerHTML = lang('download:geojson') + li.appendChild(a) + h = document.createElement('h3') h.innerHTML = lang('header:attributes') dom.appendChild(h) From 6714746fba53b3b1d370c54a6cf870c24ba5c2dc Mon Sep 17 00:00:00 2001 From: Cybereric Date: Sat, 9 Jun 2018 15:47:06 +0200 Subject: [PATCH 11/13] Update fr.json --- lang/fr.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lang/fr.json b/lang/fr.json index 36c096dc..2e9720c6 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -3,12 +3,12 @@ "category-info-tooltip": "Info & Légende", "closed": "Fermé", "default": "Par défaut", - "download:geojson": "", - "edit": "", + "download:geojson": "Télécharger comme GeoJSON", + "edit": "éditer", "error": "Erreur", "facilities": "Aménagements", "header:attributes": "Attributs", - "header:export": "", + "header:export": "Export", "header:osm_meta": "Métadonnées OSM", "images": "Images", "loading": "Chargement...", From bc3d095565d3002210d339540ee1aca9195faa5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 14 Jun 2018 06:51:40 +0200 Subject: [PATCH 12/13] tagTranslations: function isTranslated (also as twig function) --- src/tagTranslations.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tagTranslations.js b/src/tagTranslations.js index 39f08578..1840c3fd 100644 --- a/src/tagTranslations.js +++ b/src/tagTranslations.js @@ -20,6 +20,13 @@ OverpassLayer.twig.extendFunction('localizedTag', function (tags, id) { OverpassLayer.twig.extendFunction('trans', function () { return lang.apply(this, arguments) }) +OverpassLayer.twig.extendFunction('isTranslated', function (str) { + return tagTranslationsIsTranslated(str) +}) + +function tagTranslationsIsTranslated (str) { + return !(str in lang_non_translated) && (str in lang_str) +} function tagTranslationsTrans () { var tag = arguments[0] @@ -59,6 +66,7 @@ function tagTranslationsTransList (key, values) { module.exports = { trans: tagTranslationsTrans, + isTranslated: tagTranslationsIsTranslated, setTagLanguage: function (lang) { tagLang = lang } From a1ac33b5fc9ba7e1532fc8c14049d4061f90121b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 14 Jun 2018 09:15:57 +0200 Subject: [PATCH 13/13] Update submodules --- lib/modulekit/form | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modulekit/form b/lib/modulekit/form index 02fb3cba..464a0cbf 160000 --- a/lib/modulekit/form +++ b/lib/modulekit/form @@ -1 +1 @@ -Subproject commit 02fb3cbae52f78801d1c8ae131df4065e8b35ae0 +Subproject commit 464a0cbfab6acad402bc23e7f050bb01ca136b84