翻译

翻译 Mozilla Fluent .ftl 文件

Fluent 消息可以包含变量、术语引用和整个选择表达式。KAERIS 会翻译每个文本部分并保留其周围的结构,然后检查变量和术语引用。

KAERIS 翻译了此页面,并通过回译检查了每一行。尚未经过母语人士审阅。 英文原文

Fluent 文件构建方式

消息格式为 id = text,包含 { $name } 变量、{ -brand-name } 术语引用、属性(.title)以及带有 [one] 变体和 * 默认值的选择表达式。注释以 # 开头。

源文件en.ftl
# Shown on the home screen
welcome = Welcome back, { $name }!
emails =
    { $count ->
        [one] You have { $count } new email.
       *[other] You have { $count } new emails.
    }
-brand-name = Firefox
about = About { -brand-name }

Fluent 翻译注意事项

实际运行:翻译为德语并进行检查

实际运行,27 October 2026,未手动编辑任何内容:kaeris translate en.ftl --langs de,使用 kaeris 0.2.35,耗时 2.1 秒,模型 google/gemini-2.5-flash-lite,免费套餐默认。下方是它生成的德语文件以及 kaeris check 的相关说明。

德语结果de.ftl
# Shown on the home screen
welcome = Willkommen zurück, { $name }!
emails =
    { $count ->
        [one] Sie haben { $count } neue E-Mail.
       *[other] Sie haben { $count } neue E-Mails.
    }
-brand-name = Firefox
about = Über { -brand-name }
kaeris 检查exit code 0
$ kaeris check --source en.ftl --langs de
✓ de: complete & placeholder-safe
✓ all locales complete & placeholder-safe

KAERIS 的处理方式

分三步运行

  1. 安装 CLI

    运行 pip install kaeris。

  2. 翻译文件

    运行 kaeris translate locales/en/app.ftl --langs de,ja。

  3. 检查结果

    将源文件和翻译后的 .ftl 文件上传到免费检查页面。

pip install kaeris
kaeris translate locales/en/app.ftl --langs de,ja --verify

问题

是否支持选择表达式?

是的。每个变体都会被单独翻译,并且结构会被写回。

像 -brand-name 这样的术语呢?

它们是独立的条目,会与源进行比较;遗漏它们的翻译将被报告为缺失键。

免费吗?

是的,无需账户:每个文件 10,000 个字符,每次运行最多 8 种语言。免费的 API 密钥可将文件限制提高到 50,000 个字符。一次性付费 79 美元,使用您自己的 OpenRouter 密钥;月度套餐起价为 19 美元。价格

我可以在终端或 CI 中运行它吗?

是的。pip install kaeris,然后 kaeris translate locales/en/app.ftl --langs de,ja。GitHub Action 在拉取请求中运行相同的翻译。 CLI 文档 · GitHub Action

继续

CLI 参考 · 检查参考 · 在浏览器中翻译 · 免费检查 · 格式转换 · 伪本地化

其他格式:JSON · YAML · .po · ARB · XLIFF · .strings · .xcstrings · .properties · .resx · CSV · Markdown · Android XML