Using Custom Labels

Custom labels are custom text values that can be translated into any language that Salesforce supports. To access custom labels in Aura components, use the $Label global value provider.

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.

Label translations require the Translation Workbench is enabled.

To create custom labels, from Setup, enter Custom Labels in the Quick Find box, then select Custom Labels.

Use the following syntax to access custom labels in Aura components.

  • $Label.c.labelName for the default namespace
  • $Label.namespace.labelName if your org has a namespace, or to access a label in a managed package

You can reference custom labels in component markup and in JavaScript code. Here are some examples.

{!$Label.c.labelName}

Label expressions in markup are supported in .cmp and .app resources only.

$A.get("$Label.namespace.labelName")

Updates to a label locale or translation are not immediately in the application. To verify the change immediately, log out and in.

See Also