templates/vitrine/lexend/components/pages/languages_mobile.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.         {% for locale in available_locales %}
  5.             {% set locale_path = getPathPageHasLanguages(page.id, locale) %}
  6.             {% set locale_name = language_names[locale] | default(locale|upper) %}
  7.             {% set is_current = locale == current_locale %}
  8.             {% set has_path = locale_path and locale_path != "#" and locale_path is not empty %}
  9.             <li{% if is_current %} class="uc-active"{% endif %}>
  10.                 {% if has_path %}
  11.                     <a href="{{ locale_path }}"
  12.                        {% if is_current %}class="uc-active"{% endif %}
  13.                             {% if not is_current %}hreflang="{{ locale }}"{% endif %}>
  14.                         <img class="w-20px rounded-1 me-1" src="/assets/lexend/images/common/{{ locale }}.svg" alt="{{ locale_name }}" />
  15.                         {{ locale_name }}
  16.                     </a>
  17.                 {% else %}
  18.                     <span class="text-gray-400 dark:text-gray-500">
  19.                         <img class="w-20px rounded-1 me-1 opacity-50" src="/assets/lexend/images/common/{{ locale }}.svg" alt="{{ locale_name }}" />
  20.                         {{ locale_name }}
  21.                     </span>
  22.                 {% endif %}
  23.             </li>
  24.         {% endfor %}
  25.     {% endif %}