We’ve migrated our documentation to a new site, which means some URLs have changed.
Subscriptions

How Do You Localize Items Such as term.name, term.displayLine, and term.description?

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>

  1. In the template attribute, map a variable name to the term field (e.g., {{termName: term.name}}).

  2. 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: Subscribe now

{term.name}

[[termName]]

{term.displayLine}

[[termDisplayLine]]

{term.description}

[[termDescription]]

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.

Last updated: