{# shared bits of markup; import with {% from "_macros.html" import ... %} #} {% macro state_label(s) -%} {%- if s == 'running' -%}{{ _("running") }} {%- elif s == 'stopped' -%}{{ _("stopped") }} {%- elif s == 'reconnecting' -%}{{ _("reconnecting") }} {%- elif s == 'device-missing' -%}{{ _("device missing") }} {%- elif s == 'error' -%}{{ _("error") }} {%- else -%}{{ s }}{%- endif -%} {%- endmacro %} {% macro lang_switch(request, lang, here=none) -%} {#- back to this page: its path (without the base path) and query (the sign-in page's ?next=, the audit log's filters) - or `here`, the address that a page sent as the answer to a form names (the form's own URL may answer only POST) #} {%- set back = here or (route_path(request) ~ ('?' ~ request.url.query if request.url.query else '')) %} {%- for code, label in languages.items() -%} {{ code|upper }} {%- endfor -%} {%- endmacro %}