2022-08-18 16:32:29 +02:00
|
|
|
{% set current = app.request.get('_route')|replace({"_i18n": ""})~"_i18n" %}
|
|
|
|
{% macro lang_url(route, locale, name) %}
|
|
|
|
<a class="language-item"
|
|
|
|
href="{{
|
|
|
|
path(
|
2022-08-18 21:08:03 +02:00
|
|
|
route, app.request.attributes.get('_route_params')|merge({'_locale': locale})
|
2022-08-18 16:32:29 +02:00
|
|
|
)
|
|
|
|
}}">{{ name }}
|
|
|
|
</a>
|
|
|
|
{% endmacro %}
|
|
|
|
<li class="language-selector">
|
|
|
|
<label for="toggle" class="touch"
|
|
|
|
role="button">
|
|
|
|
{{ app.request.locale|locale_name(app.request.locale)|u.title }}
|
|
|
|
</label>
|
|
|
|
<input type="checkbox" name="dropdown-checkbox" class="toggle">
|
|
|
|
<ul class="slide">
|
|
|
|
<li>
|
|
|
|
{{ _self.lang_url(current, "en", "English") }}
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
{{ _self.lang_url(current, "fr", "Français") }}
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|