Utility to use javascript template literal syntax in custom labels
Import
import { interpolate } from 'c/bolt';
Usage
import greeting from "@salesforce/label/c.greeting"; // => Hello ${name}
export default class myLwc extends LightningElement {
console.log(interpolate(greeting, {
Methods
interpolate(label, params) : string
Name | Type | Description |
---|
label | string | Label reference in teh format of a template literal string |
params | Object | Key/Value pairs to be templated inside the label |
interpolate(label) : withValuesFrom(source) => string
Name | Type | Description |
---|
label | string | Label reference in teh format of a template literal string |
source | Object | Object containing the key/value pairs to be templated inside the label |
import greeting from "@salesforce/label/c.greeting"; // => Hello ${Name}
export default class myLwc extends LightningElement {