14

What is the way to use localized labels from Custom Labels or from field config inside lightning components?

In VF it was possible like:

  • $ObjectType[sObjectName].fields[fieldName].Type
  • $Labels.Custom_Label
1

3 Answers 3

10

This feature has now been added as of Summer '15

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/labels_value_provider_platform.htm

2
  • Still not available for $ObjectType, though... best bet is going to be to retrieve it from an Apex controller method using DescribeSObjectResult or DescribeFieldResult Oct 17, 2016 at 19:55
  • See official documentation here: Using Custom Labels Jan 31, 2019 at 10:12
3

In Lightning Components, these are called global value providers. Currently there are only a few, including $Locale, and $Browser.

Some of the very useful global variables that exist in Visualforce such as the two you state and others like $User, $Profile, and others have not yet been implemented in Lightning Component Framework.

2
  • Hi Peter, is there a list of what is actually there and what is missing compared to Visualforce?
    – Uwe Heim
    Nov 2, 2015 at 15:37
  • I've not seen a public doc.
    – pchittum
    Nov 2, 2015 at 22:21
0

I have the same requirement, what I did mayn't be the optimum solution; but it does suffice my requirement.

I had created a CustomLabel csv file and uploaded as a Static Resource.

Hope this will help you too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .