podcast-webseite/templates/macros/translator.j2

15 lines
465 B
Text
Raw Normal View History

2019-12-02 09:28:57 +01:00
{#- text -> key in databag,
bag_name -> name of databag,
language -> language to translate to,
fallback -> fallback language when translation is not available
#}
{%- macro translator(text, bag_name, language, fallback='de') %}
{%- if bag(bag_name, language, text) -%}
{{ bag(bag_name, language, text) }}
{%- elif bag(bag_name, fallback, text) -%}
{{ bag(bag_name, fallback, text) }}
{%- else -%}
{{ text }}
{%- endif %}
{%- endmacro %}