{% for language in languages %}
<li class="nav-item text-center space-lang" >
{% set loc = language.code %}
<a style="cursor:pointer"
class="nav-link {% if app.request.getLocale() == language.code %} fr {% endif %} size-lang"
{% if app.request.attributes.get('_route_params')['slug'] is defined %}
data-slug="{{ app.request.attributes.get('_route_params')['slug'] }}"
{% endif %}
data-route="{{ app.request.attributes.get('_route') }}"
data-localecurrent="{{ app.request.getLocale() }}"
data-langselected="{{ language.code }}"
data-href="{{ path(app.request.attributes.get('_route'),app.request.attributes.get('_route_params')) }}"
> {{ (language.code | capitalize) }}
</a>
</li>
{% endfor %}