{#
/**
 * @file
 * Default theme implementation of the Straker Translate source status.
 *
 * Available variables:
 * - status: The attributes of the <source> tags for this <picture> tag.
 * - status_title: The controlling image, with the fallback image in srcset.
 * - language: The language.
 * - url: (optional) The url to link to.
 *
 * @see template_preprocess()
 * @see template_preprocess_straker_translate_source_status()
 *
 * @ingroup themeable
 */
#}
{% set text = language.name|default('English') %}
{% set attributes = create_attribute()
  .setAttribute('title', status_title)
  .addClass('language-icon')
  .addClass('source-' ~ status|lower) %}
{% set toggle_attributes = create_attribute()
  .addClass('language-icon')
  .addClass('straker_translate-source-dropdown-toggle')
  .addClass('source-' ~ status|lower) %}

{% if actions %}
<div class="straker_translate-source-dropdown">
{% endif %}
{% if url %}
  <a href="{{ url }}"{{ attributes }}>{{ text }}</a>
{% else %}
  <span{{ attributes }}>{{ text }}</span>
{% endif %}

{% if actions %}
<button {{ toggle_attributes }}><span class="visually-hidden">{% trans %}Toggle Actions{% endtrans %}</span></button>
<ul class="straker_translate-source-actions"{{ toggle_attributes }}>
  {% for action in actions %}
    <li>
      <a href="{{ action.url }}" {% if action.new_window %}target="_blank"{% endif %}>{{ action.title }}</a>
    </li>
  {% endfor %}
</ul>
</div>
{% endif %}
