
Angular i18n: ICU Messages in Attributes
The Gist I’ve discovered a somewhat hacky way for using ICU Messages (Pluralization/Selection) in element attributes. For those that just want to see the technique right away, here it is:
1 2 3 4 5 |
<div hidden> <!-- ICU selection message marked for translation --> <span #altValue i18n>{role, select, tinker {Tinker} tailor {Tailor} soldier {Soldier} spy {Spy}} Profile Image</span> </div> <img [alt]="removeHtmlComments(altValue.innerHTML)" /> |
I will explain it further on in the post….