/** * ui18n 核心包入口文件 * 导出所有公共API */ export { UI18n, createUI18n } from './ui18n'; export * from './api-config'; export * from './fallback-manager'; export * from './translation-providers'; export * from './secure-config'; export { escapeHtml, sanitizeInput, interpolateSafely, detectXSS, SecurityManager, raw, RawHTML, isRawHTML, type SecurityConfig } from './security'; export type { UI18nConfig, SupportedLanguage, AIProvider, AIProviderConfig, CacheConfig, TranslationResult, TranslationRequest, DictionaryEntry, LanguageDetectionResult, TranslationSearchResult, EnterpriseUI18nConfig, TranslationStats, SystemStatus, ServiceMode, DeveloperStats, LanguagePackStatus, StatsQuery, UI18nInstance, TranslationOptions } from './types'; import type { UI18nConfig, SupportedLanguage, AIProvider } from './types'; import { UI18n } from './ui18n'; export { LanguageDetector } from './language-detector'; export { BuiltinDictionary } from './builtin-dictionary'; export { CacheManager } from './cache-manager'; export { AITranslator } from './ai-translator'; export { normalizeLocale } from './locale-utils'; export { SEOHelper, SEOConfig } from './seo-helper'; export { ServiceModeManager } from './service-mode'; export { TranslationPipeline } from './translation-pipeline'; export { VersionControlManager } from './version-control'; export { DeveloperStatsService, DefaultCostCalculator, defaultStatsService, type StatsDataPoint, type CostCalculator } from './developer-stats-service'; export { ErrorHandler, NetworkErrorHandler, ConfigErrorDiagnostic, RuntimeErrorManager, createErrorHandler, SmartErrorType, ErrorSeverity, ERROR_MESSAGES, SOLUTION_TEMPLATES, DOCUMENTATION_URLS, type SmartError, type ErrorContext, type ConfigDiagnosticResult, type NetworkStatusResult, type ErrorHandlerConfig, type ErrorHandlerEvents } from './error-handling'; export { PhraseLibraryManager, defaultPhraseLibrary, type PhraseEntry, type PhraseLibraryConfig, type MatchResult, type PhraseLibraryStats } from './phrase-library'; export { IncrementalTranslationManager, defaultIncrementalManager, type TranslationFileStatus, type ChangeRecord, type SyncStatus, type ConflictResolution, type IncrementalSyncConfig } from './incremental-translation'; export declare const VERSION = "0.1.0"; export declare const DEFAULT_CONFIG: Partial; /** * 快速创建UI18n实例的便捷函数 * @param apiKey AI服务的API密钥 * @param provider AI提供商类型,默认为'openai' * @param options 其他配置选项 * @returns UI18n实例 */ export declare function quickSetup(apiKey?: string, provider?: AIProvider, options?: Partial): UI18n; /** * 检查浏览器环境支持情况 * @returns 支持情况报告 */ export declare function checkBrowserSupport(): { localStorage: boolean; fetch: boolean; intl: boolean; overall: boolean; }; /** * 获取推荐的语言列表(基于用户地区) * @returns 推荐的语言数组 */ export declare function getRecommendedLanguages(): SupportedLanguage[]; /** * 创建企业级UI18n实例(启用所有高级功能) * @param config 企业级配置 * @returns UI18n实例 */ export declare function createEnterpriseUI18n(config: { apiKey: string; provider?: AIProvider; serviceMode?: 'self-hosted' | 'cloud' | 'hybrid'; enableVersionControl?: boolean; }): UI18n; /** * 创建开发环境UI18n实例(适合开发和测试) * @param apiKey AI服务API密钥 * @param provider AI提供商 * @returns UI18n实例 */ export declare function createDevelopmentUI18n(apiKey?: string, provider?: AIProvider): UI18n; /** * 创建生产环境UI18n实例(性能优化) * @param config 生产环境配置 * @returns UI18n实例 */ export declare function createProductionUI18n(config: { apiKey: string; provider?: AIProvider; enableVersionControl?: boolean; }): UI18n; /** * 创建多语言切换器的辅助函数 * @param ui18n UI18n实例 * @param languages 支持的语言列表 * @returns 语言切换器对象 */ export declare function createLanguageSwitcher(ui18n: UI18n, languages: SupportedLanguage[]): { /** * 获取当前语言 */ getCurrentLanguage(): SupportedLanguage; /** * 切换语言 */ switchLanguage(language: SupportedLanguage): void; /** * 获取支持的语言列表 */ getSupportedLanguages(): SupportedLanguage[]; /** * 获取语言显示名称 */ getLanguageDisplayName(language: SupportedLanguage): string; /** * 检查是否支持某种语言 */ isLanguageSupported(language: SupportedLanguage): boolean; }; /** * 创建翻译监控器,用于监控翻译性能和成本 * @param ui18n UI18n实例 * @returns 监控器对象 */ export declare function createTranslationMonitor(ui18n: UI18n): { /** * 获取系统状态 */ getSystemStatus(): { currentLanguage: string; serviceMode: "hybrid" | "self-hosted" | "cloud"; serviceModeStats: import("./service-mode").ServiceModeStats; cacheStats: import("./cache-manager").CacheStats; builtinStats: { totalKeys: number; supportedLanguages: SupportedLanguage[]; coverage: Record; }; translationPipelineStats: import("./translation-pipeline").PipelineStats; versionControlStats: import("./version-control").VersionControlStats; supportedLanguages: string[]; }; /** * 获取成本统计 */ getCostStats(): { totalRequests: number; batchedRequests: number; mergedRequests: number; costSavings: number; batchingEfficiency: number; }; /** * 获取缓存统计 */ getCacheStats(): import("./cache-manager").CacheStats; /** * 获取翻译管道统计 */ getTranslationStats(): import("./translation-pipeline").PipelineStats; /** * 获取批量处理状态 */ getBatchStatus(): { currentOptimalBatchSize: number; pendingBatches: number; activeBatches: number; mergingBuffer: number; totalRequests: number; batchedRequests: number; mergedRequests: number; costSavings: number; averageBatchSize: number; batchingEfficiency: number; }; /** * 检查是否需要同步 */ checkForUpdates(): Promise>; /** * 创建性能报告 */ createPerformanceReport(): { timestamp: string; performance: { cacheHitRate: any; averageResponseTime: any; totalTranslations: any; }; cost: { dailySpent: number; monthlySpent: number; dailyBudgetUsage: number; monthlyBudgetUsage: number; }; system: { serviceMode: any; queueSize: number; isProcessing: boolean; }; }; }; export * from './offline-optimization'; export declare function detectLanguage(input: any): string; /** * Phase 1运行时自动翻译功能 * 极简实现:自动提取DOM + AI翻译 + localStorage缓存 */ export { extractTextsFromDOM, applyTranslations, RuntimeCache, batchTranslate, type ExtractedText, type AutoExtractConfig } from './runtime-auto'; /** * Phase 1 init配置 */ export interface RuntimeAutoConfig { cloudApiKey?: string; apiProvider?: 'openai' | 'anthropic' | 'custom'; apiEndpoint?: string; defaultLanguage?: string; autoExtract?: boolean; root?: Element | Document; ignoreSelectors?: string[]; } /** * Phase 1: 一键初始化运行时自动翻译 * * 使用方式: * ```html * * * ``` * * 功能: * 1. 自动提取页面文本 * 2. 调用AI翻译 * 3. 缓存到localStorage * 4. 应用翻译到DOM * * @param config 配置选项 * @returns UI18n实例 */ export declare function init(config?: RuntimeAutoConfig): Promise; //# sourceMappingURL=index.d.ts.map