templates/vitrine/components/footer_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-earth-filled"></i>
  8.             <span>{{ current_language_name }}</span>
  9.             <span data-uc-drop-parent-icon=""></span>
  10.         </a>
  11.         <div class="p-2 bg-white dark:bg-tertiary-600 shadow-xs rounded w-150px"
  12.              data-uc-drop="mode: click; offset: 16; pos: bottom-center; boundary: !.uc-navbar-container; animation: uc-animation-slide-top-small; duration: 150;">
  13.             <ul class="nav-y gap-1 fw-medium rtl:items-end">
  14.                 {% for locale in available_locales %}
  15.                     {% set locale_path = getPathPageHasLanguages(page.id, locale) %}
  16.                     {% set locale_name = language_names[locale] | default(locale|upper) %}
  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 }}"{% if locale != current_locale %} hreflang="{{ locale }}"{% endif %}>
  21.                                 {{ locale_name }}
  22.                             </a>
  23.                         {% else %}
  24.                             <span class="text-gray-400 dark:text-gray-500">{{ locale_name }}</span>
  25.                         {% endif %}
  26.                     </li>
  27.                 {% endfor %}
  28.             </ul>
  29.         </div>
  30.     </li>
  31. {% endif %}