CLI 命令
tyndale init
Section titled “tyndale init”初始化一个新的 Tyndale 项目。会创建带有合理默认值的 tyndale.config.json。
npx tyndale inittyndale auth
Section titled “tyndale auth”配置你的 AI provider 凭证。
npx tyndale authtyndale translate
Section titled “tyndale translate”提取可翻译字符串,并为所有已配置的 locale 生成翻译。
npx tyndale translate [options]| 标志 | 说明 |
|---|---|
--locale <code> | 仅翻译指定 locale |
--force | 重新翻译所有字符串,而不仅是变更部分 |
--dry-run | 在不写入文件的情况下显示将要翻译的内容 |
--token-budget <n> | 每个 AI 批次的 Token 预算(默认:50000) |
--concurrency <n> | 最大并行翻译会话数(自动检测) |
tyndale validate
Section titled “tyndale validate”检查所有 locale 是否具有完整且格式正确的翻译。不会发起 AI 调用。
npx tyndale validate如果发现问题,将以状态码 1 退出。非常适合 CI 流水线。
tyndale extract
Section titled “tyndale extract”提取可翻译字符串而不执行翻译。适合用于审查将发送给 AI provider 的内容。
npx tyndale extracttyndale translate-docs
Section titled “tyndale translate-docs”为任何受支持框架翻译文档文件(MDX/MD)。会自动检测你的文档框架,或使用 tyndale.config.json 中的配置。
npx tyndale translate-docs [options]| 标志 | 说明 |
|---|---|
--content-dir <path> | 覆盖文档内容目录 |
--force | 重新翻译所有文档,而不仅是缺失文件 |
--concurrency <n> | 最大并行翻译会话数(自动检测) |
支持的框架:Starlight, Docusaurus, VitePress, MkDocs, Nextra。
translate-docs 会在项目根目录写入 .tyndale-docs-state.json,用于跟踪源文档哈希。请提交此文件,以便新克隆的仓库在文档未变更时可跳过重新翻译。
tyndale translate-docs setup
Section titled “tyndale translate-docs setup”检测你的文档框架,并将配置保存到 tyndale.config.json。
npx tyndale translate-docs setup扫描你的项目中的框架信号(package 依赖和配置文件),确认检测到的框架,并将 docs 部分写入你的配置。
tyndale model
Section titled “tyndale model”更改用于翻译的 AI 模型。
npx tyndale model