{% set localeData = aa_admin_locale_switches(entity|default(null)) %}
{% if localeData.locale_alternate_switches|default([])|length %}
  <div class="locale-switcher">
    <a class="dropdown-toggle"
       href="#"
       id="userDropdown"
       role="button"
       data-bs-toggle="dropdown"
       aria-haspopup="true"
       aria-expanded="false"
    >
      {% set cls = localeData.locale_current_switch %}
      <img class="locale-img"
           src="{{ cls.image }}"
           alt="{{ cls.locale.code|upper }}"
           loading="lazy"
      >
      <span class="text-gray-600">{{ cls.locale.code|upper }}</span>
      <span class="d-inline text-gray-600 small"><i class="fa fa-caret-circle-down"></i></span>
    </a>

    <div class="dropdown-menu dropdown-menu-right shadow" aria-labelledby="userDropdown">
      {% for ls in localeData.locale_alternate_switches|default([]) %}
        <a class="dropdown-item" href="{{ path('aa_admin_locale_switcher_switch', {newLocale: ls.locale.code}|merge(app.request.query)) }}">
          <img class="locale-img"
               src="{{ ls.image }}"
               alt="{{ ls.locale.code|upper }}"
               loading="lazy"
          >
          <span class="text-gray-600 mr-2">{{ ls.locale.code|upper }}</span>
        </a>
      {% endfor %}
    </div>
  </div>
{% endif %}