<div class="language">
    <select aria-expanded="false" aria-haspopup="listbox" aria-label="{txt key=TEXT_LANGUAGE}" id="new_lang" name="new_lang" onchange="location.href=this.options[this.selectedIndex].value" class="show-tick form-control" tabindex="0">
        {foreach name=aussen item=box_data from=$lang_data}

            {$lang_switch_params=''}
            {if !$box_data.link|strpos:'language='}
                {$lang_switch_params='?'}
                {if $box_data.link|strstr:'?'}
                    {$lang_switch_params='&'}
                {/if}
                {$lang_switch_params="`$lang_switch_params`language=`$box_data.code`"}
            {/if}

            {if !$selected_lang}{* <!-- no cookie, $selected_lang != available --> *}
                <option aria-label="{txt key=TEXT_LANGUAGE} {$box_data.name}" data-content='<span aria-label="{txt key=TEXT_LANGUAGE} {$box_data.name}" class="option-title">{txt key=TEXT_LANGUAGE}: </span>{$box_data.name}' value="{$box_data.link}{$lang_switch_params}" {if      $language == $box_data.code} selected="selected" {/if}>{$box_data.name}</option>
            {else}{* <!-- choose selected by option value, not by shown language (because of some crazy user configurations) --> *}
                <option aria-label="{txt key=TEXT_LANGUAGE} {$box_data.name}" data-content='<span aria-label="{txt key=TEXT_LANGUAGE} {$box_data.name}" class="option-title">{txt key=TEXT_LANGUAGE}: </span>{$box_data.name}' value="{$box_data.link}{$lang_switch_params}" {if $selected_lang == $box_data.code} selected="selected" {/if}>{$box_data.name}</option>

            {/if}
        {/foreach}
    </select>
</div>