I'm preparing an application for internationalization with the @angular/localize
library, so I'm going through and adding i18n
attributes to fields that contain copy.
I've run into some difficulty where I have paragraphs of text that contain em
and strong
tags.
As an example:
<p>We are <em>very</em> happy that you've chosen Funtimes Widget Company!</p>
The application also uses 'strong' for certain product names in copy:
<p>Furthermore, when you take advantage of this deal, we'll send you a <strong>Super
Cool Widget Kit</strong> for no extra charge!</p>
I'm not sure how to handle this. Do I put the i18n
attribute on the parent p
tag? (I know that splitting an English sentence into chunks and translating each chunk separately is not the answer, because languages differ greatly in sentence structure.) How do emphasis (eg italics) and strong get handled in i18n?
- Angular 13.3.5.
I imagine that a solution can be a "work-around" that is you not use "tags" else replace the tag with "somedifferent" and use a pipe.
Imagine you has a pipe like
You can use an html like
Since Angular 13 you can translate variables in code, see the docs (sorry, I didn't use)
So I imagine you can to have in code some like
And use