Custom and Live components - Fluid Topics - Latest

Fluid Topics Designer Guide

Category
Reference Guides
Audience
public
Version
Latest

It is possible to use localized labels directly in Custom components.

Examples

For a static message in the HTML section:

<ft-localized-label context="$CONTEXT_ID" key="$KEY_ID"></ft-localized-label>

For a dynamic message in the JS section:

const context = "$CONTEXT_ID";
const label = "$KEY_ID";

await FluidTopicsCustomI18nService.prepareContext(context);
const message = FluidTopicsCustomI18nService.resolveMessage(context, label);

document.querySelector(".class-example").innerText = message;

Replace $KEY_ID and $CONTEXT_ID with the correct information from the custom-$LanguageCode-messages.xml file.