Skip to content

API Reference


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

Class: IntlLocalizedPipe ​

Defined in: libs/ng/utils/intl/src/lib/intl-localized.pipe.ts:25

Picks the value for the active locale from a { [locale]: value } map, as CMS entries or API labels often carry them. Tries, in order: the exact locale (de-AT), its language (de), any key with the same language (de-DE), the fallback locales (default en), then the first non-empty value. Returns null when nothing is set. Keys are compared case-insensitively.

Example ​

html
{{ product.title | intlLocalized }}
{{ label | intlLocalized: { fallback: ['de', 'en'] } }}

Extends ​

  • IntlPipeBase

Implements ​

  • PipeTransform

Constructors ​

Constructor ​

new IntlLocalizedPipe(): IntlLocalizedPipe

Returns ​

IntlLocalizedPipe

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<T>(values, options?): T | null

Defined in: libs/ng/utils/intl/src/lib/intl-localized.pipe.ts:26

Type Parameters ​

T ​

T

Parameters ​

values ​

Readonly<Record<string, T>> | null | undefined

options? ​

IntlLocalizedOptions = {}

Returns ​

T | null

Implementation of ​

PipeTransform.transform

Released under the MIT License.