搜尋套件、儲存庫與 APP 分類

套件詳情v1.1.0

arb_translate

一個命令列工具,可使用 Google Gemini 或 OpenAI ChatGPT 自動為 ARB 檔案產生遺漏的翻譯,由 LeanCode 提供。

AndroidiOSmacOSWindowsLinux
近 30 天下載
719
喜歡數
143
Pub 分數
140

安裝套件

flutter pub add arb_translate

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

arb_translate 是一個命令列工具,利用 Google Gemini 或 OpenAI ChatGPT 的 AI 模型自動產生 ARB(App Resource Bundle)檔案中遺漏的翻譯。由 LeanCode 開發,此工具透過基於現有字串提供準確的翻譯建議,簡化本地化工作流程,減少手動操作。該工具可無縫整合至跨多個平台(包括 Android、iOS、macOS、Windows 和 Linux)的 Flutter 專案中。支援即時翻譯與批次處理,非常適合需要高效管理多語言應用內容的團隊。

適用情境

  • 自動化缺失翻譯生成
  • 簡化國際化工作流程
  • 減少手動翻譯工作量
  • 支援多語言 Flutter 應用
  • 將AI驅動的翻譯整合到CI/CD流程中

主要特色

  • 透過 Google Gemini 或 OpenAI 提供的 AI 驅動翻譯
  • 用於自動化的命令列介面
  • 支援 ARB 檔案格式
  • 跨平台相容性
  • 批次處理翻譯鍵
  • 與 Flutter 專案的輕鬆整合

適合對象

  • Flutter 開發人員管理多種語言
  • 使用 ARB 進行本地化的團隊
  • 需要快速翻譯迭代的項目
  • 具有本地化需求的 CI/CD 流水線
  • 尋求AI輔助翻譯工具的開發者

使用建議

  • 需要 Google Gemini 或 OpenAI 的 API 存取權限
  • 依賴互聯網連接進行AI呼叫
  • 高用量的潛在成本
  • 翻譯品質取決於提示的準確性
  • 不是人工審查的替代品

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

arb_translate

arb_translate on pub.dev

A command-line tool for automatically generating missing translations to ARB files using Google Gemini or OpenAI ChatGPT by LeanCode

Installation

$ dart pub global activate arb_translate

Configuration

arb_translate has been designed to seamlessly integrate with Flutter apps using flutter_localizations for code generation from ARB files. Thanks to this integration, the setup process for arb_translate can be completed in just a few steps:

  1. Generate your API key. You can create your Gemini key here or your OpenAI key here

  2. Save your API token in the environment variable ARB_TRANSLATE_API_KEY or add arb-translate-api-key: {your-api-key} to l10n.yaml in your project.

  3. (Optional) Select model used for translation. To do it add arb-translate-model to l10n.yaml or use command argument --model. The default model is gemini-2.5-flash. For all available models see arb_translate --help.

  4. (Optional) Add context of your application arb-translate-context: {your-app-context} eg. "sporting goods store app"

All other required parameters match flutter_localizations parameters and will be read from l10n.yaml file. You can override them using command arguments if necessary. See arb_translate --help for more information.

Configuration without l10n.yaml

If you project doesn't include l10n.yaml configuration you have to provide configuration using environment variables and command arguments. You also have to provide:

  1. --arb-dir The directory where the template and translated ARB files are located

  2. --template-arb-file The template ARB file that will be used as the basis for translation

See arb_translate --help for more information.

Custom model configuration

You can use arb_translate with any model with an OpenAI-compatible API. To configure a custom model:

  1. Add arb-translate-custom-model: {your-model-name} to l10n.yaml or specify as command argument custom-model: {your-model-name}
  2. Add arb-translate-custom-model-provider-base-url: {your-model-url} to l10n.yaml or specify as command argument: --custom-model-provider-base-url: {your-model-url}
  3. (Optional) Set target batch size appropriately to model token count limits by adding arb-translate-batch-size: {size} to your l10n.yaml or specify as command argument batch-size: {size}. Batch size is the number of characters of ARB messages in a single batch and does not include the prompt or app context.

Usage

To generate translations, simply call arb_translate. All messages included in the template ARB file but missing from other files will be translated. To add a new locale, simply add an empty ARB file.

$ arb_translate

Or without l10n.yaml file

$ arb_translate --arb-dir...

Read more

If you want to know how we made this tool and what challenges we had, read the story.

LeanCode

Built with ☕️ by LeanCode

所屬分類

依賴

依賴清單 9 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。