UNPKG

@polyipseity/obsidian-plugin-library

Version:
26 lines 1.52 kB
import { EventEmitterLite } from "./util.js"; import { type FlatNamespace, type InitOptions, type ParseKeys, type ResourceKey, type TypeOptions, type i18n } from "i18next"; import type { AsyncOrSync } from "ts-essentials"; import type { PluginContext } from "./plugin.js"; import { ResourceComponent } from "./obsidian.js"; export type I18nFormatters = Readonly<Record<string, (lng?: string, options?: unknown) => (value: unknown) => string>>; export type I18nNamespaces = Readonly<Record<string, () => AsyncOrSync<Exclude<ResourceKey, string>>>>; export type I18nResources = Readonly<Record<string, I18nNamespaces>>; export type TranslationKey = ParseKeys<readonly [ TypeOptions["defaultNS"], ...readonly Exclude<FlatNamespace, TypeOptions["defaultNS"]>[] ]>; export declare function createI18n(resources: I18nResources, formatters?: I18nFormatters, options?: Readonly<Omit<InitOptions, "ns">>): Promise<i18n>; export declare class LanguageManager extends ResourceComponent<i18n> { #private; protected readonly context: PluginContext; protected readonly autoChangeLanguage: boolean; readonly onChangeLanguage: EventEmitterLite<readonly [string]>; constructor(context: PluginContext, loader: () => AsyncOrSync<i18n>, autoChangeLanguage?: boolean); get language(): string; protected static interpretLanguage(language: string): string; changeLanguage(language: string): Promise<void>; onload(): void; protected load0(): Promise<i18n>; } //# sourceMappingURL=i18n.d.ts.map