Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 711 Bytes

README.md

File metadata and controls

21 lines (16 loc) · 711 Bytes

Custom Label Translator

How to retrieve a custom label's translation for a specific language in apex ?

⚠️ ** This repo is not useful anymore since Salesforce released the functionnality in standard Label class

How to translate a custom label ?

LabelTranslator t = new LabelTranslator();
String enLabel = t.translate('CustomLabelName','en');
System.debug(enLabel);
String frLabel = t.translate('CustomLabelName','fr');
System.debug(frLabel);

Deploy to Salesforce

Checkout the repo and deploy it with sfdx:

sfdx force:source:deploy -p force-app