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

This feature has now been added as of Summer '15


| improve this answer | |
  • Still not available for $ObjectType, though... best bet is going to be to retrieve it from an Apex controller method using DescribeSObjectResult or DescribeFieldResult – MayTheSForceBeWithYou Oct 17 '16 at 19:55
  • See official documentation here: Using Custom Labels – Brian Miller Jan 31 '19 at 10:12

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.

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

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.