I am using an image that contains text inside an email I send to users
For example:
I have a User table with a user_country attribute (for example France) and a method I use on the website to induce the language :
module LocaleSetter
DefaultLocale = 'en'
extend ActiveSupport::Concern
included do
before_filter :set_locale
end
def set_locale
I18n.locale = extract_locale_from_country
end
def extract_locale_from_country
case I18nData.country_code(set_country)
when 'US'
'en'
when 'FR'
'fr'
when 'ES'
'es'
when 'DE'
'de'
when 'NL'
'nl'
else
DefaultLocale # default locale if no other is set
end
end
end
If I write the letter in different languages (french, english, german...), how to tell my app to condtionnaly choose the right image's src image it points to i.e the picture with french text if it's an email to French users, but the picture with german text if it goes to a German user ?
<td style="margin: 0 auto;padding: 0;display: block;max-width: 600px;clear: both; color: #454545;">
<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#ffffff" >
<tbody>
<tr>
<td>
<a href="<%= t("mail.useful_adresses.homepage") %>" rel="nofollow" target="_blank">
<img style="display: block;" width="590px" height="163px" border="0" align="left" alt="<%= raw t("mail.subscription_mails.welcome_notifier_mail.welcome") %>" src="http://example.com/emails-images/optimized-mail-top.png">
</a>
</td>
</tr>
</tbody>
</table>
</td>
Thanks
PS: all translations of texts with t("texte") through i18n works well in the emails. My problem involves images src