ICU expression (plural) does not work with angular and HTML tags, since angular 9
See original GitHub issueπ 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):<ng-container i18n="Plurals example">{
pluralsValue, plural,
one {One <ng-container *ngTemplateOutlet="myTemplate"></ng-container>}
other {Other <button>button_other</button>}
}</ng-container>
<ng-template #myTemplate>
<button>button_one</button>
</ng-template>
π¬ 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:
Angular 9+
Anything else relevant?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How to use angular 9 $localize with plurals? - Stack Overflow
For now, it is not possible to use ICUs with $localize , as discussed in this github issue. From the last comments, it...
Read more >Prepare component for translation - Angular
The attributes of HTML elements include text that should be translated along ... Use the plural clause to mark expressions that may not...
Read more >The Ultimate Guide to Angular Localization | Phrase
How do I work with plurals in my translations? Angular implements the ICU standard for its localized plurals. ICU is a bit outside...
Read more >Angular i18n: internationalization & localization with examples
Working with Angular pipes. Performing translations within components. Adding a language switcher. Building the app and deploying to production.
Read more >Angular Translation: A Closer Look at Angular 8 - Medium
This tutorial will guide you through the process of Angular translation in the framework's latest, eighth version by using the built-in I18n module....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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β¦
@rygoebel thanks for the excellent reproductions of this problem. I can confirm that this is a regression. @mhevery is currently reworking some of the ICU handling in Ivy and so this may be related.