{#
/**
 * @file
 * Default theme implementation of the Straker Translate target statuses.
 *
 * Available variables:
 *   - entity: The entity which status we want to display.
 *   - source_langcode: The language code.
 *   - statuses: The source statuses, keyed by language code. The keys are:
 *     - status: The status for that translation.
 *     - url: An optional \Drupal\Core\Url object.
 *     - new_window: A flag indicating if the link should be opened in a new window.
 *     - status_text: The status text, mainly though for link title.
 *     - language: The language code.
 *
 * @see template_preprocess()
 * @see template_preprocess_straker_translate_target_statuses()
 *
 * @ingroup themeable
 */
#}

<div class="straker_translate-target-statuses-wrapper">
{% for status in statuses %}
 <div class="target-language-wrapper">
  {% set text = status.language|upper %}
  {% set attributes = create_attribute()
    .setAttribute('title', status.status_text)
    .addClass('language-icon')
    .addClass('target-' ~ status.status|lower) %}
  {% set toggle_attributes = create_attribute()
    .addClass('language-icon')
    .addClass('straker_translate-target-dropdown-toggle')
    .addClass('target-' ~ status.status|lower) %}

  {% if status.actions %}
    <div class="straker_translate-target-dropdown">
  {% endif %}
  {% if status.url %}
    <a href="{{ status.url }}" {% if status.new_window %}target="_blank"{% endif %} {{ attributes }}>{{ text }}</a>
  {% else %}
    <span {{ attributes }}>{{ text }}</span>
  {% endif %}

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