Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learning Salesforce Lightning Application Development

You're reading from   Learning Salesforce Lightning Application Development Build and test Lightning Components for Salesforce Lightning Experience using Salesforce DX

Arrow left icon
Product type Paperback
Published in Jul 2018
Publisher Packt
ISBN-13 9781787124677
Length 458 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Mohit Shrivatsava Mohit Shrivatsava
Author Profile Icon Mohit Shrivatsava
Mohit Shrivatsava
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Title Page
PacktPub.com
Foreword
Contributors
Preface
1. Introduction to the Lightning Component Framework FREE CHAPTER 2. Exploring Salesforce DX 3. Lightning Component Building Blocks 4. The Lightning JavaScript API 5. Events in the Lightning Component Framework 6. Lightning Data Service and Base Components 7. Using External JavaScript Libraries in Lightning Components 8. Debugging Lightning Components 9. Performance Tuning Your Lightning Component 10. Taking Lightning Components out of Salesforce Using Lightning Out 11. Lightning Flows 12. Making Components Available for Salesforce Mobile and Communities 13. Lightning Navigation and Lightning Console APIs 14. Unit Testing Lightning Components 15. Publishing Lightning Components on AppExchange 1. Other Books You May Enjoy Index

Using custom labels in Lightning Components


Custom labels are used to store constants in Salesforce organizations that can be configured by admins. They are completely configurable, and also allow for translation. If you are building a Lightning component to support multiple languages, all of the hardcoded titles need to be inside of labels, so that the platform automatically takes care of displaying the right label, as per the user settings (user-specified language).

The labels in a Salesforce instance can be created by navigating to Setup | User Interface | Custom Labels and then clicking on the New button. The following screenshot shows how to create a custom label in Salesforce:

To reference this in a Lightning component, the syntax is as follows:

$Label.c.LabelName

So, for a label named Pickone, the component markup can reference it by using $Label.c.Pickone.

In a JavaScript controller, you can get its value by using the following syntax:

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

Dynamically populating...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images