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>
  • Custom Labels are supported in lightning components. Can you post the component markup which is not working properly? – Mark Pond Aug 14 '18 at 20:14
  • Updated @MarkPond. – Máximo Júnior Aug 14 '18 at 20:25
  • Can you provide the organization language and the user language? – Renato Oliveira Aug 14 '18 at 20:31
  • User Language used to test: Spanish and Brazilian Portuguese Organization default language: Brazilian Portuguese – Máximo Júnior Aug 14 '18 at 20:39
  • Is the translation workbench enabled in the organization? – Renato Oliveira Aug 14 '18 at 20:41
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

| improve this answer | |
  • Looks like my implementation, excepts that my master language is Brazilian Portuguese. – Máximo Júnior Aug 14 '18 at 20:54
  • You should also add the translation for your master language. – Renato Oliveira Aug 14 '18 at 20:55
  • added the Portuguese example above – Mark Pond Aug 14 '18 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. – Máximo Júnior Aug 14 '18 at 21:00

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.