biesbjerg / ngx-translate-extract

Extract translatable (using ngx-translate) strings and save as a JSON or Gettext pot file
MIT License
524 stars 196 forks source link

[Question] Can we have html tags in translation strings? #262

Open sanket-thotange opened 1 year ago

sanket-thotange commented 1 year ago

{{ 'Alert Count <strong>{count}</strong>' | translate: {count: 4} }}

alebx commented 1 year ago

Yes, but you need to render the content as html e.g. <div [innerHTML]="'Alert Count <strong>{count}</strong>' | translate: {count: 4}"></div>. For some HTML tags you might also need to use/bypass the DomSanitizer.