1

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.

1

1 Answer 1

2

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"/>
 <p>{!v.subject}</p>
 <p>{!v.greeting}</p>
</aura:component>

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

4
  • What is "SEDreamin"?
    – javanoob
    Jan 15, 2017 at 2:45
  • Namespace of the org Jan 15, 2017 at 2:46
  • 1
    Replace with c for normal org without namespace Jan 15, 2017 at 2:46
  • Still seem to be struggling getting this to work with community builder - anybody else seeing this? Jul 26, 2018 at 11:05

You must log in to answer this question.

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