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_name syntax. You can also
use methods in the System.Label class to check
for and retrieve translated labels. To check if translation exists for a label and
language in a namespace, use translationExists(namespace,
label, language). To retrieve the label for a default language setting
or for a language and namespace, use get(namespace, label,
language).
In Flow Builder, use the $Label global
variable.
In Visualforce, use the $Label global
variable.
In Aura components, use the $Label.c.labelName
syntax for the default namespace or $Label.namespace.labelName if 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_name
syntax.
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.
Tip If a custom label has translations, include the
translations in a package by explicitly packaging the desired languages.
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.
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.