{#
    This file is part of LimeSurvey
    Copyright (C) 2018 The LimeSurvey Project Team

    This file renders language changer inside the main container when multiple survey languages are available.

    It uses the Yii helper CHtml::dropDownList().
    @see: http://www.yiiframework.com/wiki/48/by-example-chtml/#hh5

#}

{% if aSurveyInfo.alanguageChanger.show == true %}
    
    {# set a shortcut for aSurveyInfo.alanguageChanger.datas #}
    {% set aLCD  = aSurveyInfo.alanguageChanger.datas %}

    {#
        array of attributes of the Drop Down list.
        To add a new attribute, just add an entry:
        'attribute' : 'value',
    #}
    {% set htmlOptions = {
            'class'          : 'form-control',
            'data-targeturl' : aLCD.targetUrl,
        }
    %}
    <!-- Language Changer -->
    <div class=" {{ aSurveyInfo.class.formgroup }} form-change-lang row row-cols-lg-auto g-1" {{ aSurveyInfo.attr.formgroup }} >
        <label class="{{ aSurveyInfo.class.controllabel }} col-form-label col-auto fw-bold" {{ aSurveyInfo.attr.controllabel }} for="lang">
            <span class="control-label" {{ aSurveyInfo.attr.languagechanger }}>{{ gT("Language:") }}</span>
        </label>
        <div class="col-auto">
                {{
                    C.Html.dropDownList(
                        'lang',
                        aLCD.sSelected,
                        aLCD.aListLang,
                        htmlOptions
                    )
                }}
        </div>
        <div class="col-auto">
        <!-- for no js functionality (need form) -->
        {% set buttonhtmlOptions = {
                'type'          : 'submit',
                'value'         : 'changelang',
                'name'          : 'move',
                'class'         : 'btn btn-primary ls-language-changer-item ',
            }
        %}
        {{
            C.Html.htmlButton(
                gT("Change the language"),
                buttonhtmlOptions
            )
        }}
        </div>
    </div>

    {# Activate the language changer  #}
    {{ registerScript("activateLanguageChanger", "activateLanguageChanger(); ", "POS_END") }}
    
{% endif %}
