{if file_exists("templates/$template/includes/common/overwrites/language-chooser-dropdown.tpl")}
     {include file="./overwrites/language-chooser-dropdown.tpl"}
{else}
    <div class="dropdown-menu dropdown-language-search dropdown-lazy {if ((isset($RSThemes['pages'][$templatefile]['config']['isFullPage']) && $RSThemes['pages'][$templatefile]['config']['isFullPage'] == "1") || (isset($RSThemes['pages'][$templatefile]['name']) && $RSThemes['pages'][$templatefile]['name'] == "sidebar")) && (isset($type) && $type == "login")}dropdown-menu-center{else} dropdown-menu-right{/if}" {*id="languageChooserContent"*}>
        {if isset($templatefile) && $templatefile|strstr:"modules/addons/LagomOrderForm"}
            {if $currentpagelinkback|strstr:"?"}
                {$currentpagelinkback = rtrim($currentpagelinkback, '&amp;')}
                {$divChar = "&amp;"}
            {else}
                {$currentpagelinkback = rtrim($currentpagelinkback, '?')}
                {$divChar = "?"}
            {/if}
        {elseif $currentUrl|strstr:"?"}
            {$currentpagelinkback = rtrim($currentpagelinkback, '&amp;')}
            {$divChar = "&amp;"}
        {else}
            {if substr($currentpagelinkback, -1) != '&'}
                {$currentpagelinkback = rtrim($currentpagelinkback, '?')}
                {$divChar = "?"}
            {/if}
        {/if}
        <input type="hidden" data-language-select-value value="{if isset($activeLocale.localisedName)}{$activeLocale.localisedName}{/if}">
        <input type="hidden" data-language-select-backlink value="{$currentpagelinkback}{$divChar}">
        <input type="hidden" data-language-select-lang value="{if isset($_LANG['upgradeService']['select'])}{$_LANG['upgradeService']['select']}{/if}">
        <div class="dropdown-header input-group align-center">
            <i class="input-group-icon lm lm-search"></i>
            <input class="form-control" placeholder="{if isset($_LANG.search)}{$_LANG.search}{/if}..." type="text" data-language-select-search>
        </div>
        <div class="nav-divider"></div>
        <div class="dropdown-menu-items has-scroll" data-language-select-list>
        {if isset($locales) && is_array($locales)}
            {foreach $locales as $locale}
                <div class="dropdown-menu-item {if isset($activeLocale.language) && isset($locale.language) && $activeLocale.language == $locale.language}active{/if}" data-value="{if isset($locale.language)}{$locale.language}{/if}" data-language="{if isset($locale.localisedName)}{$locale.localisedName}{/if}">
                    {if $pageType == "website" && $currentpagelinkback|strstr:"cmsid"}
                        {$divChar = ""}
                        {$url = "?"|explode:$currentpagelinkback}
                        {$stringToReplace = ""}
                        {if isset($url[1])}
                            {$url2 = "&amp;"|explode:$url[1]}
                            {if isset($url2[0])}
                                {$stringToReplace = "`$url2[0]`"}
                            {/if}
                        {/if}
                    {else}
                        {$stringToReplace = ""}
                    {/if}
                    <a tabindex="0" href="{$currentpagelinkback|replace:$stringToReplace:""}{$divChar}language={if isset($locale.language)}{$locale.language}{/if}" rel="nofollow">
                        <span class="language-flag flag-{if isset($locale.language)}{$locale.language}{/if}">
                            <img class="lazyload hidden" aria-hidden="true" alt="{if isset($locale.language)}{$locale.language}{/if}" data-src="{$WEB_ROOT}/templates/{$template}/assets/img/flags/{if isset($locale.language)}{$locale.language}{/if}.svg"/>
                        </span>
                        <span class="language-text">{if isset($locale.localisedName)}{$locale.localisedName}{/if}</span>
                    </a>
                </div>
            {/foreach}
        {/if}
        </div>
        <div class="dropdown-menu-item dropdown-menu-no-data">
            <span class="text-info text-large">
                {$_LANG.norecordsfound}
            </span>
        </div>                  
    </div>
    {if isset($RSThemes['addonSettings']['hover_triggered_submenu_expansion']) && $RSThemes['addonSettings']['hover_triggered_submenu_expansion'] == "enabled" && ((isset($RSThemes.layouts.templateLayout) && $RSThemes.layouts.templateLayout != 'left-nav' && $RSThemes.layouts.templateLayout != 'left-nav-wide') || (isset($navtype) && $navtype == "secondary"))}
        <div class="dropdown-menu-filler"></div>
    {/if}
{/if}