Problem with 'few' value using NgPlural
See original GitHub issue🐞 bug report
Affected Package
The issue is caused by package @angular/../i18n/localizationDescription
I am using the directive [ngPlural] my code is as follows
<label [ngPlural]="viewFlight.nights">
<ng-template ngPluralCase="=1" i18n="@@predictor_itinerary_night">noche</ng-template>
<ng-template ngPluralCase="few" i18n="@@predictor_itinerary_nights">noches</ng-template>
</label>
According to the documentation (https://angular.io/api/common/NgPlural) The code should work
Also in angular.json> build> options> I have set the default language of the application as:
"i18nLocale": "es"
I don’t know if this is important since I can’t think of anything else.,
🔥 Exception or Error
Error: No plural message found for value "3"
// The error appears with any value greater than 1
🌍 Your Environment
Angular Version:
9.0.5
Anything else relevant?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Can't get ngPlural to work Angular - Stack Overflow
When I use [ngPlural] I get the error No provider TemplateRef! for Template ref. If I remove it and use *ngPlural I also...
Read more >ngPlural & ngPluralCase : Pluralization in Angular
Converting singular words to plural is often difficult Even in english where most ... Error: No plural message found for value - ngPlural....
Read more >NgPlural - Angular
Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees that match the switch expression's pluralization category. To use...
Read more >Angular 10 NgPlural Directive - GeeksforGeeks
The NgPlural in Angular10 is used to Add or remove DOM sub-trees based on a numeric value. Syntax: <li *NgPlural='condition'></li>. NgModule: ...
Read more >NgPlural - Angular
To use this directive you must provide a container element that sets the ... <some-element [ngPlural]="value"> <ng-template ngPluralCase="=0">there is ...
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 Free
Top 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
@rockument69 - I think adding these links would be helpful, but we should make it clear that most locales do not support many of the options. We should also point out that
other
should always be implemented since that is the standard fallback for a missing option.The detail is that the case is computed by calling the
getPluralCase()
function:You can see that this will return one of
['zero', 'one', 'two', 'few', 'many']
or'other'
based on a call to the function returned fromgetLocalePluralCase()
. This function is defined in the locale data file of the given locale. For example, in the ar-AE locale file:Note that the numbers returned correspond to the index into the
['zero', 'one', 'two', 'few', 'many']
array.But also note that the vast majority of locales implement a much more simple
plural()
function such as:See that in this case the function will only ever return
1
('one'
) or5
('other'
).This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.