{% set available_locales = app_locales|split('|') %}{% if page is not empty %} {% set current_locale = app.request.locale %} {% set current_language_name = language_names[current_locale] | default(current_locale|upper) %} <li class="d-inline-block"> <a href="#" class="hstack gap-1 text-none fw-medium" role="button" aria-haspopup="true" aria-expanded="false"> <i class="icon icon-1 unicon-wikis"></i> <span>{{ current_language_name }}</span> </a> <div class="w-200px py-1 bg-white dark:bg-gray-700 shadow-xs rounded-2" data-uc-drop="mode: click; offset: 0; pos: top-right; boundary: !.uc-navbar-container; animation: uc-animation-slide-top-small; duration: 150;"> <ul class="nav-y gap-0 fs-7"> {% for locale in available_locales %} {% set locale_path = getPathPageHasLanguages(page.id, locale) %} {% set locale_name = language_names[locale] | default(locale|upper) %} {% set is_current = locale == current_locale %} {% set has_path = locale_path and locale_path != "#" and locale_path is not empty %} <li> {% if has_path %} <a href="{{ locale_path }}" class="w-100 p-1 px-2 hover:bg-gray-600 hover:bg-opacity-5 dark:hover:bg-white duration-150" {% if not is_current %}hreflang="{{ locale }}"{% endif %}> <img class="w-20px rounded-1 me-1 rtl:me-0 rtl:ms-1" src="/assets/lexend/images/common/{{ locale }}.svg" alt="{{ locale_name }}" /> {{ locale_name }} </a> {% else %} <span class="w-100 p-1 px-2 text-gray-400 dark:text-gray-500"> <img class="w-20px rounded-1 me-1 rtl:me-0 rtl:ms-1 opacity-50" src="/assets/lexend/images/common/{{ locale }}.svg" alt="{{ locale_name }}" /> {{ locale_name }} </span> {% endif %} </li> {% endfor %} </ul> </div> </li>{% endif %}