-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Closed
Labels
area: i18nIssues related to localization and internationalizationIssues related to localization and internationalizationstate: confirmedtype: bug/fix
Milestone
Description
🐞 bug report
Affected Package
@angular/localize
Is this a regression?
No
Description
If I use the following code in the template:
<ng-container i18n="@@translation_with_nested_html">
<p>THIS PHRASE IS MISSING <strong>my bold text</strong> other phrase of this paragraph.</p>
</ng-container>
The extraction (npm run extract
) is fine and creates a xliff2 unit like the following:
<unit id="translation_with_nested_html">
<notes>
<note category="location">src/app/app.component.html:5,7</note>
</notes>
<segment>
<source>
<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">THIS PHRASE IS MISSING <pc id="1" equivStart="START_TAG_STRONG" equivEnd="CLOSE_TAG_STRONG" type="other" dispStart="<strong>" dispEnd="</strong>">my bold text</pc> other phrase of this paragraph.</pc>
</source>
</segment>
</unit>
In the translation file for french the target looks like that:
<target>
<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">THIS CETTE PHRASE EST MANQUANTE <pc id="1" equivStart="START_TAG_STRONG" equivEnd="CLOSE_TAG_STRONG" type="other" dispStart="<strong>" dispEnd="</strong>">mon texte en gras</pc> autre phrase de ce paragraphe.</pc>
</target>
After build with localize option the HTML output of the ng-container above is the following:
<p><strong>mon texte en gras</strong> autre phrase de ce paragraphe.</p>
The part "THIS CETTE PHRASE EST MANQUANTE " was omitted.
Expected result of the localized build for french is:
<p>THIS CETTE PHRASE EST MANQUANTE <strong>mon texte en gras</strong> autre phrase de ce paragraphe.</p>
🔬 Minimal Reproduction
checkout: https://github.com/kmcs/bug-angular-i18n_nested_html
run command: npm install && npm run build -- --localize
🔥 Exception or Error
No
🌍 Your Environment
Angular Version:
Angular CLI: 9.1.12
Node: 12.16.2
OS: linux x64
Angular: 9.1.12
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.901.12
@angular-devkit/build-angular 0.901.12
@angular-devkit/build-optimizer 0.901.12
@angular-devkit/build-webpack 0.901.12
@angular-devkit/core 9.1.12
@angular-devkit/schematics 9.1.12
@ngtools/webpack 9.1.12
@schematics/angular 9.1.12
@schematics/update 0.901.12
rxjs 6.5.5
typescript 3.8.3
webpack 4.42.0
Anything else relevant?
No
Metadata
Metadata
Assignees
Labels
area: i18nIssues related to localization and internationalizationIssues related to localization and internationalizationstate: confirmedtype: bug/fix