Custom Labels and use in VF,APEX,AURA,LWC etc. #inSalesforce

Custom Labels #inSalesforce

Custom labels enable developers to create multilingual applications by presenting information (for example, help text or error messages) to users in their native language. A custom label is a custom text value that can be accessed from Apex classes, Visualforce pages, and Lightning components.


Use in Apex:

Syntax -  System.Label.Label_name


Use in VF Page:

Syntax:  $Label 


Use in Aura:

Syntax - $Label.c.labelName or or $Label.namespace.labelName


Use in LWC:

Syntax: @salesforce/label/namespace.Label_name


Use in App Builder:

Syntax: {!$Label.customLabelName}



Use in JS:

var someLabel= $A.get("$Label.c.Sample");
component.set("v.mylabel", someLabel);



Comments