• Overview
@angular/common

I18nPluralPipe

pipe

Maps a value to a string that pluralizes the value according to locale rules.

API

  
    class I18nPluralPipe implements PipeTransform {}
  
  

transform

string
@paramvaluenumber | null | undefined

the number to be formatted

@parampluralMap{ [count: string]: string; }
@paramlocalestring | undefined

a string defining the locale to use (uses the current LOCALE_ID by default).

@returnsstring

Description

Maps a value to a string that pluralizes the value according to locale rules.


Exported by

Usage Notes

Example

          
@Component({  selector: 'i18n-plural-pipe',  template: `<div>{{ messages.length | i18nPlural: messageMapping }}</div>`,  standalone: false,})export class I18nPluralPipeComponent {  messages: any[] = ['Message 1'];  messageMapping: {[k: string]: string} = {    '=0': 'No messages.',    '=1': 'One message.',    'other': '# messages.',  };}
Jump to details