TranslationOptions

该类型从 @ai-i18n/vite 导出,并用于 virtual:ai-i18nt() 签名:

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

定义

interface TranslationOptions {
  comment?: string;
}

字段

字段类型必填作用
commentstring向翻译器说明文案的业务语境。

comment 必须能在构建期确定。插件会去除首尾空白;非空 comment 会参与消息身份与 Translation Memory。相同原文使用不同的 comment 时属于不同翻译单元,不会共享译文。

t('保存', { comment: '按钮' });
t('保存', { comment: '文件状态' });

模型只翻译 source,comment 只用于理解语境,不会进入最终译文。