File

libs/ngx-pfe/i18n/pfe-translate.service.ts

Description

Adapter for different translate tools/libraries. An implementation of a translate tool/library adapter has to implement this service "interface".

Index

Methods

Methods

get
get(key: string)

Returns the translation of a key.

Parameters :
Name Type Optional
key string No
Returns : Observable<string>
getTranslatePipeInstance
getTranslatePipeInstance(_ref: ChangeDetectorRef)

Returns an instance of the translate pipe instance. If a translation tool/library already provides a translate pipe, this can simply be returned. Otherwise a "proxy" pipe can be used. If undefined is returned, no translation will be applied.

Parameters :
Name Type Optional
_ref ChangeDetectorRef No
import { ChangeDetectorRef, Injectable, PipeTransform } from '@angular/core';
import { Observable, of } from 'rxjs';

/**
 * Adapter for different translate tools/libraries.
 * An implementation of a translate tool/library adapter has to implement this service "interface".
 */
@Injectable()
export class PFETranslateService {
  /**
   * Returns the translation of a key.
   */
  get(key: string): Observable<string> {
    return of(key);
  }

  /**
   * Returns an instance of the translate pipe instance.
   * If a translation tool/library already provides a translate pipe, this can simply be returned.
   * Otherwise a "proxy" pipe can be used.
   * If undefined is returned, no translation will be applied.
   */
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  getTranslatePipeInstance(_ref: ChangeDetectorRef): PipeTransform | undefined {
    return undefined;
  }
}

results matching ""

    No results matching ""