Prestashop 1.7 and 1.6: display language flags

Do you want to display flags for your languages switcher on Prestashop? By reading this article you will be able to get it

  1. Home
  2. /
  3. Prestashop Tutorials
  4. /
  5. Prestashop 1.7 and 1.6: display language flags

By default in Prestashop 1.7.x and 1.6.x, languages switcher module does not display flags icons.

Solution for Prestashop 1.7.x

Language selector block modification

There’s a simple solution if you want to display a flag next to each language you are using form your eshop made with Prestashop.

Please, follow these steps:

  1. Use your favourite Text Editor like Notepad++ and open ps_languageselector.tpl located inside
    /your-online-installation/themes/your-theme/modules/ps_languageselector/

    Note: if the folder called ps_languageselector does not exist in your theme directory, create this folder inside
    /your-online-installation/themes/your-theme/modules/
    and paste the file called ps_languageselector.tpl you copied from
    /your-online-installation/modules/ps_languageselector/
  2. Use your favourite Text editor and open ps_languageselector.tpl
  3. About row 30, add
    <img alt="{$current_language.name_simple}" src="{$urls.base_url}/img/l/{$language.id}.jpg" width="16" height="11">
    

    before
    <i class="material-icons expand-more">
    
  4. Change twice (about rows 36 and 42)
    {$language.name_simple}
  5. with
    <img alt="{$current_language.name_simple}" src="{$urls.base_url}img/l/{$language.id_lang}.jpg" width="16" height="11"> {$language.name_simple}
  6. Save and overwrite
  7. It could be necessary to delete the cache of Prestashop (Advanced Parameters > Performance) and of your browser. (Please, be sure that Recompile templates if the files have been updated is enabled)

Solution for Prestashop 1.6.x

Block languages module modification

There’s a simple solution if you want to display a flag next to each language you are using form your eshop made with Prestashop.

Please, follow these steps:

  1. Use your favourite Text Editor like Notepad++ and open blocklanguages.tpl located inside
    /your-online-installation/themes/your-theme/modules/blocklanguages/

    Note: if the folder called blocklanguages does not exist in your theme directory, create this folder inside
    /your-online-installation/themes/your-theme/modules/
    and paste the file called blocklanguages.tpl you copied from
    /your-online-installation/modules/blocklanguages/
  2. Use your favourite Text editor and open blocklanguages.tpl
  3. Change twice (about rows 31 and 46)
    {$language.name|regex_replace:"/s.*$/":""}
  4. with
    <img alt="{$language.iso_code}" height="11" alt="" src="{$img_lang_dir}{$language.id_lang}.jpg" width="16" /> {$language.name|regex_replace:"/s(.*)$/":""}
  5. Save and overwrite
  6. It could be necessary to delete the cache of Prestashop (Advanced Parameters > Performances) and of your browser. (Please, be sure that Recompile templates if the files have been updated is enabled)

Last steps

Note: do not forget to install your languages and upload flag icons using your Administration Panel > Localization > Languages.

If everything has gone well, you will find your images inside your-online-installation/img/l/

Otherwise you can get flag icons here: www.famfamfam.com/lab/icons/flags/

We are curious to read your opinion!

Leave a Reply

Your email address will not be published. Required fields are marked *

Respect for your privacy is our priority

Our website uses technical cookies to run properly and third-party cookies to generate reports on the use of navigation (statistical cookies). Show the list of cookies and the purpose of use
We can use technical cookies by law, but you have the right to choose whether or not to enable statistical cookies.

By enabling these cookies, you help us to provide you with a better experience.