templates/vitrine/lexend/articles/components/languages_mobile.html.twig line 1

Open in your IDE?
  1. {% set nameR = app.request.attributes.get('_route') %}
  2. {% set nameR = nameR | replace({'locale_': ''}) %}
  3. {% set available_locales = app_locales|split('|') %}
  4. <li class="d-inline-block">
  5.     <a href="#" class="hstack gap-1 text-none fw-medium" role="button" aria-haspopup="true" aria-expanded="false">
  6.         <i class="icon icon-1 unicon-wikis"></i>
  7.         <span>{{ language_names[app.request.locale] | default(app.request.locale|upper) }}</span>
  8.     </a>
  9.     <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;">
  10.         <ul class="nav-y gap-0 fs-7">
  11.             {% for locale in available_locales %}
  12.                 <li{% if locale == app.request.locale %} class="uc-active"{% endif %}>
  13.                     {% if locale == app.request.locale %}
  14.                         {# Langue active - non cliquable #}
  15.                         <span class="w-100 p-1 px-2 hover:bg-gray-600 hover:bg-opacity-5 dark:hover:bg-white duration-150">
  16.                             <img class="w-20px rounded-1 me-1 rtl:me-0 rtl:ms-1" src="/assets/lexend/images/common/{{ locale }}.svg" alt="{{ language_names[locale] }}" />
  17.                             {{ language_names[locale] | default(locale|upper) }}
  18.                         </span>
  19.                     {% else %}
  20.                         {% set articleLocale = getPathArticleLocale(locale, article.identifiant) %}
  21.                         {% if articleLocale %}
  22.                             {% set prefix = (locale == default_locale) ? '' : '/' ~ locale %}
  23.                             {% if articleLocale.pageslug3 is not empty %}
  24.                                 {% set urlArticle = prefix ~ '/' ~ articleLocale.pageslug ~ '/' ~ articleLocale.pageslug2 ~ '/' ~ articleLocale.pageslug3 %}
  25.                             {% elseif articleLocale.pageslug2 is not empty %}
  26.                                 {% set urlArticle = prefix ~ '/' ~ articleLocale.pageslug ~ '/' ~ articleLocale.pageslug2 %}
  27.                             {% elseif articleLocale.pageslug is not empty %}
  28.                                 {% set urlArticle = prefix ~ '/' ~ articleLocale.pageslug %}
  29.                             {% else %}
  30.                                 {% set urlArticle = prefix ~ path('blog_article', {'slug': articleLocale.slug}) %}
  31.                             {% endif %}
  32.                             <a href="{{ urlArticle }}"
  33.                                class="w-100 p-1 px-2 hover:bg-gray-600 hover:bg-opacity-5 dark:hover:bg-white duration-150"
  34.                                hreflang="{{ locale }}">
  35.                                 <img class="w-20px rounded-1 me-1 rtl:me-0 rtl:ms-1" src="/assets/lexend/images/common/{{ locale }}.svg" alt="{{ language_names[locale] }}" />
  36.                                 {{ language_names[locale] | default(locale|upper) }}
  37.                             </a>
  38.                         {% else %}
  39.                             {# Pas d'article dans cette langue - dĂ©sactivĂ© #}
  40.                             <span class="w-100 p-1 px-2 text-gray-400 dark:text-gray-500 cursor-not-allowed">
  41.                                 <img class="w-20px rounded-1 me-1 rtl:me-0 rtl:ms-1 opacity-50" src="/assets/lexend/images/common/{{ locale }}.svg" alt="{{ language_names[locale] }}" />
  42.                                 {{ language_names[locale] | default(locale|upper) }}
  43.                             </span>
  44.                         {% endif %}
  45.                     {% endif %}
  46.                 </li>
  47.             {% endfor %}
  48.         </ul>
  49.     </div>
  50. </li>