Skip to content

ARB & gen-l10n

Flutter ARB Translation & gen-l10n

Find ARB files, translate with your product context, and compile the downloaded wording with Flutter's localization generator.

TransLocale documentation · Updated September 17, 2026 · Markdown quick start

New to TransLocale? Follow the screenshot walkthrough to create a project, add keys and translations, review wording, and get credentials. Use this guide’s message format and catalog names for your app. Your project ID is under Project settings → Credentials.

1. Install

Run this from your application directory.

flutter pub add --dev translocale_flutter:^0.3.2

Upgrading from 0.0.1? Read the migration notes. The current package provides ARB tooling, reviewed catalog sync, and optional OTA adapter generation.

2. Connect your project

Create a cloud project and replace PROJECT_UUID with its ID. The source and target languages must match your local configuration. Adjust the example locales to your project.

dart run translocale_flutter:translocale discover
dart run translocale_flutter:translocale init --api https://translocale.io --project PROJECT_UUID --locales en,fr,ar

Approve translation access in the browser:

dart run translocale_flutter:translocale login --scope translate

Sign-in is shared with your other TransLocale tools for this project. Keep credentials in developer tooling or CI. Your deployed app reads its own translation files.

3. Wire up your app

Configure Flutter localization in pubspec.yaml and l10n.yaml first. Setup reads those files and creates translocale.flutter.json without replacing catalogs. The check command runs flutter gen-l10n. Use the generated localizations in your widgets; the Dart tooling stays a development dependency.

4. Translate, review, and download

Inspect the plan before running translate. The example caps the job at 1,000 source characters across its target languages. Waiting stops after two minutes; a timeout leaves the job running.

dart run translocale_flutter:translocale plan
dart run translocale_flutter:translocale translate --max-characters 1000 --wait
dart run translocale_flutter:translocale pull --job JOB_UUID --locale fr --revision 1
dart run translocale_flutter:translocale check

Replace JOB_UUID with the completed job ID. Before pulling revision 1, save that revision in the dashboard and review its wording. Choose the exact saved revision you want to ship, then repeat pull for each target locale. Revision 0 is the original generated output.

Normal application builds use saved catalogs and make no paid translation requests.

Already have translations?

The package discovers existing ARB catalogs from l10n.yaml. A pull refuses to replace an existing target: add --out candidates/fr.arb, review the candidate, and merge it manually. Use sync to preview a three-way merge against a recorded baseline, then apply its reviewed plan hash. Configured pulls record a baseline; candidate downloads leave it unchanged. Source metadata and the job's source snapshot must match before a download is accepted.

Generate Flutter localizations from ARB files

Run flutter gen-l10n from your Flutter app directory after configuring its ARB input and Dart output. Merge the following entries into your existing pubspec.yaml, keeping its other dependencies and Flutter settings.

pubspec.yaml localization entries
dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  intl: any
flutter:
  generate: true
l10n.yaml
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-dir: lib/generated
output-localization-file: app_localizations.dart
nullable-getter: false
use-escaping: false
required-resource-attributes: true

With this configuration, source and target files live in lib/l10n, and the generated API lives in lib/generated/app_localizations.dart. Keep use-escaping false for the TransLocale Flutter package's supported ARB import workflow.

lib/l10n/app_en.arb
{
  "@@locale": "en",
  "items": "{count, plural, =0 {Your cart is empty} =1 {One item} other {{count} items}}",
  "@items": {
    "description": "Number of items in the cart.",
    "placeholders": {
      "count": {
        "type": "int",
        "example": "3"
      }
    }
  }
}
lib/l10n/app_fr.arb
{
  "@@locale": "fr",
  "items": "{count, plural, =0 {Votre panier est vide} =1 {Un article} other {{count} articles}}",
  "@items": {
    "description": "Number of items in the cart.",
    "placeholders": {
      "count": {
        "type": "int",
        "example": "3"
      }
    }
  }
}
Resolve packages and generate Dart
flutter pub get
flutter gen-l10n

Import lib/generated/app_localizations.dart from your app and configure MaterialApp with AppLocalizations.localizationsDelegates and AppLocalizations.supportedLocales. In a widget below MaterialApp, Text(AppLocalizations.of(context).items(3)) displays “3 items” in English or “3 articles” in French. nullable-getter: false makes the accessor non-nullable.

Troubleshoot ARB plurals and generation errors

The count parameter has int metadata and an other fallback. The =0 and =1 selectors handle those exact values; {count} inside other inserts the quantity. Keep the same message key, parameter name and compatible metadata in the target catalog.

If generation cannot find the template, check arb-dir and template-arb-file against the actual source path. If generated imports fail, check output-dir and import that local output file. If a plural fails to parse, check its braces and other branch, then run the generator again.

Check an initialized TransLocale Flutter project
dart run translocale_flutter:translocale check

The package check runs flutter gen-l10n. It can regenerate local Dart output, but it does not start a translation job. To compare the ARB source and target before generation, use the generic CLI check as well.

Compare existing ARB catalogs
npx translocale check --source lib/l10n/app_en.arb --target lib/l10n/app_fr.arb --format arb

Choose Flutter ARB in the browser checker to inspect one source file. A syntax check does not establish translation quality; review the wording in each supported language before release.

Current limits

  • Strict-mode ARB imports with use-escaping: true are not supported. The separate main CLI can export strict-escaped files from service ARB.
  • File writes require the POSIX link utility. macOS is verified; Windows support and native device verification remain pending.

The service accepts up to 100 KB and 200 messages per source document. Expanded target messages must also fit the adapter's limits. Read the file compatibility guide.

Check a file before connecting

Try the free source file checker to inspect message structure without an account. For assistant setup and read-only catalog checks, follow the MCP localization guide.

Over-the-air updates

Deliver approved wording without an app release. Keep your typed localization calls and bundled translations.

Available now. Publish approved wording to a preview or production channel.

Set up OTA updates

Requires Dart 3.12+, Flutter localization, and Node.js 22.16+.

1. Install the tooling and runtime

flutter pub add --dev translocale_flutter:^0.3.1
flutter pub add translocale_flutter_runtime:^0.1.3 translocale_delivery:^0.1.5
npm install --save-dev @translocale/cli@^0.6.1

2. Generate the adapter

Run from your Flutter project. Replace app.arb with the catalog name in TransLocale and choose your bundled target languages. Keep an existing manifest instead of running initialization again.

npx translocale flutter-init --catalog app.arb --targets fr,ar
npx translocale flutter-setup --file release-schema.json --catalog app.arb

Setup reads l10n.yaml and writes translocale_localizations.dart beside Flutter’s generated localizations. It does not translate or publish wording.

3. Publish a preview release

In your cloud project, approve the target translations. Open Releases, select the same catalogs and languages, and include your app’s version. Review the snapshot and publish it to Preview.

Need help with these dashboard steps? The illustrated setup guide shows project creation, catalog import, keys, review, and Preview publication. Use Flutter ARB for imports and the same catalog name across languages.

4. Connect app delivery

Sign in as a project owner. Replace PROJECT_UUID with your project ID.

npx translocale login --api https://translocale.io --project PROJECT_UUID --scope write
npx translocale flutter-connect --api https://translocale.io --project PROJECT_UUID --channel preview --file release-schema.json --out translocale.delivery.json

Keep the settings file out of source control. It contains a read-only delivery token. Authoring credentials stay in your tooling.

translocale.delivery*.json
.translocale-delivery-*.tmp

The dashboard’s Download configuration action creates translocale-delivery.json with fields such as projectId and deliveryToken. This Flutter example uses uppercase DELIVERY_* settings in translocale.delivery.json. Use flutter-connect above to generate that format; renaming the dashboard download does not convert its fields.

5. Wrap your app

Import the runtime and generated adapter. This example uses the default localization class; keep your existing theme, routes, and home widget.

import 'package:flutter/material.dart';
import 'package:translocale_flutter_runtime/translocale_flutter_runtime.dart';
import 'l10n/app_localizations.dart';
import 'l10n/translocale_localizations.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  final delivery = FlutterDelivery(
    projectId: const String.fromEnvironment('DELIVERY_PROJECT'),
    schemaHash: translocaleSchemaHash,
    token: const String.fromEnvironment('DELIVERY_TOKEN'),
    channel: const String.fromEnvironment('DELIVERY_CHANNEL'),
    apiBaseUrl: const String.fromEnvironment('DELIVERY_ORIGIN'),
  );

  runApp(TransLocaleAppLocalizationsBuilder(
    delivery: delivery,
    builder: (context, delegates) => MaterialApp(
      localizationsDelegates: delegates,
      supportedLocales: AppLocalizations.supportedLocales,
      home: const HomePage(),
    ),
  ));
}

Adjust import paths to your generated folder. Create the runtime once; the wrapper manages refresh, lifecycle, and disposal.

flutter run --dart-define-from-file=translocale.delivery.json

Android release builds need the Internet permission. Use the same settings flag with flutter build.

<uses-permission android:name="android.permission.INTERNET" />

Ship and maintain

Test updates and rollback in Preview. Promote that release to Production, then create separate settings using --channel production. A preview credential cannot read production releases.

npx translocale flutter-setup --file release-schema.json --catalog app.arb --check

New keys or changed parameters need a compatible app build. Invalid updates retain cached or bundled wording. Web translation caching requires the app assets and version metadata to remain available.

Upgrading an existing app

From 0.1.0, keep your ARB files, authoring configuration, and AppLocalizations.of(context) calls. Add the runtime and wrapper above. From legacy 0.0.1, remove its runtime initialization and delegates, restore standard Flutter localizations, and create new delivery credentials. Legacy keys and caches do not transfer.

For use-escaping: true, retain the original service ARB and pass --source path/to/original.arb to flutter-init. Regional locales also need Flutter’s base-language ARB fallback.