Term fields in Lightweight templates such as {term.name}, {term.displayLine}, and {term.description} are dynamically rendered by the Piano platform. Wrapping them directly with the tag (e.g., {term.name}) will not work.
To localize these fields, you need to pass the term value into the tag using the template attribute, and reference it with double bracket syntax [[...]] inside the tag.
Syntax
<T template={{variableName: term.fieldName}}>[[variableName]]</T>
-
In the
templateattribute, map a variable name to the term field (e.g.,{{termName: term.name}}). -
Inside the tag, reference the variable using
[[variableName]].
Full Example
<PianoHeadline>
<T template={{termName: term.name}}>[[termName]]</T>
</PianoHeadline>
<PianoSubHeadline class="pn-decoy-offer-term-card-price">
<T template={{termDisplayLine: term.displayLine}}>[[termDisplayLine]]</T>
</PianoSubHeadline>
<PianoText class="pn-decoy-offer-term-card-subtext">
<T template={{termDescription: term.description}}>[[termDescription]]</T>
</PianoText>
Summary
|
Content Type |
How to Localize |
|---|---|
|
Static text (labels, buttons, headings) |
Wrap with tag directly: |
|
|
|
|
|
|
|
|
|
Mixing Static Text with Term Variables
You can combine static translatable text and term variables within the same tag. Place [[variableName]] wherever the dynamic value should appear in the string:
<T template={{termDescription: term.description}}>Some text [[termDescription]] more text</T>
This is useful when you need to embed a term value inside a translated sentence (for example, "Subscribe for just [[termDisplayLine]] and enjoy unlimited access"). Both the surrounding text and the term value will render correctly in the reader's language.
For more details on localization in Lightweight Templates, see the localization documentation.