UNPKG

obsidian-dev-utils

Version:

This is the collection of useful functions that you can use for your Obsidian plugin development

38 lines (37 loc) 1.3 kB
/** * @packageDocumentation * * This file defines the `i18n` module for `i18next`. */ import type { TFunction } from 'i18next'; import type { LiteralToPrimitiveDeep, PartialDeep } from 'type-fest'; import type { PluginTypesBase } from '../Plugin/PluginTypesBase.cjs'; /** * The default namespace. */ export declare const DEFAULT_NS = "translation"; /** * The full translations. */ export type FullTranslations<PluginTypes extends PluginTypesBase> = LiteralToPrimitiveDeep<PluginTypes['defaultTranslations']>; /** * The translations. */ export type Translations<PluginTypes extends PluginTypesBase> = PartialDeep<FullTranslations<PluginTypes>>; /** * The translations map. */ export type TranslationsMap<PluginTypes extends PluginTypesBase> = Record<string, Translations<PluginTypes>>; /** * Initializes the `i18n` module. * * @typeParam PluginTypes - The plugin types. * @param translationsMap - The translations map. * @param isAsync - Whether the initialization is asynchronous. * @returns A {@link Promise} that resolves when the `i18n` module is initialized. */ export declare function initI18N<PluginTypes extends PluginTypesBase>(translationsMap: TranslationsMap<PluginTypes>, isAsync?: boolean): Promise<void>; /** * The `t` function. */ export declare const t: TFunction;