If you use a Visualforce email template and set the LanguageLocaleKey
appropriately on the recipient you can craft an email like so:
<messaging:emailTemplate subject="{!$Label.Welcome_Email_Subject}" recipientType="User" language="{!recipient.LanguageLocaleKey}">
<messaging:htmlEmailBody >
<html>
<body>
<p>
<!-- We can craft a custom label like this: "Hello {0} {1}" and have our translations follow accordingly. -->
<apex:outputText value="{!$Label.Salutation}">
<apex:param value="{!recipient.FirstName}" />
<apex:param value="{!recipient.LastName}" />
</apex:outputText>
</p>
<p>{!$Label.Welcome_Instructions}</p>
<p>
<a href="{!$Network.NetworkUrlForUserEmails}">{!$Label.Welcome_Link_Text}</a>
</p>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
The key is liberal use of custom labels to allow the whole email body to be translated. Leverage the merge fields that are available when using apex:outputText
(replacing {0}
and {1}
with values) if you need to re-order things like subject-verb agreement in a translation.