AiI18nFramework

@ai-i18n/vite 导入:

import type { AiI18nFramework } from '@ai-i18n/vite';

定义

type AiI18nFramework = 'vanilla' | 'vue' | 'react';

三种模式都提供 t()setLang()getLang()getLangs()getLangLoadState()subscribe()。框架模式决定 virtual:ai-i18n 额外提供的适配 API:

额外导出
'vanilla'
'vue'useI18n()tRef()i18nComputed()tComputed()
'react'React useI18n()

省略 AiI18nOptions.framework 时,插件根据最终 Vite 插件列表自动检测。一个 build 同时包含 Vue 与 React 插件时会报错。