airglot 0.2.0
airglot: ^0.2.0 copied to clipboard
Command-line client for Airglot: sync a Flutter app's ARB template and pull published translation releases into the build.
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] |
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] |
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. |
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
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.