Is it possible to use custom label when using the <design:attribute> tag?

I can merge in labels like label="{!$Label.myNamespace.my_Label}" in a component but does it not render when using design:attribute.


Below is an experimental approach

1.Create a Custom Label Named Hello

enter image description here

2.Create a component named HelloworldTranslate.cmp

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
 <aura:attribute name="subject" type="String" />
 <aura:attribute name="greeting" type="String"/>

3.Create a Design File like below .

<design:component label="Hello World">
 <design:attribute name="subject" label="Subject" description="Name of the person you want to greet" default="{!$Label.SEDreamin.Hello}"/>
 <design:attribute name="greeting" label="Greeting" />

The Key here is observe how i have include label as merge syntax {!$Label.SEDreamin.Hello}

where Hello is the label name and SEDreamin is org namespace .For org with no namespace use "c"

4.Translate the label .I used French here

5.Drag the component on the Home page enter image description here

6.Choose a User with other language and login in back .You should see translated label

enter image description here

One thing i observed the app caches so clear the cache and log in back to confirm translation

Another caveat I observed is it does not seem to work for community builder

| improve this answer | |
  • What is "SEDreamin"? – javanoob Jan 15 '17 at 2:45
  • Namespace of the org – Mohith Shrivastava Jan 15 '17 at 2:46
  • 1
    Replace with c for normal org without namespace – Mohith Shrivastava Jan 15 '17 at 2:46
  • Still seem to be struggling getting this to work with community builder - anybody else seeing this? – Giles Williams Jul 26 '18 at 11:05

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.