ngx-translate-cache
Version:
ngx-translate extension to facilitate language cache.
38 lines (37 loc) • 1.51 kB
TypeScript
import { InjectionToken, Provider } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import * as i0 from "@angular/core";
export type CacheMechanismType = 'LocalStorage' | 'Cookie';
export declare namespace CacheMechanism {
const LocalStorage: CacheMechanismType;
const Cookie: CacheMechanismType;
}
export declare const CACHE_NAME: InjectionToken<string>;
export declare const CACHE_MECHANISM: InjectionToken<string>;
export declare const COOKIE_EXPIRY: InjectionToken<string>;
export declare const COOKIE_ATTRIBUTES: InjectionToken<string>;
export interface TranslateCacheConfig {
cacheService: Provider;
cacheName?: string;
cacheMechanism?: CacheMechanismType;
cookieExpiry?: number;
cookieAttributes?: string;
}
export declare class TranslateCacheSettings {
cacheName: string;
cacheMechanism: string;
cookieExpiry: number;
cookieAttributes: string;
constructor(cacheName: string, cacheMechanism: string, cookieExpiry: number, cookieAttributes: string);
static ɵfac: i0.ɵɵFactoryDeclaration<TranslateCacheSettings, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<TranslateCacheSettings>;
}
export declare class TranslateCacheService {
private translateService;
private translateCacheSettings;
constructor(translateService: TranslateService, translateCacheSettings: TranslateCacheSettings);
init(): void;
getCachedLanguage(): string;
private cacheWithLocalStorage;
private cacheWithCookies;
}