name:
en: Etymology
query: |
(
nwr["name:etymology"];
nwr["name:etymology:wikidata"];
)
feature:
description: |
{% set value = null %}
{% for tag in ['highway', 'railway', 'amenity', 'leisure', 'shop', 'man_made', 'landuse', 'natural', 'waterway', 'place', 'route', 'aeroway', 'aerialway', 'craft', 'office', 'military', 'building', 'barrier','geological','historic', 'power', 'tourism', 'boundary'] %}
{% if not value and tags[tag] %}
{% set value = attribute(tags, tag) %}
{% if value in ['yes'] %}
{{ keyTrans(tag) }}
{% else %}
{{ tagTransList(tag, value) }}
{% endif %}
{% endif %}
{% endfor %}
details: |
{% if not attribute(tags, "name:etymology") and attribute(tags, 'name:etymology:wikidata') %}
{% for i, wd in attribute(tags, 'name:etymology:wikidata')|split(';') %}
{%- if i != 0 %},{% endif %}
{% if wd %}
{% set wikidata = wd|wikidataEntity %}
{{ wikidata ? (wikidata.labels[user.data_lang]|default(wikidata.labels[user.ui_lang])|default(wikidata.labels.en)).value : wd }}
{% endif %}
{% endfor %}
{% else %}
{{ attribute(tags, "name:etymology")|enumerate }}
{% endif %}
body: |
{% if attribute(tags, "name:etymology") or attribute(tags, 'name:etymology:wikidata') %}
-
{{ keyTrans('name:etymology') }}:
{% set etymWikidata = attribute(tags, 'name:etymology:wikidata')|split(';') %}
{% set etymName = attribute(tags, 'name:etymology')|split(';') %}
{% set etymDesc = attribute(tags, 'name:etymology:description')|split(';') %}
{% set result = [] %}
{% for i in 0..max(etymName|length - 1, etymWikidata|length - 1) %}
{% set wikidata = etymWikidata[i]|wikidataEntity %}
{% set label = wikidata ? (wikidata.labels[user.data_lang]|default(wikidata.labels[user.ui_lang])|default(wikidata.labels.en)).value : etymName[i]|default(etymWikidata[i]) %}
{% set desc = wikidata ? (wikidata.descriptions[user.data_lang]|default(wikidata.descriptions[user.ui_lang])|default(wikidata.descriptions.en)).value|default(etymDesc) : etymDesc %}
{% set result = result|merge([ etymWikidata[i] ? '' ~ (etymName[i]|default(label))|e ~ '' ~ (desc ? ' (' ~ desc|e ~ ')' : '') : etymName[i]|e ~ (desc ? ' (' ~ desc|e ~ ')' : '') ]) %}
{% endfor %}
{{ result|enumerate|raw }}
{% endif %}
{% if attribute(tags, 'name:start_date') %}
-
{{ keyTrans('name:start_date') }}:
{{ attribute(tags, 'name:start_date')|osmFormatDate({ format: 'short' }) }}
{% endif %}