Can I translate text without creating an element?

Yes, you can achieve using <ng-container> attribute. Normally you need to wrap a text content with i18n attribute for the translation. But if you don't want to create a new DOM element just for the sake of translation, you can wrap the text in an <ng-container> element.

<ng-container i18n>I'm not using any DOM element for translation</ng-container>

Remember that <ng-container> is transformed into an html comment


August 03, 2022
121