UNPKG

@opra/common

Version:
29 lines (28 loc) 1.47 kB
import type { FallbackLng as I18nextFallbackLng, Formatter as I18nextFormatter, i18n, InitOptions as I18nextInitOptions, Resource as I18nextResource, TFunction as I18nextTFunction, TOptions } from '@browsery/i18next'; import * as I18next from '@browsery/i18next'; import type { Type } from 'ts-gems'; export interface BaseI18n extends Type<I18next.i18n> { } export declare namespace I18n { interface InitOptions extends I18nextInitOptions { resourceDirs?: string[]; } type DeepTranslateOptions = TOptions & { ignore?: (input: any, inst: i18n) => boolean; }; type InitCallback = I18next.Callback; type TranslateFunction = I18nextTFunction; type Formatter = I18nextFormatter; type LanguageResource = I18nextResource; type FallbackLng = I18nextFallbackLng; } export declare const BaseI18n: BaseI18n; export declare class I18n extends BaseI18n { init(callback?: I18n.InitCallback): Promise<I18n.TranslateFunction>; init(options: I18n.InitOptions, callback?: I18n.InitCallback): Promise<I18n.TranslateFunction>; deep(input: any, options?: I18n.DeepTranslateOptions): any; createInstance(options?: I18n.InitOptions, callback?: I18n.InitCallback): I18n; static createInstance(options?: I18n.InitOptions, callback?: I18n.InitCallback): I18n; protected _deepTranslate(input: any, objectStack: WeakMap<object, any>, options?: I18n.DeepTranslateOptions): any; static get defaultInstance(): I18n; }