UNPKG

1.52 kBTypeScriptView Raw
1import { TranslateService } from "./translate.service";
2import * as i0 from "@angular/core";
3export interface MissingTranslationHandlerParams {
4 /**
5 * the key that's missing in translation files
6 */
7 key: string;
8 /**
9 * an instance of the service that was unable to translate the key.
10 */
11 translateService: TranslateService;
12 /**
13 * interpolation params that were passed along for translating the given key.
14 */
15 interpolateParams?: Object;
16}
17export declare abstract class MissingTranslationHandler {
18 /**
19 * A function that handles missing translations.
20 *
21 * @param params context for resolving a missing translation
22 * @returns a value or an observable
23 * If it returns a value, then this value is used.
24 * If it return an observable, the value returned by this observable will be used (except if the method was "instant").
25 * If it doesn't return then the key will be used as a value
26 */
27 abstract handle(params: MissingTranslationHandlerParams): any;
28}
29/**
30 * This handler is just a placeholder that does nothing, in case you don't need a missing translation handler at all
31 */
32export declare class FakeMissingTranslationHandler implements MissingTranslationHandler {
33 handle(params: MissingTranslationHandlerParams): string;
34 static ɵfac: i0.ɵɵFactoryDeclaration<FakeMissingTranslationHandler, never>;
35 static ɵprov: i0.ɵɵInjectableDeclaration<FakeMissingTranslationHandler>;
36}