spz-text

When to use

spz-text renders internationalized text by looking up translations and substituting placeholder values. It supports text slots and currency slots.

Supported layout

  • container

Example

Basic i18n text

<spz-text layout="container" translationid="welcome_message"></spz-text>

With text slot

If the translation contains {name}, you can supply the value via slot-text-name:

<spz-text
  layout="container"
  translationid="greeting"
  slot-text-name="World">
</spz-text>

With currency slot

Currency slots render an <spz-currency> component for proper currency formatting:

<spz-text
  layout="container"
  translationid="price_label"
  slot-currency-price="29.99">
</spz-text>

Attributes

AttributeDescriptionTypeRequired
translationidTranslation key used for i18n lookup. The component resolves this against the current section's settingsstringNo
slot-text-*Text slot attributes. Replace * with the placeholder name. Example: slot-text-name="John" replaces {name} in the translationstringNo
slot-currency-*Currency slot attributes. Replace * with the placeholder name. Example: slot-currency-price="9.99" renders {price} as an <spz-currency> elementstringNo

Behavior

  1. The component fetches locale data from the locale service.
  2. It looks up the translation using the pattern sections.{sectionId}.settings.{translationid}, where sectionId comes from the nearest parent element with a data-section-id attribute.
  3. Placeholders in the form {name} are replaced with the corresponding slot-text-name or slot-currency-name attribute values.
  4. Currency slots are wrapped in <spz-currency> tags for proper formatting.

Notes

  • This component does not expose custom actions.
  • This component does not emit custom events.
  • After rendering, the component adds the i-spzhtml-text CSS class.