Skip to content

tprouvot/labelTranslator

Repository files navigation

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

About

This repo contains a way to translate Salesforce custom label in a specific language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published