templates/parts/_switchLanguage.html.twig line 1

Open in your IDE?
  1. {%- set listLanguages = ["fr", "en"] -%}
  2. {%- if redirect is defined -%}
  3.     {%- set pathParams = {"redirect": redirect|url_encode} -%}
  4. {%- endif -%}
  5. <div class="ui-language {{ containerClass|default('') }}">
  6.     {% for language in listLanguages  %}
  7.         <a href="{{ path(path|default('root'), {'_locale': language}|merge( pathParams|default({}) )) }}"
  8.            class="ui-language__link{% if app.request.locale == language %} is-active{% endif %}"
  9.         >
  10.             <img class="ui-language__flag"
  11.                  src="{{ image('flag_' ~ language ~ '.png') }}"
  12.                  data-toggle="tooltip"
  13.                  data-placement="bottom"
  14.                  title="{{ ('global.languages.' ~ language)|trans }}" />
  15.         </a>
  16.     {% endfor %}
  17. </div>