Class

DecafTranslatePipe

DecafTranslatePipe()

Constructor

# new DecafTranslatePipe()

The DecafTranslatePipe provides a mechanism to translate text keys into localized strings based on the current language settings. It integrates with the TranslateService to fetch translations dynamically and supports fallback rendering for untranslated keys.

Angular pipe for translating text using the @ngx-translate/core library.

Implements:
  • PipeTransform

View Source lib/pipes/translate.pipe.ts, line 12

Members

TranslateService

# translate

Injected instance of the TranslateService for handling translations.

Injected instance of the TranslateService for handling translations.

View Source lib/pipes/translate.pipe.ts, line 26

TranslateService

# translate

Injected instance of the TranslateService for handling translations.

Injected instance of the TranslateService for handling translations.

View Source lib/pipes/translate.pipe.ts, line 65

Methods

# transform(value, …args) → {string}

Uses the TranslateService to fetch the translated string for the provided key. If translations are disabled or the key is not found, it returns a fallback HTML-wrapped key.

Transforms a text key into its localized string representation.

Parameters:
Name Type Attributes Description
value string

The translation key to be transformed.

args Array.<any> <repeatable>

Optional arguments to interpolate within the translation string.

View Source lib/pipes/translate.pipe.ts, line 79

The translated string or a fallback HTML-wrapped key.

string
Example
```html
{{ 'HELLO_WORLD' | translate }}
```