1

I am trying to customize a message template by adding a header image with some text in it. The problem is that my website is in 2 languages and I need that the header image is sent to the user according to his/her language preferences.

This is how I am trying to do:

{if $contact.preferred_language eq 'English (United Kingdom)'}
<img src="WEBSITE_URL/images/Banner_EN.jpg" />
{else}
<img src="WEBSITE_URL/images/Banner_IT.jpg" />
   {/if}

Unfortunately, it seems not working.

Does someone have already dealt with such an issue?

Thank you very much to every good soul who is willing to give me the right information to solve this issue.

Regards, Giovanni

  • It's not clear from this whether a) the variable doesn't exist, b) the value isn't exactly what you're looking for, or c) the Smarty syntax is wrong. If you insert the {debug} tag into your template, you can see all of the available variables and their values. This should eliminate options a and b. Please try that and update your question to explain which situation is what you're seeing? – Jon G - Megaphone Tech Aug 17 '17 at 17:50
  • I have found an alternative solution which worked perfectly. I put the following line in the template: {ts}<img src="WEBSITE_URL/images/Banner_EN.jpg" />{/ts} Then modified the language file .mo and added a translation for the string: msgid "<img src="WEBSITE_URL/images/Banner_EN.jpg" />" msgstr "<img src="WEBSITE_URL/images/Banner_IT.jpg" />" It worked perfectly :) – Giovanni Aug 18 '17 at 9:49
1

I have found an alternative solution which worked perfectly.

I put the following line in the template (adding the {ts} tag):

{ts}<img src="WEBSITE_URL/images/Banner_EN.jpg" />{/ts} 

Then modified the language file .mo and added a translation for the string:

msgid "<img src="WEBSITE_URL/images/Banner_EN.jpg" />" 
msgstr "<img src="WEBSITE_URL/images/Banner_IT.jpg" />" 

It worked perfectly :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.