systelab-translate
Version:
The internationalization (i18n) library for Systelab
111 lines (103 loc) • 5.23 kB
TypeScript
import { Observable } from 'rxjs';
import * as i3 from '@ngx-translate/core';
import { TranslateService, TranslateLoader } from '@ngx-translate/core';
import * as i0 from '@angular/core';
import { PipeTransform } from '@angular/core';
import { DecimalPipe, Location } from '@angular/common';
import { HttpClient } from '@angular/common/http';
declare class DateUtil {
protected locale: string;
constructor(locale: string);
setLocale(lang: string): void;
formatDate(date: Date): string;
formatDateFullYear(date: Date): string;
formatTime(date: Date, withSeconds?: boolean): string;
formatDateTime(date: Date, fullYear?: boolean, withSeconds?: boolean): string;
formatMonthAndYear(date: Date): string;
formatDateAndShortMonth(date: Date): string;
getDateFrom(date: Date): Date;
getDateTo(date: Date): Date;
getDateMidDay(date: Date): Date;
getTimeFormat(withSeconds?: boolean): string;
getDateFormat(fullDateFormat?: boolean): string;
getDateFormatForDatePicker(fullDateFormat?: boolean): string;
getFirstDayOfWeek(): number;
getSeparator(locale: string): string;
parseDate(currentDateValue: string, locale?: string): Date;
private convertSystelabLocaleToDateFnsLocale;
private getLocalizedStringDateFormat;
private getLocalizedDateFormatForDatePicker;
}
declare class I18nService {
protected translateService: TranslateService;
protected locale: string;
protected staticBundles: any;
protected dateUtil: DateUtil;
constructor(translateService: TranslateService);
use(locale: string): Observable<any>;
getLocale(): string;
getCurrentLanguage(): string;
getBrowserLang(): string | undefined;
reloadLanguage(lang: string): Observable<any>;
setTranslation(locale: string, translations: Object): void;
appendTranslation(locale: string, translations: Object): void;
get(bundle: string | string[]): Observable<any>;
instant(key: string | Array<string>, interpolateParams?: any): string | any;
setStaticBundles(staticBundles: any): void;
getDateFormat(isFullYear?: boolean): string;
getDateFormatForDatePicker(isFullYear?: boolean): string;
getTimeFormat(withSeconds?: boolean): string;
formatDate(date: Date): string;
formatDateFullYear(date: Date): string;
formatTime(date: Date, withSeconds?: boolean): string;
formatDateTime(date: Date, fullYear?: boolean, withSeconds?: boolean): string;
formatMonthAndYear(date: Date): string;
formatDateAndShortMonth(date: Date): string;
getDateFrom(date: Date): Date;
getDateTo(date: Date): Date;
getDateMidDay(date: Date): Date;
getFirstDayOfWeek(): number;
parseDate(currentDateValue: string, locale?: string): Date;
formatNumber(numberToFormat: number, decimalFormat: string, applyLocale?: boolean): string;
static ɵfac: i0.ɵɵFactoryDeclaration<I18nService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<I18nService>;
}
declare class NumberFormatPipe implements PipeTransform {
protected i18nService: I18nService;
protected decimalPipe: DecimalPipe;
constructor(i18nService: I18nService, decimalPipe: DecimalPipe);
transform(value: number, precision?: string, units?: string, priorSymbol?: string, defaultSymbolWhenNull?: string, ...args: string[]): string;
static ɵfac: i0.ɵɵFactoryDeclaration<NumberFormatPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<NumberFormatPipe, "numberformat", false>;
static ɵprov: i0.ɵɵInjectableDeclaration<NumberFormatPipe>;
}
declare class GeneralTranslatePipe implements PipeTransform {
protected i18nService: I18nService;
constructor(i18nService: I18nService);
transform(query: string, ...args: string[]): any;
static ɵfac: i0.ɵɵFactoryDeclaration<GeneralTranslatePipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<GeneralTranslatePipe, "translate", false>;
static ɵprov: i0.ɵɵInjectableDeclaration<GeneralTranslatePipe>;
}
declare class LocalizableTranslateStaticLoader implements TranslateLoader {
private http;
protected location: Location;
private manifestFile;
protected prefix: string;
constructor(http: HttpClient, location: Location, manifestFile?: string);
getTranslation(locale: string): Observable<any>;
private getBundlesByManifestFile;
private getErrorBundleByLanguageAndCountry;
private getErrorBundleByLanguage;
private getMessageBundleByLanguageAndCountry;
private getMessageBundleByLanguage;
private mergeRecursive;
private getWindowPathname;
}
declare function httpLoaderFactory(http: HttpClient, location: Location): LocalizableTranslateStaticLoader;
declare class SystelabTranslateModule {
static ɵfac: i0.ɵɵFactoryDeclaration<SystelabTranslateModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<SystelabTranslateModule, [typeof GeneralTranslatePipe, typeof NumberFormatPipe], [typeof i3.TranslateModule], [typeof GeneralTranslatePipe, typeof NumberFormatPipe]>;
static ɵinj: i0.ɵɵInjectorDeclaration<SystelabTranslateModule>;
}
export { GeneralTranslatePipe, I18nService, LocalizableTranslateStaticLoader, NumberFormatPipe, SystelabTranslateModule, httpLoaderFactory };