Language Setting in Prestashop

324 Views Asked by At

enter image description here

In Prestashop for English website, I need to show the Arabic Language selector and on the Arabic website I need to show English as a Language selector. currently, it showing the current website language on the language selector bar. is there is a way to do this?

<div class="language-selector dropdown js-dropdown">
    <span class="expand-more" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" id="language-dropdown">
        <span><img class="lang-flag" src="{$urls.img_lang_url}{$current_language.id_lang}.jpg"/></span>
        <span class="language-title">{$current_language.name_simple}</span>
        <span class="dropdown-arrow"></span>
    </span>
    <ul class="dropdown-menu" aria-labelledby="language-dropdown">
    {foreach from=$languages item=language}
        <li {if $language.id_lang == $current_language.id_lang} class="current" {/if}>
            <a href="{url entity='language' id=$language.id_lang}" class="dropdown-item"><img class="lang-flag" src="{$urls.img_lang_url}{$language.id_lang}.jpg"/> {$language.name_simple}</a>
        </li>
    {/foreach}
    </ul>
</div>
1

There are 1 best solutions below

1
On

Try this:

<div class="language-selector dropdown js-dropdown">
    <span class="expand-more" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" id="language-dropdown">
        <span><img class="lang-flag" src="{$urls.img_lang_url}{$current_language.id_lang}.jpg"/></span>
        <span class="language-title">{$current_language.name_simple}</span>
        <span class="dropdown-arrow"></span>
    </span>
    <ul class="dropdown-menu" aria-labelledby="language-dropdown">
    {foreach from=$languages item=language}
        {if $language.id_lang != $current_language.id_lang}
            <li>
                <a href="{url entity='language' id=$language.id_lang}" class="dropdown-item"><img class="lang-flag" src="{$urls.img_lang_url}{$language.id_lang}.jpg"/> {$language.name_simple}</a>
            </li>
        {/if}
    {/foreach}
    </ul>
</div>