# @embedpdf/plugin-i18n — ./contract I18N_DEFAULTS [VariableDeclaration]: I18N_DEFAULTS: I18nSettings ={ locale: null, fallbackLocale: 'en', locales: NO_LOCALES, loaders: NO_LOADERS, } I18nCapability [InterfaceDeclaration]: export interface I18nCapability extends SettingsApi{ t(key: string, options?: TranslateOptions): string; getTranslator(): (key: string, options?: TranslateOptions) => string; hasKey(key: string): boolean; getLocale(): string; getDirection(): TextDirection; listLocales(): readonly LocaleInfo[]; getLoadingLocale(): string | null; setLocale(code: string, options?: OperationOptions): Promise; registerLocale(locale: Locale): Unsubscribe; addTranslations(code: string, translations: TranslationDictionary): void; readonly onLocaleChanged: EventHook; readonly onLocaleLoadFailed: EventHook; } I18nConfig [TypeAliasDeclaration]: export type I18nConfig = DeepPartial; I18nSettings [InterfaceDeclaration]: export interface I18nSettings{ readonly locale: string | null; readonly fallbackLocale: string; readonly locales: readonly Locale[]; readonly loaders: Readonly>; } I18nToken [VariableDeclaration] (from packages/plugin/i18n/src/token.ts): I18nToken = createCapabilityToken('i18n', { hint: `add i18nPlugin() from '@embedpdf/plugin-i18n' to your plugins list`, } ) Locale [InterfaceDeclaration]: export interface Locale{ readonly code: string; readonly name: string; readonly direction?: TextDirection; readonly translations: TranslationDictionary; } LocaleChangedEvent [InterfaceDeclaration]: export interface LocaleChangedEvent{ readonly locale: string; readonly previousLocale: string; } LocaleInfo [InterfaceDeclaration]: export interface LocaleInfo{ readonly code: string; readonly name: string; readonly direction: TextDirection; readonly loaded: boolean; } LocaleLoadFailedEvent [InterfaceDeclaration]: export interface LocaleLoadFailedEvent{ readonly locale: string; readonly error: PluginErrorInfo; } LocaleLoader [TypeAliasDeclaration]: export type LocaleLoader = () => Promise; TextDirection [TypeAliasDeclaration]: export type TextDirection = 'ltr' | 'rtl'; TranslateOptions [InterfaceDeclaration]: export interface TranslateOptions{ params?: Readonly>; fallbackKey?: string; fallback?: string; } TranslationDictionary [InterfaceDeclaration]: export interface TranslationDictionary{ readonly [key: string]: string | TranslationDictionary; } interpolate [FunctionDeclaration]: export function interpolate( text: string, params?: Readonly>, ): string{ if (!params) return text; return text.replace(/\{ (\w+)\} /g, (match, slot: string) => params[slot] !== undefined ? String(params[slot]) : match, ); }