vijayk3327 / LWC

1 stars 0 forks source link

How to access multiple line custom label and static resource file uses of “@salesforce/label/” and “@salesforce/resourceUrl/” property in Lightning Web Component Salesforce Lwc #71

Open vijayk3327 opened 1 year ago

vijayk3327 commented 1 year ago

In this post we are going to learn about How to access multiple line custom label and static resource file uses of “@salesforce/label/” and “@salesforce/resourceUrl/” property in Lightning Web Component Salesforce Lwc.

Import labels from the @salesforce/label scoped module. Custom labels are text values stored in Salesforce that can be translated into any language that Salesforce supports. Use custom labels to create multilingual applications that present information (for example, help text or error messages) in a user’s native language.

→ Get source code live demo link:-

Step 1:- Create Lightning Web Component : lwcCustomLabel.html

` `

Step 2:- Create Lightning Web Component : lwcCustomLabel.js

` import { LightningElement } from 'lwc';

import w3webLogo from '@salesforce/resourceUrl/w3webLogo';

import w3webTutorial from '@salesforce/label/c.w3web_Salesforce_Tutorial'; import salesforce_tutorial from '@salesforce/label/c.salesforce_tutorial'; import X5g_Mobiles from '@salesforce/label/c.X5g_Mobiles'; import online_shopping from '@salesforce/label/c.online_shopping'; export default class LwcCustomLabel extends LightningElement {

 logoUrl = w3webLogo;

 label = {
    w3webTutorial,
    salesforce_tutorial,
    X5g_Mobiles,
    online_shopping,
 };

}`

Step 3:- Create Lightning Web Component : lwcCustomLabel.js-meta.xml

` <?xml version="1.0" encoding="UTF-8"?>

45.0 true lightning__AppPage lightning__RecordPage lightning__HomePage ` **Step 4:- Create Lightning Application : lwcCustomLabelApp.app** ` ` **[→ Get source code live demo link:-](https://www.w3web.net/display-custom-label-multi-line-in-lwc/)**