工作 原理

深入了解 TranslateBot 如何处理您的翻译。

扫描

在您的 locale 目录中查找所有 .po 文件

比对

识别 msgstr 值为空的条目

翻译

将批量内容发送到您选择的 AI 模型

写入

使用翻译结果更新您的 .po 文件

占位符保留

Django 使用特殊占位符来表示动态值。破坏这些占位符会导致应用崩溃。TranslateBot 会完整保留它们。

输入 (msgid) Welcome back, %(username)s! You have %(count)d new messages.
输出 (msgstr - 法语) Bon retour, %(username)s ! Vous avez %(count)d nouveaux messages.
%(name)s 命名字符串
%(count)d 命名整数
%s 位置字符串
{0} 格式索引

为什么使用预览模式?

在执行完整翻译之前,使用 --dry-run 可以准确查看将要翻译的内容 - - 不会产生任何 API 调用或文件更改。

$ python manage.py translate --target-lang nl --dry-run
ℹ️ Found 3 untranslated entries
🔍 Dry run mode: skipping LLM translation

✓ Would translate 'Welcome to our platform'
✓ Would translate 'Save changes'
✓ Would translate 'Delete account'

Dry run complete: 3 entries would be translated
无 API 费用
查看需要翻译的内容
不修改文件

准备好自动化您的翻译了吗?