use If for lang in twig file

sylvanas - 6 months ago

hi i need to get current lang name in twig file and if then for lang for change value of label

Answer

- 6 months ago

not sure if understood you, but

{% for locale in config_get('streams::locales.enabled') %}
    <a {% if config('app.locale') == locale %}class="current"{% endif %} href="{{ url_locale(request_path(), locale) }}">
        {{ locale }}
    </a>
{% endfor %}

keevitaja - 6 months ago

not sure if understood you, but

{% for locale in config_get('streams::locales.enabled') %}
    <a {% if config('app.locale') == locale %}class="current"{% endif %} href="{{ url_locale(request_path(), locale) }}">
        {{ locale }}
    </a>
{% endfor %}