Skip to content

API Reference


API Reference / @dasch-ng/utils / intl/src / IntlPluralPipe

Class: IntlPluralPipe ​

Defined in: libs/ng/utils/intl/src/lib/intl-plural.pipe.ts:22

Picks the message for a count with Intl.PluralRules, so languages with more than two forms (Polish, Arabic, …) work too. Exact matches like =0 win over categories.

Example ​

html
{{ files.length | intlPlural: { '=0': 'No files', one: '# file', other: '# files' } }}
{{ count | intlPlural: { one: '# plik', few: '# pliki', many: '# plików', other: '# pliku' } : undefined : 'pl' }}
{{ place | intlPlural: { one: '#st', two: '#nd', few: '#rd', other: '#th' } : { type: 'ordinal' } }}

Extends ​

  • IntlPipeBase

Implements ​

  • PipeTransform

Constructors ​

Constructor ​

new IntlPluralPipe(): IntlPluralPipe

Returns ​

IntlPluralPipe

Inherited from ​

IntlPipeBase.constructor

Methods ​

locale() ​

protected locale(locale?): string

Defined in: libs/ng/utils/intl/src/lib/formatter-cache.ts:29

Parameters ​

locale? ​

string

Returns ​

string

Inherited from ​

IntlPipeBase.locale


transform() ​

transform(count, forms, options?, locale?): string

Defined in: libs/ng/utils/intl/src/lib/intl-plural.pipe.ts:23

Parameters ​

count ​

number | null | undefined

forms ​

IntlPluralForms

options? ​

PluralRulesOptions

locale? ​

string

Returns ​

string

Implementation of ​

PipeTransform.transform

Released under the MIT License.