airglot
DocsPrivate beta
Docs menu

Flutter quickstart

Connect a Flutter app that uses flutter gen-l10n. The airglot command-line tool uploads your template ARB file to AirGlot and writes published translations back into the app before flutter gen-l10n runs.

You need an AirGlot app set to the Flutter ARB format. Create one under your project with Connect app.

1. Install the CLI

dart pub global activate airglot

2. Add airglot.yaml

Put airglot.yaml next to l10n.yaml:

app: <your app id>

Your app id is in the app's settings in AirGlot, under Integrations › CI snippet, ready to copy.

The CLI reads arb-dir and template-arb-file from l10n.yaml. When they are missing it uses Flutter's defaults, lib/l10n and app_en.arb.

When the Flutter project is in a subfolder of the repository, pass --project before the command, for example airglot --project app pull.

3. Create a token

In AirGlot, open the app's settings, then Integrations › CI tokens, and create a token. Store it as the AIRGLOT_TOKEN environment variable, or as a secret in CI. The CLI reads the token only from that variable. See Tokens for the scopes.

4. Sync the template

airglot sync

This uploads the template ARB file. It prints how many strings were added, changed or removed, and any problems as warnings. In AirGlot, the app's Overview now shows coverage, and the Languages page lets you add languages and start translating.

Run airglot sync on every push to your main branch so new strings reach AirGlot as soon as they land. CI pipelines has a ready-made workflow. You can also link the repository on GitHub instead.

5. Pull translations into the build

After a release is published in AirGlot, pull it before generating code:

airglot pull
flutter gen-l10n
flutter build ipa

airglot pull writes the release's ARB files, byte for byte, into arb-dir and records them in airglot.lock. Commit airglot.lock so each commit records the release it was built with.

pull refuses to overwrite a pulled file that was edited by hand since the last pull. Pass --force to overwrite it anyway.

Platform language lists

airglot pull also keeps each platform's list of app languages in step with the release, so the app shows up in the phone's per-app language settings:

  • iOS: CFBundleLocalizations in ios/Runner/Info.plist.
  • Android 13 and later: android/app/src/main/res/xml/locales_config.xml, which android:localeConfig in AndroidManifest.xml points at.

Only the language lists change. Pass --no-platform-lists to leave both files alone, for example when CI checks that the git tree is clean after pull.

6. Check before you merge

airglot check

check catches hand-edited pulled files, lists strings each language file is missing, and checks the template against AirGlot's sync rules without saving anything. Run it in pull request checks.

A string added to the template shows the source text in other languages until a release includes it. check lists those strings as warnings. To fail the build instead, for example in store release jobs, set missing: fail in airglot.yaml:

app: <your app id>
missing: fail

Next