配置
在项目根目录创建 tyndale.config.json,或运行 npx tyndale init 来生成一个。
{ "defaultLocale": "en", "locales": ["es", "fr", "ja"], "source": ["src", "app"], "extensions": [".ts", ".tsx", ".js", ".jsx"], "output": "public/_tyndale", "translate": { "tokenBudget": 50000, "concurrency": 8 }, "localeAliases": { "pt-BR": "pt" }, "dictionaries": { "include": ["src/dictionaries/*.json"], "format": "key-value" }, "pi": { "model": "claude-sonnet-4-20250514", "thinkingLevel": "low" }, "docs": { "framework": "starlight", "contentDir": "src/content/docs" }}| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
defaultLocale | string | "en" | 源语言代码 |
locales | string[] | [] | 目标 locale 代码 |
source | string[] | ["src"] | 用于扫描可翻译内容的目录 |
extensions | string[] | [".ts", ".tsx", ".js", ".jsx"] | 要包含的文件扩展名 |
output | string | "public/_tyndale" | 生成的 locale 文件输出目录 |
translate.tokenBudget | number | 50000 | 每个 AI 翻译批次的 token 预算 |
translate.concurrency | number | auto | 最大并行翻译会话数 |
localeAliases | object | {} | 将变体 locale 代码映射到规范代码 |
dictionaries.include | string[] | [] | 字典文件的 Glob 匹配模式 |
dictionaries.format | string | "key-value" | 字典文件格式 |
pi.model | string | "claude-sonnet-4-20250514" | 要使用的 AI 模型 |
pi.thinkingLevel | string | "low" | AI 思考级别 |
docs.framework | string | — | 文档框架:starlight、docusaurus、vitepress、mkdocs 或 nextra |
docs.contentDir | string | auto | 内容目录(相对于项目根目录) |
docs.extensions | string[] | auto | 覆盖文档翻译使用的文件扩展名 |