templates/vitrine/lexend/components/pages/languages.html.twig line 1

Open in your IDE?
  1. {% set available_locales = app_locales|split('|') %}
  2. {% if page is not empty %}
  3.     {% set current_locale = app.request.locale %}
  4.     {% set current_language_name = language_names[current_locale] | default(current_locale|upper) %}
  5.     <li class="d-inline-block">
  6.         <a href="#" class="hstack gap-1 text-none fw-medium" role="button" aria-haspopup="true" aria-expanded="false">
  7.             <i class="icon icon-1 unicon-wikis"></i>
  8.             <span>{{ current_language_name }}</span>
  9.         </a>
  10.         <div class="w-200px py-1 bg-white dark:bg-gray-700 shadow-xs rounded-2"
  11.              data-uc-drop="mode: click; offset: 0; pos: top-right; boundary: !.uc-navbar-container; animation: uc-animation-slide-top-small; duration: 150;">
  12.             <ul class="nav-y gap-0 fs-7">
  13.                 {% for locale in available_locales %}
  14.                     {% set locale_path = getPathPageHasLanguages(page.id, locale) %}
  15.                     {% set locale_name = language_names[locale] | default(locale|upper) %}
  16.                     {% set is_current = locale == current_locale %}
  17.                     {% set has_path = locale_path and locale_path != "#" and locale_path is not empty %}
  18.                     <li>
  19.                         {% if has_path %}
  20.                             <a href="{{ locale_path }}"
  21.                                class="w-100 p-1 px-2 hover:bg-gray-600 hover:bg-opacity-5 dark:hover:bg-white duration-150"
  22.                                {% if not is_current %}hreflang="{{ locale }}"{% endif %}>
  23.                                 <img class="w-20px rounded-1 me-1 rtl:me-0 rtl:ms-1" src="/assets/lexend/images/common/{{ locale }}.svg" alt="{{ locale_name }}" />
  24.                                 {{ locale_name }}
  25.                             </a>
  26.                         {% else %}
  27.                             <span class="w-100 p-1 px-2 text-gray-400 dark:text-gray-500">
  28.                                 <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 }}" />
  29.                                 {{ locale_name }}
  30.                             </span>
  31.                         {% endif %}
  32.                     </li>
  33.                 {% endfor %}
  34.             </ul>
  35.         </div>
  36.     </li>
  37. {% endif %}