{#
/**
 * Copyright © 2003-2024 The Galette Team
 *
 * This file is part of Galette (https://galette.eu).
 *
 * Galette is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Galette is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
 */
#}
{% if ui is defined %}
    {% if ui == 'item'%}
        {% set component_classes = "tooltip language item" %}
        {% set content_classes = "content" %}
        {% set header = true %}
    {% elseif ui == 'dropdown' %}
        {% set component_classes = "tooltip language ui dropdown navigation right-aligned item" %}
        {% set content_classes = "menu" %}
        {% set header = false %}
    {% endif %}
{% endif %}

<div class="{{ component_classes }}{% if i18n.isRtl() %} rtl{% endif %}" title="{{ _T("Choose your language") }}">
{% if header == true %}
    <div class="image header title"{% if ui == 'item'%} data-fold="fold-language" tabindex="0"{% endif %}>
{% endif %}
        <i class="icon language" aria-hidden="true"></i>
        <span>{{ galette_lang }}</span>
        <i class="dropdown icon" aria-hidden="true"></i>
{% if header == true %}
    </div>
{% endif %}
    <div class="{{ content_classes }}">
{% for langue in languages %}
    {% if langue.getAbbrev() != galette_lang %}
        <a href="?ui_pref_lang={{ langue.getID() }}"
           title="{{ _T("Switch locale to '%locale'")|replace({"%locale": langue.getName()}) }}"
           class="item"
        >
            {{ langue.getName() }} <span>({{ langue.getAbbrev() }})</span>
        </a>
    {% endif %}
{% endfor %}
    </div>
</div>
