Jump to content

[SOLVED]load image according to language


sickshot

Recommended Posts

you can access to id lang with smarty.

 

So you can name your image with id_lang, like:

<img class="delicon" src="/themes/prestashop/img/deliver_1.png"></a>
<img class="delicon" src="/themes/prestashop/img/deliver_2.png"></a>
//if you want 2 images differents enter 2 lang

So you can assign to smarty the id_lang:

$this->context->smarty->assign('id_lang', $this->context->language->id);

and call your img after :

<img class="delicon" src="/themes/prestashop/img/deliver_{$id_lang}.png"></a>
Link to comment
Share on other sites

flobrflo

 

thank you for reply, but I dont understand where to place this, i mean which file :

 

 

 

So you can name your image with id_lang, like:

<img class="delicon" src="/themes/prestashop/img/deliver_1.png"></a>
<img class="delicon" src="/themes/prestashop/img/deliver_2.png"></a>
//if you want 2 images differents enter 2 lang

So you can assign to smarty the id_lang:

$this->context->smarty->assign('id_lang', $this->context->language->id);

 

 

my image is in block user info tpl

Edited by sickshot (see edit history)
Link to comment
Share on other sites

ok I solved this:

 

if image is called delivery - create 2 images called delivery_en.png and delivery_fr.png (according to your language code)

 

and insert this code:

<img src="{$img_dir}deliver_{$lang_iso}.png" alt="{l s='delivery}" img class="delivery"/>
Edited by sickshot (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...