1

I'm using custom label on lightning components, but it always shows me English, and does not follow the user language. Someone knows what to do in this case?

I've tried reference my custom label direct in visualforce pages and it shows perfectly in the user language, but when I put it in my lightning component it always appear in English language.

User Language used to test: Spanish and Brazilian Portuguese

Organization default language: Brazilian Portuguese

Updated with component and app markup

test.cmp

<aura:component access="GLOBAL">
  {!$Label.c.MyLabel1}<br/>
  {!$Label.c.MyLabel2}<br/>
  {!$Label.c.MyLabel3}<br/>
</aura:component>

testApp.app

<aura:application access="GLOBAL">
  <c:test/>
</aura:application>
6
  • Custom Labels are supported in lightning components. Can you post the component markup which is not working properly?
    – Mark Pond
    Commented Aug 14, 2018 at 20:14
  • Updated @MarkPond. Commented Aug 14, 2018 at 20:25
  • Can you provide the organization language and the user language? Commented Aug 14, 2018 at 20:31
  • User Language used to test: Spanish and Brazilian Portuguese Organization default language: Brazilian Portuguese Commented Aug 14, 2018 at 20:39
  • Is the translation workbench enabled in the organization? Commented Aug 14, 2018 at 20:41

1 Answer 1

3

Minimal implementation, English & Español & Português, demonstrating translation based on the language value set on the User record.

App

<aura:application access="global">
    <c:q228892 />
</aura:application>

Component

<aura:component access="global">
    {!$Label.c.MyLabel1}
</aura:component>

Label Config

enter image description here

User Config - Español

enter image description here

Result Español

enter image description here

User Config - Português

enter image description here

Result Português

enter image description here

Result English

enter image description here

4
  • Looks like my implementation, excepts that my master language is Brazilian Portuguese. Commented Aug 14, 2018 at 20:54
  • You should also add the translation for your master language. Commented Aug 14, 2018 at 20:55
  • added the Portuguese example above
    – Mark Pond
    Commented Aug 14, 2018 at 20:57
  • I was missing to add the translation for my master language as @RenatoOliveira said. Even if I create the custom label for Portuguese I need to add it as a Translation for my custom label. Commented Aug 14, 2018 at 21:00

You must log in to answer this question.

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