@jsverse/transloco
Version:
The internationalization (i18n) library for Angular
45 lines (44 loc) • 1.29 kB
TypeScript
import { HashMap } from './utils/type.utils';
export interface LoadedEvent {
type: 'translationLoadSuccess';
wasFailure: boolean;
payload: {
scope: string | null;
langName: string;
};
}
export interface FailedEvent {
type: 'translationLoadFailure';
payload: LoadedEvent['payload'];
}
export interface LangChangedEvent {
type: 'langChanged';
payload: LoadedEvent['payload'];
}
export type TranslocoEvents = LoadedEvent | FailedEvent | LangChangedEvent;
export type Translation = HashMap;
export type TranslateParams = string | string[];
export type TranslateObjectParams = TranslateParams | HashMap | Map<string, HashMap>;
export interface LangDefinition {
id: string;
label: string;
}
export type AvailableLangs = string[] | LangDefinition[];
export interface SetTranslationOptions {
lang?: string;
merge?: boolean;
emitChange?: boolean;
}
export interface ProviderScope {
scope: string;
loader?: InlineLoader;
alias?: string;
}
export type TranslocoScope = ProviderScope | string | undefined;
export type InlineLoader = HashMap<() => Promise<Translation>>;
export interface LoadOptions {
fallbackLangs?: string[] | null;
/** @internal */
failedCounter?: number;
inlineLoader?: InlineLoader;
}