2

We have an LWC in our managed package that references custom fields and custom labels. I'm trying to use Translation Workbench with an English->English translation to alter the text as some customers want to customize it. But it doesn't appear to work.

Below is as subset of the code showing the use of one Custom Label and one Custom Field. I can use Translation Workbench to do an English->English translation for both. The field label does change when viewing a record on a page layout. But it does not change when rendered on the LWC. This as my baffled as the labels aren't hard-coded. I would think they would come from the same metadata as the page layout.

HTML--

<lightning-card title={label.labelEngagewareSchedulerDetails} >
...
  <lightning-record-edit-form  layout-type="Compact" record-id= {meetingId} object-api-name={meetingObject} >
...
    <lightning-output-field field-name={meetingStatusField}></lightning-output-field>

JS--

  import labelEngagewareSchedulerDetails from "@salesforce/label/c.Engageware_Scheduler_Details";
  import Meeting_OBJECT from '@salesforce/schema/Meeting__c';
  import Meeting_Status_FIELD from '@salesforce/schema/Meeting__c.Meeting_Status__c';
...
    label = {
        labelEngagewareSchedulerDetails,
    };
    meetingObject = Meeting_OBJECT;
    meetingStatusField = Meeting_Status_FIELD;


1
  • I determined that the Custom Label is now working. The field labels are stil not working.
    – Ken
    Commented Aug 7 at 13:57

1 Answer 1

1

I believe the issue is resolved. Recall when I first entered the issue, I reported Custom Labels and Custom Field Labels didn't work. When checking a second time, the Custom Labels worked but Custom Field Labels did not. I initially thought I didn't remember correctly but it appears caching was the culprit. Lightning caches a plethora of metadata. So it takes a while after changing the labels before they actually appear in the app. That's why Custom Label eventually worked but I hadn't waited long enough for the field. Rather a bother for testing but if translations don't work, go away for an hour or two and come back; logging out and back in didn't help. Or maybe flushing browser cache or using a different browser will help.

1
  • We had a similar issue the other day, and even with the Enable secure and persistent browser caching to improve performance setting turned off, it took the best part of an hour for an updated label to come through to my LWC.
    – Nick C
    Commented Aug 8 at 6:01

You must log in to answer this question.

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