@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
58 lines • 2.68 kB
TypeScript
import { TranslateDirective, TranslateService } from '@ngx-translate/core';
import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
import { Subject } from 'rxjs';
import * as i0 from "@angular/core";
export declare class C8yTranslateDirective extends TranslateDirective implements AfterViewInit, OnDestroy, OnChanges {
/**
* Used to get private element property from TranslateDirective, so it doesn't throw tsErrors
*/
private get _elementRef();
/**
* Used to get private translateService property from TranslateDirective, so it doesn't throw tsErrors
*/
private get _translateService();
/**
* Used to trigger events when html is replaced by directive.
*/
htmlUpdateEvent: EventEmitter<void>;
/**
* When this directive successfully translates node, it stores its value in this property.
* Another translation will be performed only if new translation value differs from stored one.
*/
lastTranslation: string;
/**
* When this directive encounters element that is HTML, it should switch to Html mode even if
* new translated element does not contain any HTML.
*/
htmlMode: boolean;
initialValue: string;
destroy$: Subject<void>;
elementTranslated: boolean;
constructor(translateService: TranslateService, element: ElementRef, _ref: ChangeDetectorRef);
/**
* Overridden method from original directive.
* For simple text nodes, it just invokes the base method.
* For complex nodes, it builds translation key from whole inner HTML
* and replaces it with its translation.
* This prevents splitting HTML into pieces and attempting to translate each one separately
* which doesn't work, because we extract strings in whole.
*/
checkNodes(forceUpdate?: boolean, translations?: any): void;
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
ngAfterViewInit(): void;
setTranslatedStatus(status: boolean): void;
/**
* Builds lookup key from innerHTML, removes comments (that might be added by Angular) and trims it.
*/
private getLookupKey;
private isElementSimpleTextType;
private isElementInnerHtmlEmpty;
private isLookupKeyMissing;
private lookupKeyExist;
private getNewTranslation;
private updateHtmlContent;
static ɵfac: i0.ɵɵFactoryDeclaration<C8yTranslateDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<C8yTranslateDirective, "[translate],[ngx-translate]", never, {}, {}, never, never, true, never>;
}
//# sourceMappingURL=c8y-translate.directive.d.ts.map