1

I am using classic Email Template with html version to send the welcome email. For the translation I am using custom label {!$label.label_name}.

If I select the language french in community the email still coming in English(default language).

Any Suggestions what I am doing wrong?

7

1 Answer 1

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .