all files / app/utils/ TranslateLocaleMissingHandler.ts

100% Statements 11/11
100% Branches 4/4
100% Functions 3/3
100% Lines 8/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20            1× 1×     1×   24× 24×     1× 188×   1×
/* Copyright CloudLinux Zug GmbH 2010-2017 All Rights Reserved
 *
 * Licensed under CLOUD LINUX LICENSE AGREEMENT
 * http://cloudlinux.com/docs/LICENSE.TXT
 */
 
import {Injectable} from "@angular/core";
import {MissingTranslationHandler, MissingTranslationHandlerParams, TranslateParser} from "@ngx-translate/core";
 
@Injectable()
export class TranslateLocaleMissingHandler extends MissingTranslationHandler {
 
    constructor(public parser: TranslateParser) {
        super();
    }
 
    handle(params: MissingTranslationHandlerParams): string {
        return params.interpolateParams ? this.parser.interpolate(params.key, params.interpolateParams) : params.key ;
    }
}