You are here:
Localize a Print Layout by Using Labels Macro
Use the Labels macro path to specify dynamic text that is translatable.
Required Editions
| Available in Lightning Experience in Enterprise and Unlimited Editions that have Consumer Goods Cloud enabled. |
The labels macros path is bound to the label section of the Locale contract and starts with ‘Labels'. The print engine searches for the labels in referenced Locale contracts and replaces the dynamic value with the appropriate content. This helps mainly while translating the labels by referencing the desired locale contracts.
The standard format to reference a label macro in a print layout is:
| Format | Example |
|---|---|
| {{Labels::PrintLayouts.<PrintLayoutName>.<labelName>; defaultLabel=<fallback>}} | {{Labels::PrintLayouts.OrderConfirmationPDF.AddressId; defaultLabel=Address:}} |
| {{Labels::<labelName>; defaultLabel= <fallback>}} | {{Labels::AddressId; defaultLabel=Address:}} |
| {{Globals::Yes; defaultLabel= <fallback>}} | – |
When the macros path can’t identify the values within a locale contract, it extracts the
value specified in the defaultLabel (optional) attribute. defaultLabel is also used as the
value during the label extraction and the Refresh Locale process. The ID of the node in the
locale contract (<PrintLayout
id="OrderConfirmationPDF">) is the name of the folder in which the print contract
is available.
Here’s an example that describes how the label is extracted from the referenced locale
contract. In this macros path, the print engine navigates to the print layout ID OrderConfirmationPrint in the PrintLayouts section. It does
data lookup for the CustomerNumberId in the list of IDs, then extracts the associated value
defined in the text and renders the data in the PDF print document.
{{path=Labels::PrintLayouts.OrderConfirmationPrint.CustomerNumberId; defaultLabel="Customer Number"}}
{{path=Labels::CustomerNumberId; defaultLabel="Customer
Number"}}<!--Labels-->
<tr>
<th width="85">{{Labels::PrdNumberId; defaultLabel=No.}}</th>
<th width="*">{{Labels::TextEmptyId; defaultLabel=Empties}}</th>
<th width="40" alignment="right">{{Labels::DeliveredEmptiesId; defaultLabel=Del.}}</th>
<th width="40" alignment="right">{{Labels::ReturnedEmptiesId; defaultLabel=Ret.}}</th>
<th width="40" alignment="right">{{Labels::TotalQuantityEmptiesId; defaultLabel=Qty}}</th>
<th width="18" alignment="center">{{Labels::TaxClassificationId; defaultLabel=T}}</th>
</tr>

