@singleton-i18n/angular-client
Version:
Singleton client code for Angular 10.
86 lines (85 loc) • 3.27 kB
TypeScript
import { ModuleWithProviders, PipeTransform } from '@angular/core';
import { ElementRef, AfterViewInit } from '@angular/core';
import { Observable, Subject, BehaviorSubject } from 'rxjs';
import { L10nService } from './src/services/l10n.service';
import { PatternCategories, VIPConfig } from './src/config';
export declare class MockL10nPipe implements PipeTransform {
transform(key: string, value: string): string;
}
export declare class MockL10nPipePlus implements PipeTransform {
private l10nService;
constructor(l10nService: L10nService);
transform(key: string, ...args: string[]): string;
}
export declare class MockCurrencyPipe implements PipeTransform {
transform(value: string, currency: string): string;
}
export declare class MockDatePipe implements PipeTransform {
transform(value: string, format: string): string;
}
export declare class MockNumberFormatPipe implements PipeTransform {
transform(value: any, locale?: string): string;
}
export declare class MockL10nDirective implements AfterViewInit {
private el;
private l10nService;
l10n: string;
source: string;
comment: string;
params: string[];
constructor(el: ElementRef, l10nService: L10nService);
ngAfterViewInit(): void;
}
export declare class TranslationLoader {
getTranslationByComponent(url: string): Promise<any>;
}
export declare class VIPServiceMock {
private translationLoader;
mainConfig: any;
constructor(translationLoader: TranslationLoader);
initData(initData: VIPConfig): Promise<any>;
registerComponent(config: VIPConfig, isMain?: boolean): void;
getLocale(): string;
localeData(): {};
getI18nScope(): PatternCategories[];
}
export declare class BaseDataServiceMock {
coreService: {
onTranslationChange: Subject<unknown>;
};
currentLocale: string;
current: BehaviorSubject<string>;
stream: BehaviorSubject<string>;
onLocaleChange: BehaviorSubject<string>;
}
declare type sourceBundleObject = {
[key: string]: any;
};
export declare class L10nServiceMock extends BaseDataServiceMock {
constructor();
getLongKey(config: VIPConfig, key: string): string;
translate(key: string, value: string, args?: any[], comment?: string): string;
getTranslation(key: string, source: string, args?: any[], comment?: string): Observable<string>;
getMessage(key: string, args?: any[]): string;
getSourceString(key: string): string;
registerSourceBundles(...args: sourceBundleObject[]): void;
}
export declare class I18nServiceMock extends BaseDataServiceMock {
constructor();
formatCurrency(value: any, currencyCode: string): any;
formatDate(value: any, pattern: string, timezone?: string): any;
formatNumber(value: any, locale?: string): string;
formatPercent(value: any, locale?: string): string;
getLocalizedPattern(pattern: string, locale?: string): string;
}
export declare class VIPModuleMock {
/**
* Use this method in your root module to provide the mocked VIP Service
* @static
* @returns {ModuleWithProviders}
* @memberof VIPModule
*/
static forRoot(): ModuleWithProviders<VIPModuleMock>;
}
export declare function L10nFormat(message: string, args: any[]): string;
export {};