I have a requirement where on workflow rules I want to send out an email in the users preferred language, Is there a way to create multi-lingual visualforce email templates?
here is the sample Visualforce email template:
<messaging:emailTemplate recipientType="User"
relatedToType="custom_object"
subject="Case report for Account: {!relatedTo.name}">
<messaging:htmlEmailBody>
<html>
<body>
<p>Dear {!recipient.name},</p>
<p>Below is a list of cases related to {!relatedTo.name}.</p>
<table border="0" >
<tr>
<th>Case Number</th><th>Origin</th>
<th>Creator Email</th><th>Status</th>
</tr>
</table>
<p/>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
So wherever, you see the English text that should be translate to different language based on the user selected language perference.
sample workflow rule selecting the above email template:
Best Answer
After doing some research I able to figured out how to achieve this, if someone has better way of doing please post it here.
1) I modified my VF email template and added attribute
language="{!recipient.LanguageLocaleKey}"
2) After doing that, I created
Custom Labels
as shown below:3) After creating the
Custom Labels
I just had to plug them in the VF email template as shown below.4) If you want to test it out, go back to the
User account
change the Language andSave
the record, then go back to the Email Template and do aSend Test Email
It works fine without any issue, again if you have a better solution please let me know and hope this will help others.