← ClaudeAtlas

internationalizationlisted

How the Flutter app localizes — ARB files with English as the template, l10n.yaml config, the genarb → arb_translate → gen-l10n pipeline, GetMaterialApp delegate wiring, and L10n.of(context) usage. Auto-applies when editing ARB files or l10n.yaml.
virajp/ai-plugins · ★ 1 · Data & Documents · score 78
Install: claude install-skill virajp/ai-plugins
# Internationalization (l10n) English is the source of truth; every other locale is generated from it. UI code never hardcodes a string — it reads from the generated localizations. ## l10n.yaml Controls generation. ARB sources live in `lib/config/lang/`, English is the template, output goes to a directory excluded from analysis: ```yaml arb-dir: lib/config/lang # source ARB files template-arb-file: app_en.arb # English is the template output-localization-file: app_localizations.dart output-dir: lib/_shared/l10n/ # generated (excluded from analysis) nullable-getters: false preferred-supported-locales: [ en, hi, gu, mr, bn, ta, te, kn, ml, or, as, pa ] ``` `flutter.generate: true` must be set in `pubspec.yaml` for `gen-l10n` to run. ## ARB files Author only `app_en.arb`. Each key pairs with an `@key` metadata entry carrying a `description` (and `placeholders` for interpolation): ```json { "@@locale": "en", "welcomeMessage": "Welcome to the app", "@welcomeMessage": { "description": "Greeting shown on the home screen" }, "greeting": "Hello, {name}!", "@greeting": { "description": "Personalised greeting", "placeholders": { "name": { "type": "String" } } } } ``` Add new strings to `app_en.arb` only — the other locales are filled by translation (below). Always write a `description`; it's the context the translator sees. ## The pipeline Adding or changing a string runs three steps: ```text genarb # create empty app_<locale>.arb for any n