Custom labels enable developers to create multilingual applications by automatically presenting information (for example, help text or error messages) in a user’s native language. Custom labels are custom text values that can be accessed from Apex classes, Visualforce pages, Lightning pages, or Lightning components. The values can be translated into any language Salesforce supports.
Required Editions
| Available in: both Salesforce Classic and Lightning Experience |
| Available in: Developer, Professional, Enterprise, Performance, and Unlimited Editions |
| User Permissions Needed | |
|---|---|
| Create, edit, or delete custom labels: | Customize Application |
| Create or override a translation: |
Manage Translation OR View Setup and Configuration and be designated as a translator |
You can create up to 5,000 custom labels for your organization, and they can be up to 1,000 characters in length. Custom labels from managed packages don’t count toward this limit.
To access custom labels, from Setup, enter Custom Labels in the Quick Find box, then select Custom Labels.
How you add a custom label to your application depends on the user interface. For more information on the following syntax, see the corresponding developer guides.
- In Apex use the
System.Label.Label_namesyntax. You can also use methods in theSystem.Labelclass to check for and retrieve translated labels. To check if translation exists for a label and language in a namespace, usetranslationExists(namespace, label, language). To retrieve the label for a default language setting or for a language and namespace, useget(namespace, label, language). - In Flow Builder, use the
$Labelglobal variable. - In Visualforce, use the
$Labelglobal variable. - In Aura components, use the
$Label.c.labelNamesyntax for the default namespace or$Label.namespace.labelNameif your org has a namespace or to access a label in a managed package. - In Lightning web components, import the label using the
@salesforce/label/namespace.Label_namesyntax. - In Lightning App Builder component labels and attributes, use the
{!$Label.customLabelName}expression.
Include the label in your application when you package it for the AppExchange.
- Create and Edit Custom Labels
Create custom labels that can be referenced from Apex classes, Visualforce pages, Lightning pages, or Lightning components to make an app multilingual. - Translate Custom Labels
Translations for custom labels determine what text to display for the label’s value when a user’s default language is the translation language.