libs/ngx-pfe/i18n/pfe-translate.service.ts
Adapter for different translate tools/libraries. An implementation of a translate tool/library adapter has to implement this service "interface".
Methods |
get | ||||||
get(key: string)
|
||||||
Returns the translation of a key.
Parameters :
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 :
Returns :
PipeTransform | undefined
|
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;
}
}