I18nPluralPipe
pipe
Maps a value to a string that pluralizes the value according to locale rules.
transform
string
@paramvalue
number | null | undefined
the number to be formatted
@parampluralMap
{ [count: string]: string; }
an object that mimics the ICU format, see https://unicode-org.github.io/icu/userguide/format_parse/messages/.
@paramlocale
string | undefined
a string
defining the locale to use (uses the current LOCALE_ID
by
default).
@returns
string
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