import { D as Detector, a as Detections } from './types-Do46zjmN.js'; import { Cookie, CookieAttributes } from './detectors/cookie.js'; import { HtmlTag } from './detectors/html-tag.js'; import { LocalStorage } from './detectors/local-storage.js'; import { Navigator } from './detectors/navigator.js'; import { Path } from './detectors/path.js'; import { QueryString } from './detectors/query-string.js'; import { SessionStorage } from './detectors/session-storage.js'; import { LogLevel } from './logger.js'; type ResolveDetectorName = T['name']; type ResolveDetectorLookup = Parameters[0]['lookup']; interface I18nAllyClientOptions { /** * @description * Specify language to use * * 指定当前使用的语言 */ lng?: string; /** * @description * Specify languages to use * * 指定当前使用的语言列表。默认从vite插件中获取 */ lngs?: string[]; /** * @description * Namespaces to load * * 指定当前使用的命名空间列表 */ ns?: string[]; /** * @description * If no resource for current language, fallback to `fallbackLng` * * 如果当前语言没有资源,则回退到`fallbackLng` */ fallbackLng: string; /** * @description * Language will be lowercased eg. en-US --> en-us * * 是否将语言转换为小写字母 * @default false */ lowerCaseLng?: boolean; /** * logLevel * @description * Log level for i18n-ally * * @default 'log' */ logLevel?: LogLevel; /** * @description * Before i18n-ally is initialized * * i18n-ally初始化之前的回调 */ onBeforeInit?: (current: { lng: string; ns: string[]; }, all: { lngs: string[]; ns: { [lng: string]: string[]; }; }) => Promise | void; /** * @description * i18n-ally initialized * * i18n-ally初始化完成的回调 */ onInited?: (current: { lng: string; ns: string[]; }, all: { lngs: string[]; ns: { [lng: string]: string[]; }; }) => Promise | void; /** * @description * resources loaded callback * * i18n 资源加载完成的回调 */ onResourceLoaded?: (resources: { [key in string]: string; }, current: { lng: string; ns: string | undefined; }) => Promise | void; /** * @description * Detect and cache user language on html tag / querystring / cookie / localStorage / sessionStorage etc. * * Like `i18next-browser-languagedetector` * * The order of detection determines the priority of language detection. The earlier it appears, the higher the priority. * * 探测和缓存用户语言的方式,支持html标签、查询字符串、cookie、本地存储、会话存储等 * * 和`i18next-browser-languagedetector`类似 * 数组顺序决定了语言探测的优先级,越前的优先级越高 */ detection?: Detections<{ detect: ResolveDetectorName; lookup?: ResolveDetectorLookup; cache?: boolean; } | { detect: ResolveDetectorName; lookup?: ResolveDetectorLookup; cache?: boolean; } | { detect: ResolveDetectorName; lookup?: ResolveDetectorLookup; cache?: boolean; attributes?: CookieAttributes; } | { detect: ResolveDetectorName; lookup?: ResolveDetectorLookup; cache?: boolean; } | { detect: ResolveDetectorName; lookup?: ResolveDetectorLookup; cache?: boolean; } | { detect: ResolveDetectorName; } | { detect: ResolveDetectorName; /** * @description * The path index to get language * * 路径中获取语言的索引 * * @example * '/en-US/...' => 0 * '/prefix/en-US' => 1 */ lookup?: ResolveDetectorLookup; cache?: boolean; }, D extends Detector[] ? { detect: ResolveDetectorName; lookup?: ResolveDetectorLookup; cache?: boolean; } : undefined, D>[]; /** * @description * Custom detectors * * 自定义探测器 */ customDetectors?: D; } export type { I18nAllyClientOptions };