@ngx-easy-i18n-js/core
Version:
The easy internationalization (i18n) library for Angular
64 lines (63 loc) • 2.35 kB
TypeScript
import { DestroyRef, InjectionToken } from '@angular/core';
import { Observable } from 'rxjs';
import { EasyI18nOptions } from 'easy-i18n-js';
import { EasyI18nLoader } from './easy-i18n.loader';
import { EasyI18nStore } from './easy-i18n.store';
import { EasyI18nMessages } from 'easy-i18n-js/lib/easy-i18n';
import * as i0 from "@angular/core";
export declare const EASY_I18N_OPTIONS: InjectionToken<EasyI18nOptions>;
export declare const NG_LOCALES: InjectionToken<{
[key: string]: any;
}>;
export declare const USE_BROWSER_LANGUAGE: InjectionToken<boolean>;
export declare const DEFAULT_LANGUAGE: InjectionToken<string>;
export declare const FALLBACK_LANGUAGE: InjectionToken<string>;
export declare const DISCOVER: InjectionToken<string>;
export type LocaleStatus = 'none' | 'loading' | 'ready';
export declare class EasyI18nService {
private options;
private ngLocales;
private useBrowserLanguage;
private defaultLanguage;
private fallbackLanguage;
private discover;
private loader;
private store;
private destroyRef;
private _localeStatusSubject;
private _localeSubject;
get localeStatus$(): Observable<LocaleStatus>;
get locale$(): Observable<string>;
private _currentLocale;
get currentLocale(): string | null;
private _ngLocale;
get ngLocale(): string | null;
private readonly otherLoaders;
private currentMsg;
constructor(options: EasyI18nOptions, ngLocales: {
[key: string]: any;
}, useBrowserLanguage: boolean, defaultLanguage: string, fallbackLanguage: string, discover: 'exact' | 'minimum' | 'all', loader: EasyI18nLoader, store: EasyI18nStore, destroyRef: DestroyRef);
initialize(): Promise<"ready">;
/**
* Get plain message by key
*
* @param key key
*/
getPlainMessage(key: string): string | EasyI18nMessages | undefined;
/**
* Change current culture
*
* @param culture new culture
* @param options
*/
registerCulture(culture: string, options?: {
reload?: boolean;
}): void;
/**
* Get browser culture
*/
getBrowserCulture(): string | null;
appendLoader(loader: EasyI18nLoader): Promise<boolean>;
static ɵfac: i0.ɵɵFactoryDeclaration<EasyI18nService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<EasyI18nService>;
}