UNPKG

@ui18n/vue

Version:

💚 Vue 3 internationalization with Composition API, auto-reactive translations, and seamless TypeScript support

98 lines (97 loc) 2.64 kB
/** * Vue浏览器专用入口点 * * 🎯 基于 .ui18n 核心哲学的浏览器优化版本 * * 特性: * - ✅ 浏览器适配器:localStorage模拟.ui18n目录 * - ✅ 自包含:内置浏览器兼容的core功能 * - ✅ 轻量级:移除Node.js专用功能 * - ✅ Vue响应式:完整支持Vue 3 Composition API */ import { App } from 'vue'; import { UI18nConfig, SupportedLanguage } from '@ui18n/core'; export * from './types'; export type { UseUI18n } from './composables'; export declare const UI18nSymbol: unique symbol; /** * Vue浏览器适配器增强配置 */ export interface VueBrowserUI18nConfig { /** * 是否自动启用.ui18n发现 * @default true */ enableUI18nDiscovery?: boolean; /** * 自定义.ui18n发现路径 * @default "/.ui18n/languages.json" */ ui18nDiscoveryPath?: string; /** * 是否启用localStorage持久化(模拟.ui18n目录) * @default true */ enablePersistence?: boolean; /** * 调试模式 * @default false */ debug?: boolean; /** * 默认语言 * @default "en" */ defaultLanguage?: string; /** * 支持的语言列表 */ supportedLanguages?: string[]; /** * 其他UI18n配置 */ ui18nConfig?: UI18nConfig; } /** * 创建浏览器优化的UI18n Vue插件 * * 自动遵循.ui18n核心哲学: * 1. 尝试从/.ui18n/languages.json发现可用语言 * 2. 使用localStorage模拟.ui18n目录进行持久化 * 3. 提供浏览器兼容的适配器 */ export declare const createBrowserUI18nPlugin: (config?: VueBrowserUI18nConfig) => { install(app: App): void; }; /** * useUI18n组合式函数(浏览器版本) */ export declare const useUI18n: () => any; /** * useTranslation组合式函数(浏览器版本) */ export declare const useTranslation: (text: string, options?: { language?: SupportedLanguage; context?: string; }) => { text: import("vue").Ref<string, string>; loading: import("vue").Ref<boolean, boolean>; error: import("vue").Ref<Error, Error>; refresh: () => Promise<void>; }; export declare function validateVueBrowserFrameworkCompliance(): { ui18nDirectory: boolean; vue3Compatibility: boolean; browserSafe: boolean; zeroConfig: boolean; persistence: boolean; autoDiscovery: boolean; recommendations: string[]; }; export declare const __BROWSER_VERSION__ = true; export declare const __FRAMEWORK_COMPLIANCE__: { ui18nCorePhilosophy: boolean; browserOptimized: boolean; vue3Compatible: boolean; zeroConfig: boolean; };