Flutter
verba_translations is one package with two jobs: a CLI that syncs
your ARB files with Verba, and an optional runtime for over-the-air updates. It works with the standard
flutter gen-l10n.
1. Install
flutter pub add verba_translations
pubspec.yaml:
dependencies:
flutter_localizations:
sdk: flutter
intl: any
flutter:
generate: true
2. Configure — verba.yaml next to pubspec.yaml
project: your-project-slug
download_token: <read-token> # fetch, OTA
upload_token: <write-token> # push
# server: https://… # self-hosted Verba
# locales: [en, ro] # default: the project's locales in Verba
Add verba.yaml to .gitignore when it holds tokens. On CI use VERBA_TOKEN / VERBA_WRITE_TOKEN.
3. Sync
dart run verba_translations && flutter run
With a write token the CLI pushes first — keys that exist only in your ARB files are created in Verba, including
whole-message ICU plurals and each @key.description as context for translators — then fetches the translations
back. File names, the ARB folder and escaping follow your l10n.yaml.
Fetch keeps the template's metadata — descriptions, placeholder types (int, DateTime…), format, example and
placeholder order — so gen-l10n generates exactly the same methods before and after a sync.
- push only:
dart run verba_translations --push - fetch without pushing:
--no-push
4. Over-the-air updates (optional)
// main.dart — the read token comes from --dart-define=VERBA_TOKEN=…
await VerbaOta.start(project: 'your-project-slug');
runApp(const VerbaScope(child: MyApp()));
// in a widget — Verba first, compiled gen-l10n text as fallback
final l = AppLocalizations.of(context)!;
Text(VerbaOta.text(context, 'greeting', {'name': user}) ?? l.greeting(user));
flutter run --dart-define=VERBA_TOKEN=<read-token>
The app starts with the last downloaded texts (cached), refreshes in the background with ETags (304 when nothing
changed) and again when it returns to the foreground.