@hug/ngx-g11n
Version:
Angular helpers for internationalizing and localizing your application
55 lines (46 loc) • 1.39 kB
TypeScript
import { Provider, InjectionToken } from '@angular/core';
type DefaultModuleImport = Promise<{
[key: string]: unknown;
default?: unknown;
}>;
declare enum G11nDebug {
SHOW_KEYS = 0,
DUMMY_TRANSLATIONS = 1,
NO_DEBUG = 2
}
interface G11nOptions {
defaultLanguage?: string;
defaultCurrency?: string;
useNavigatorLanguage?: boolean;
loadLocaleExtra?: boolean;
useTranslations?: boolean;
translationsPath?: string;
queryParamName?: string;
storage?: Storage;
debug?: G11nDebug;
}
interface G11nFeature<T = Provider> {
providers: T[];
}
interface G11nLocale {
base: () => DefaultModuleImport;
extra?: () => DefaultModuleImport;
datefns?: () => DefaultModuleImport;
translationFilename?: string;
}
/**
* @internal
*/
declare const DEFAULT_OPTIONS: G11nOptions;
declare const currentLanguage: () => string;
declare const setLanguage: (value: string) => void;
/**
* Initializes G11N providers.
* @internal
* @returns An array of Angular providers for G11N initialization.
*/
declare const init: () => Provider[];
declare const LOCALES: InjectionToken<Record<string, G11nLocale>>;
declare const G11N_OPTIONS: InjectionToken<G11nOptions>;
export { DEFAULT_OPTIONS, G11N_OPTIONS, G11nDebug, LOCALES, currentLanguage, init, setLanguage };
export type { DefaultModuleImport, G11nFeature, G11nLocale, G11nOptions };