Auto Translator

A command-line tool that simplifies translation of an ARB template file to selected languages using Google Cloud Translate. Designed to work seamlessly with the flutter_localizations and intl packages, Flutter's preferred internationalization approach.


  • Seamless integration with flutter_localizations and intl packages.
  • Minimal Cloud Translate quota usage.
  • Works with simple & complex ARB strings, conditions, and variables.

Getting Started

1. Setup Google Cloud Translate

If you do not have a Google Cloud Project with the Cloud Translation API enabled, follow the guide here.

Then save your API key to a file in your project root called translator_key.

NOTE: This is the default location. You will see how to specify a different location later in this guide.

2. Add auto_translator to your project

Add auto_translator under dev_dependencies in pubspec.yaml

  auto_translator: "^1.0.2"

3. Setup the config files

auto_translator uses the same config file as the intl package, Flutter's recommended package for internationalizing your app, as explained here.

If you have not already created the l10n.yaml file, do so now.

arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart

    - es
    - fr
    - ja

The first three parameters are used by intl as well as auto_translator. The translator section is specific to auto_translator.

The targets parameter is required and tells auto_translator which languages to translate the template file to. Available languages can be found here.

An optional key_file parameter can be provided if you wish to store your Google Translate API key somehwere other than the default location.

:warning: DO NOT publish your key file to Github or similar VCS.

4. Run the package

Once configured, run the package from the command line.

flutter pub get
flutter pub run auto_translator

All translations will be placed in the defined location and be compatible with flutter_localizations and intl.

Additional Usage

To prevent unecessary Google Cloud Translate quota usage, messages that already exist in a target ARB file are not retranslated. You can force a translation by adding the force parameter to translator options in a message's metadata in the template file.

  "title": "New Title",
  "@title": {
    "description": "...",
    "translator": {
      "force": true

You can also tell the translator to ignore a particular message with the ignore tag.

  "doNotTranslate": "{mode, select, 0{$title1} 1{$title2} 2{$title3}}",
  "@doNotTranslate": {
    "description": "...",
    "translator": {
      "ignore": true