跳转到主要内容

目标

创建一个 i18n.jsonc安全运行翻译规划,生成输出,并审查状态。

1. 初始化配置

hyperlocalise init
这会写入 i18n.jsonc 在您当前的目录中。

2. 配置提供者凭证

hyperlocalise 自动从读取凭据 .env.env.local 在您当前的项目目录中。导出的 shell 变量仍然具有优先权。 示例:
export OPENAI_API_KEY="your-openai-api-key"
OpenAI:
export OPENAI_API_KEY="your-openai-api-key"
Azure OpenAI:
# Example: https://<resource>.openai.azure.com/openai/v1
export AZURE_OPENAI_BASE_URL="https://<resource>.openai.azure.com/openai/v1"
export AZURE_OPENAI_API_KEY="your-azure-openai-api-key"
双子座:
export GEMINI_BASE_URL="https://generativelanguage.googleapis.com/v1beta/openai"
export GEMINI_API_KEY="your-gemini-api-key"
Anthropic:
export ANTHROPIC_BASE_URL="https://api.anthropic.com/v1"
export ANTHROPIC_API_KEY="your-anthropic-api-key"
LM 工作室:
export LM_STUDIO_BASE_URL="http://127.0.0.1:1234/v1"
export LM_STUDIO_API_KEY="lm-studio"
Ollama:
export OLLAMA_BASE_URL="http://127.0.0.1:11434/v1"
export OLLAMA_API_KEY="ollama"
Groq:
export GROQ_BASE_URL="https://api.groq.com/openai/v1"
export GROQ_API_KEY="your-groq-api-key"

3. 干燥-先运行

hyperlocalise run --config i18n.jsonc --dry-run
检查 planned_total, executable_total,以及列出的 tasks.

4. 执行生成

hyperlocalise run --config i18n.jsonc
这会写入翻译并进行更新 .hyperlocalise.lock.json。详情请参见 锁文件合约.

5. 审核状态

hyperlocalise status --config i18n.jsonc --output csv
使用 needs_review 行以识别仍需人工整理的条目。

6. 需要时评估翻译质量

hyperlocalise eval run --eval-set ./eval-set.json --output ./eval-report.json
在比较提示/配置文件/提供者选择或在推广大型翻译更新之前使用此项。

下一步