New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICU expression (plural) does not work with angular and HTML tags, since angular 9 #38588
Comments
The relevant section of the generated Ivy instructions are: i0.ɵɵelementContainerStart(7);
i0.ɵɵi18n(8, I18N_0);
i0.ɵɵelementContainerEnd(); But what is strange is the post-processing of the I18N_0 = i0.ɵɵi18nPostprocess(I18N_0, {
"VAR_PLURAL": "\uFFFD0\uFFFD",
"START_TAG_NG_CONTAINER": "<ng-container *ngTemplateOutlet=\"myTemplate\">",
"CLOSE_TAG_NG_CONTAINER": "</ng-container>",
"START_TAG_BUTTON": "<button>",
"CLOSE_TAG_BUTTON": "</button>"
}); I would have expected a "sub-template" block marker in there (i.e. something like |
Actually this is intended regression and is documented here: https://angular.io/guide/ivy-compatibility
So this is a side-effect of the fact that i18n is now runtime. I am going to close this as working as intended. |
The workaround for this case is to use |
@petebacondarwin It's a very poor workaround because the extracted |
@mhevery First time I hear about something like "indented regression". It is a major backward-incompatible change that was not communicated in a good way. I understand the reason behind it, but could be documented better. |
@mhevery The example I provided suggests that HTML tags inside ICU expressions do not work - e.g. button doesn't (and they should work, according to cited part from "Ivy compatibility guide"). So maybe you could change documentation to be more accurate? @petebacondarwin Thank you for adding workaround with |
The new ivy extraction ought to be able to provide a bit better information about the original context of the placeholders, although currently I see it is rather broken:
I would expect it to be more like:
I will work on some fixes for this... |
Previously, localized strings had very limited or incorrect source-mapping information available. Now the i18n AST nodes and related output AST nodes include source-span information about message-parts and placeholders - including closing tag placeholders. This information is then used when generating the final localized string ASTs to ensure that the correct source-mapping is rendered. See angular#38588 (comment)
Previously, localized strings had very limited or incorrect source-mapping information available. Now the i18n AST nodes and related output AST nodes include source-span information about message-parts and placeholders - including closing tag placeholders. This information is then used when generating the final localized string ASTs to ensure that the correct source-mapping is rendered. See angular#38588 (comment)
Previously, localized strings had very limited or incorrect source-mapping information available. Now the i18n AST nodes and related output AST nodes include source-span information about message-parts and placeholders - including closing tag placeholders. This information is then used when generating the final localized string ASTs to ensure that the correct source-mapping is rendered. See angular#38588 (comment)
Previously, localized strings had very limited or incorrect source-mapping information available. Now the i18n AST nodes and related output AST nodes include source-span information about message-parts and placeholders - including closing tag placeholders. This information is then used when generating the final localized string ASTs to ensure that the correct source-mapping is rendered. See angular#38588 (comment)
Previously, localized strings had very limited or incorrect source-mapping information available. Now the i18n AST nodes and related output AST nodes include source-span information about message-parts and placeholders - including closing tag placeholders. This information is then used when generating the final localized string ASTs to ensure that the correct source-mapping is rendered. See angular#38588 (comment)
) Previously, localized strings had very limited or incorrect source-mapping information available. Now the i18n AST nodes and related output AST nodes include source-span information about message-parts and placeholders - including closing tag placeholders. This information is then used when generating the final localized string ASTs to ensure that the correct source-mapping is rendered. See #38588 (comment) PR Close #38645
Previously, localized strings had very limited or incorrect source-mapping information available. Now the i18n AST nodes and related output AST nodes include source-span information about message-parts and placeholders - including closing tag placeholders. This information is then used when generating the final localized string ASTs to ensure that the correct source-mapping is rendered. See angular#38588 (comment)
) Previously, localized strings had very limited or incorrect source-mapping information available. Now the i18n AST nodes and related output AST nodes include source-span information about message-parts and placeholders - including closing tag placeholders. This information is then used when generating the final localized string ASTs to ensure that the correct source-mapping is rendered. See #38588 (comment) PR Close #38747
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 bug report
Affected Package
The issue is caused by package @angular/localize ?Is this a regression?
Yes, the previous version in which this bug was not present was: 8.3.29Description
After update to Angular 9 (and similarly for Angular 10), ICU expression does not render component or HTML tags inside ICU expression (in this case - plural expression). There is no error in browser or console, only "One " and "Other " strings are displayed without buttons (included in expressions). It worked fine for Angular 8 (both buttons were displayed):🔬 Minimal Reproduction
Angular 8 (working):https://stackblitz.com/edit/angular-plurals-angular8
Angular 9 (not working, regression):
https://stackblitz.com/edit/angular-plurals-angular9
🔥 Exception or Error
🌍 Your Environment
Angular Version:
Anything else relevant?
The text was updated successfully, but these errors were encountered: