Dynamic translation

KbqDynamicTranslation — component for embedding custom components into translatable strings.

Components are embedded into strings using special syntax: [[<slotName>:<context>]], where slotName is the key of the registered component, and context is the data passed to the component.

<!-- Slot with string passing -->
<kbq-dynamic-translation text="[[myLinkSlot:Open link]]">
    <a *kbqDynamicTranslationSlot="'myLinkSlot'; let context">{{ context }}</a>
</kbq-dynamic-translation>

<!-- Slot with list passing -->
<kbq-dynamic-translation text="[[myListSlot:(first,second,third)]]">
    <ul *kbqDynamicTranslationSlot="'myListSlot'; let context">
        @for (item of context; track $index) {
            <li>{{ item }}</li>
        }
    </ul>
</kbq-dynamic-translation>
  • Embedding components (links, buttons, dropdowns, etc.) into localized strings.
  • Separation of interface logic from localization texts.
  • Support for multiple slots in a single string.
  • When you need to dynamically change the composition and context of embedded components depending on localization.
  • If you need to add interactive elements (links, buttons, dropdowns, etc.) directly into translatable text.
  • For highlighting parts of text with special styles.
Docs Feedback
If you have any questions or would like to contribute to writing the documentation, please create an issue in our GitHub repository.