import { FallbackGeneral, FallbackLanguageOption, TreeTranslationsData, OnFormatError, FetchFn, MissingTranslationHandler } from '../../types'; import { ObserverOptions, ObserverOptionsInternal } from './observerOptions'; export declare const DEFAULT_FORMAT_ERROR = "invalid"; export declare const DEFAULT_API_URL = "https://localization-platform.sit.translate.jio/projects"; export declare const DEFAULT_MISSING_TRANSLATION: MissingTranslationHandler; export type JioTranslateStaticData = { [key: string]: TreeTranslationsData | (() => Promise); }; export type JioTranslateOptionsInternal = { /** * Initial language */ language?: string; /** * JioTranslates instance url (default: 'https://localization-platform.sit.translate.jio/projects) */ apiUrl?: string; /** * Project API key (PAK) or Personal Access Token (PAT) */ apiKey?: string; /** * Project id is necessary if you are using PAT */ projectId?: number | string; /** * Used when auto detection is not available or is turned off */ defaultLanguage?: string; /** * Languages which can be used for language detection * and also limits which values can be stored */ availableLanguages?: string[]; /** * Language which is used when no translation is available for current one */ fallbackLanguage?: FallbackLanguageOption; /** * Namespaces which should be always fetched */ ns?: string[]; /** * Namespaces to be used to find translation when no explicit namespace set. */ fallbackNs?: FallbackGeneral; /** * Default namespace when no namespace defined (default: '') */ defaultNs: string; /** * These data go directly to cache or you can specify async * function which will be used to get the data. Use `:` to add namespace: * * ```ts * { * 'locale': * 'locale:namespace': * } * ``` */ staticData?: JioTranslateStaticData; /** * Switches between invisible and text observer. (Default: invisible) */ observerType: 'invisible' | 'text'; /** * Observer options object. */ observerOptions: ObserverOptionsInternal; /** * Define what to display in case of formatting error. (Default: 'invalid') */ onFormatError: OnFormatError; /** * Define what to do when translation is missing. * Is called when translation missing. * If no orEmpty or defaultValue are defined, return value is rendered. (function is called regardless) */ onTranslationMissing: MissingTranslationHandler; /** * Define custom fetch function, used for fetching the translations */ fetch: FetchFn; /** * Specify tags that will be preselected for non-existant keys. */ tagNewKeys?: string[]; dynamicScanningEnable?: boolean; }; export type JioTranslateOptions = Partial> & { observerOptions?: ObserverOptions; }; export type State = { initialOptions: JioTranslateOptionsInternal; activeNamespaces: Map; language: string | undefined; pendingLanguage: string | undefined; isInitialLoading: boolean; isRunning: boolean; }; export declare const combineOptions: (...states: (T | undefined)[]) => T; export declare function initState(options?: Partial, previousState?: State): State;