I have an Apex class which sets the subject and body of an email using custom labels. The new requirement is to set this text per the language selected using a picklist field on Quote object. For example, if the language on Quote is French, the email text should be displayed in French irrespective of the user's location who generated the email.

newEnvelope.dsfs__DocuSign_Email_Subject__c = 
System.Label.AG_Docusign_Email_Subject + ' ' + Account.AccountName__c + ' ' + System.Label.AG_Quote + quoteName.Name; 
newEnvelope.dsfs__DocuSign_Email_Message__c = System.Label.AG_Docusign_Email_Message;

Is there any way to select the language of the label dynamically or any other way to implement this functionality?

1 Answer 1


Labels are automatically selected in the contextual user's selected locale language. This is the language of the user causing the generation of the email, rather than the recipient of the email. You cannot directly ask for labels in a selected locale language.

You can, however, use email templates and a custom language field on the recipient object to achieve this. See https://success.salesforce.com/answers?id=90630000000gyjTAAQ for discussion and an example. Personally I don't like the approach of using labels like this since you have to combine them around substitutable values, and structure is language specific.

Our approach is to have separate email templates per language, where the templates share a root name with a language variant suffix, since templates support mailmerge. The specific template is selected based on the custom language locale field on the recipient (contact).

You must log in to answer this question.

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