Skip to content

fix: recurse into HTML elements within ICU branches to extract interpolation placeholders#20

Merged
Brooooooklyn merged 1 commit intomainfrom
fix/i18n-nested-icu-element-interpolations
Feb 10, 2026
Merged

fix: recurse into HTML elements within ICU branches to extract interpolation placeholders#20
Brooooooklyn merged 1 commit intomainfrom
fix/i18n-nested-icu-element-interpolations

Conversation

@Brooooooklyn
Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn commented Feb 10, 2026

When ICU case text contains interpolations inside HTML elements like <strong>{{ expr }}</strong>, extract_placeholders_from_nodes was silently dropping them because it only handled Text and Expansion nodes. This caused fewer i18nExp calls than Angular emits (e.g., 5 instead of 8 for undo-toast-items.component.ts with nested ICU plurals).

Add HtmlNode::Element recursion to match Angular's i18n_parser.ts visitElement behavior which recursively visits children.


Note

Low Risk
Small, localized change to ICU placeholder extraction with a targeted regression test; main risk is subtle ordering/count differences in generated i18nExp arguments for templates with ICU + nested markup.

Overview
Fixes ICU placeholder extraction so i18n processing no longer drops interpolations nested inside HTML elements within ICU branches by recursing into HtmlNode::Element children in extract_placeholders_from_nodes.

Adds an integration test plus snapshot covering nested ICU plurals with markup like <strong>{{ expr }}</strong>, asserting the generated ɵɵi18nExp(...) chain includes the expected expressions (e.g., ctx.name, ctx.category).

Written by Cursor Bugbot for commit 097d008. This will update automatically on new commits. Configure here.

…olation placeholders

When ICU case text contains interpolations inside HTML elements like
`<strong>{{ expr }}</strong>`, `extract_placeholders_from_nodes` was
silently dropping them because it only handled Text and Expansion nodes.
This caused fewer i18nExp calls than Angular emits (e.g., 5 instead of 8
for undo-toast-items.component.ts with nested ICU plurals).

Add HtmlNode::Element recursion to match Angular's i18n_parser.ts
visitElement behavior which recursively visits children.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Brooooooklyn Brooooooklyn merged commit a23d741 into main Feb 10, 2026
3 checks passed
@Brooooooklyn Brooooooklyn deleted the fix/i18n-nested-icu-element-interpolations branch February 10, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant