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
.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityIs 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
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
6.Choose a User with other language and login in back .You should see translated label
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