ngx-translate-cache
Version:
ngx-translate extension to facilitate language cache.
32 lines (31 loc) • 1.24 kB
TypeScript
import { InjectionToken, Provider } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
export declare type CacheMechanism = 'LocalStorage' | 'Cookie';
export declare namespace CacheMechanism {
const LocalStorage: CacheMechanism;
const Cookie: CacheMechanism;
}
export declare const CACHE_NAME: InjectionToken<string>;
export declare const CACHE_MECHANISM: InjectionToken<string>;
export declare const COOKIE_EXPIRY: InjectionToken<string>;
export interface TranslateCacheConfig {
cacheService: Provider;
cacheName?: string;
cacheMechanism?: CacheMechanism;
cookieExpiry?: number;
}
export declare class TranslateCacheSettings {
cacheName: string;
cacheMechanism: CacheMechanism;
cookieExpiry: number;
constructor(cacheName?: string, cacheMechanism?: CacheMechanism, cookieExpiry?: number);
}
export declare class TranslateCacheService {
private translateService;
private translateCacheSettings;
constructor(translateService: TranslateService, translateCacheSettings: TranslateCacheSettings);
init(): void;
getCachedLanguage(): string;
private cacheWithLocalStorage(value?);
private cacheWithCookies(value?);
}