From f79c0720efcef411b92c6186db15c6c2015201a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 29 Jun 2017 20:51:28 +0200 Subject: [PATCH] twig function tagTransList: translate lists of values (e.g. cuisine=kebab;pizza) --- gastro.json | 2 +- shop.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gastro.json b/gastro.json index 9536c99..a5f1c29 100644 --- a/gastro.json +++ b/gastro.json @@ -5,7 +5,7 @@ "minZoom": 16, "feature": { "markerSign": "{% if tags.amenity=='bar' %}🍸{% elseif tags.amenity=='biergarten'%}🍻{% elseif tags.amenity=='cafe' %}☕{% elseif tags.amenity=='fast_food' %}🍔{% elseif tags.amenity=='ice_cream' %}🍨{% elseif tags.amenity=='pub' %}🍺{% else %}🍴{% endif %}", - "body": "{{ tagTrans('amenity', tags.amenity) }}
{{ tagTrans('cuisine') }}: {{ tagTrans('cuisine', tags.cuisine)|default('unknown') }}", + "body": "{{ tagTrans('amenity', tags.amenity) }}
{{ tagTrans('cuisine') }}: {{ tagTransList('cuisine', tags.cuisine)|default('unknown') }}", "description": "{{ tagTrans('amenity', tags.amenity) }}" } } diff --git a/shop.json b/shop.json index 3cb03de..e714aa9 100644 --- a/shop.json +++ b/shop.json @@ -7,9 +7,9 @@ }, "minZoom": 14, "feature": { - "pre": "{% set current = const.default %}{% for v in const.shops %}{% if tags.shop in v.types %}{% set current = v %}{% endif %}{% endfor %}", - "body": "{{ tagTrans('shop', tags.shop) }}", - "description": "{{ tagTrans('shop', tags.shop) }}", + "pre": "{% set shop0 = tags.shop|split(';')[0] %}{% set current = const.default %}{% for v in const.shops %}{% if shop0 in v.types %}{% set current = v %}{% endif %}{% endfor %}", + "body": "{{ tagTransList('shop', tags.shop) }}", + "description": "{{ tagTransList('shop', tags.shop) }}", "markerSign": "{% set c = current.sign %}{% if c|slice(0, 3) == 'fa-' %}{% else %}{{ c|raw }}{% endif %}", "__": "need better icons for: bakery, butcher, cheese, ice_cream, ", "__": "no icons for: brewing_supplies, charity, second_hand, variety_store"