airglot
Command-line client for Airglot. It uploads a Flutter
app's ARB template to Airglot and writes published translation releases into
the app before flutter gen-l10n.
Install
dart pub global activate airglot
Configure
Add airglot.yaml next to l10n.yaml:
app: <your app id>
# host: https://app.airglot.com
# missing: warn # or fail: see airglot check
The CLI reads arb-dir and template-arb-file from l10n.yaml and uses
Flutter's defaults (lib/l10n, app_en.arb) when they are absent.
Create a token in the app's settings in Airglot and expose it as
AIRGLOT_TOKEN. The CLI reads the token only from that variable. sync needs
a token with the Sync scope; pull needs the Export scope.
Pass --project <dir> before the command when the Flutter project is in a
subfolder of the repository, for example airglot --project app pull.
Commands
| Command | Does |
|---|---|
airglot sync [--commit <sha>] |
Uploads the template. The commit defaults to GITHUB_SHA, BITBUCKET_COMMIT or CI_COMMIT_SHA. Prints the counts and any problems as warnings. |
airglot pull [--version <v>] [--force] [--no-platform-lists] |
Writes a release's ARB files byte for byte into arb-dir and records them in airglot.lock. Pulls the latest release unless --version names one. Refuses to overwrite pulled files edited since the last pull unless --force. |
airglot check [--offline] [--missing fail|warn] |
Checks pulled files against airglot.lock, lists template strings each locale file lacks, then checks the template against Airglot's sync rules without saving anything. Skips the template check with --offline or without AIRGLOT_TOKEN. --missing fail or --missing warn overrides missing in airglot.yaml for that run. |
Commit airglot.lock so each commit records the release it compiled.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | The command failed (server error, missing release, edited files, problems) |
| 2 | Usage or configuration error (bad flags, no airglot.yaml, no AIRGLOT_TOKEN) |
In CI
Sync the template on every push to your main branch:
airglot sync
Release builds pull translations before generating code:
airglot pull
flutter gen-l10n
flutter build ipa
Platform language lists
airglot pull also keeps the system language lists in step with the release,
so the app appears in each platform's per-app language settings:
- iOS:
CFBundleLocalizationsinios/Runner/Info.plist. - Android 13+:
android/app/src/main/res/xml/locales_config.xml, whichandroid:localeConfiginAndroidManifest.xmlpoints at. An existingandroid:localeConfig="@xml/..."is kept and its resource is written.
The list is the source locale plus the locales in the pulled release, or, when
the app's platformLocales setting is allowlist, every locale on the project
allowlist as well. A platform folder the app does not have is skipped. Only the
language lists change; the rest of each file is left as it was.
Pass --no-platform-lists to leave Info.plist and AndroidManifest.xml
alone, for example when CI checks that the git tree is clean after pull.
pull warns when a locale is written in a script that is not in the app's
fontScripts, a reminder to check the app's fonts on a device
before shipping it.
Run airglot check in pull request checks to catch hand-edited pulled files and
template problems before they reach Airglot.
A string added to the template shows its template text in other languages
until a release includes it. check lists those strings as warnings; set
missing: fail in airglot.yaml to fail the build instead, for example in
store release jobs, or pass --missing fail to airglot check for one run.
--missing warn does the reverse.