You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes handling of nested html-tagged template expressions in lit localize analysis.
For example, the following example was analyzed incorrectly:
```ts
msg(html`Hello <b>${html`<i>World</i>`}</b>!`);
```
We combine runs of HTML markup and expressions so that we have fewer placeholders during translation, so we pass the template through an HTML parser, nested expressions and all. The problem was that if the nested expressions contained HTML, those would get parsed as part of the outer message, which would corrupt the analyzed template. The fix was to replace nested expressions with placeholders (the index) during HTML parsing (because we don't need the HTML parser to see the contents of expressions at all) and then substitute the original expression back after HTML parsing.
Fixes#2426
Description
lit-localize extract
does not properly handlehtml
calls withinhtml
withinmsg
.Steps to Reproduce
Include the following code
And run
lit-localize extract
Expected Results
Actual Results
Above results are for xliff format but similar results are seen for xlb format as well.
Workaround for now is probably not to use
html
withinhtml
to create a placeholder, something likethough that doesn't allow a translator to switch the order if that's necessary. Perhaps #1890 would allow this?
The text was updated successfully, but these errors were encountered: