Flutter Localization With Claude Code: ARB and gen-l10n

· 4 min read

Localization is cheap to build in at the start and painful to retrofit. A Flutter app that keeps every string in a resource file, from the first screen, can add a language by adding a file. One with text scattered through widgets needs a rewrite. AI helps with both the plumbing and the translation, but only if you set the rules. This page covers Flutter’s localization setup and a safe way to use Claude Code for translation. It uses Flutter’s internationalization guide, read on the day this post was written, and the rules from MobileKit’s localization stage.

The setup, from Flutter’s guide

Flutter’s documentation gives these steps for your own localized messages.

1. Add the packages:

flutter pub add flutter_localizations:"{sdk: flutter}" intl:any

2. Enable generation in pubspec.yaml, in the flutter section:

flutter:
  generate: true

3. Add l10n.yaml to the project root:

arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart

The .arb (App Resource Bundle) files go in lib/l10n, the English template is app_en.arb, and the generated class lives in app_localizations.dart.

4. Write the template and a translation:

{
  "helloWorld": "Hello World!",
  "@helloWorld": { "description": "The conventional newborn programmer greeting" }
}

and, in app_es.arb, { "helloWorld": "¡Hola Mundo!" }.

5. Generate. Run flutter pub get or flutter run and the code is generated automatically. Flutter’s guide adds that you can run flutter gen-l10n to generate the files without running the app.

6. Wire it in. Add AppLocalizations.delegate and the global delegates to the localizationsDelegates of your MaterialApp, and use the generated AppLocalizations.supportedLocales. Then read messages with AppLocalizations.of(context).

Placeholders, plurals and selects

Flutter’s guide documents ICU-style messages for text that changes. A plural looks like this:

"nWombats": "{count, plural, =0{no wombats} =1{1 wombat} other{{count} wombats}}",
"@nWombats": {
  "description": "A plural message",
  "placeholders": { "count": { "type": "num", "format": "compact" } }
}

Different languages pluralise differently, so a message with a count must carry the plural forms. This is the detail machine translation most often gets wrong, and the one to check.

Rules for the app strings

These are MobileKit’s standards:

  • Every user-facing string goes in the ARB file, with a description. Never write a text literal in a feature.
  • Use placeholders and plurals, not string concatenation. Format numbers and dates with the platform’s formatters for the user’s locale, so a translated string never hard-codes a format.
  • Describe every key. The description is what a translator, human or AI, reads to understand context.

Put the first rule in CLAUDE.md so the agent never writes a literal. See CLAUDE.md for Flutter.

Translating with Claude Code

A safe sequence:

  1. Freeze the English source. Changing it after translation means redoing every language.
  2. Write a do-not-translate list: the app name, brand-owned feature names, placeholders such as {name}, units and currency codes.
  3. Ask for one language at a time, with the ARB file and the do-not-translate list. Tell it to keep every placeholder exactly and to give plurals every form the language needs.
  4. Check mechanically: every key in the source exists in every language file, and every placeholder matches. Ask Claude Code to write a small script for this.
  5. Check visually. Run the app in the two longest languages you support, and in a right-to-left language if you target one. German and Finnish tend to run long, so clipped labels show up there first. See the mobile app QA checklist.
  6. Mark each language’s status: “draft” or “reviewed by” a named person. Machine translation alone is a draft.

Legal text is the exception. Translate it only when someone who reads that language will stand behind it. Otherwise link the English version and say so.

Translate the listing by meaning

The store listing is a different job. A literal translation of your English keywords misses how people in another country search. For each language, score the candidate phrases in that country’s store and write the name, subtitle and keyword field from what scores there, within each field’s limit. See app store keyword research. Translate screenshot captions too, and re-render them: a long caption can overflow.

A prompt sequence

  • “Set up Flutter localization using the steps in the Flutter guide, with English and Spanish. Show me the files you will change first.”
  • “Move every string in lib/features/entries into the ARB file with descriptions. Do not change behaviour. Run the analyzer after.”
  • “Translate app_en.arb into German. Keep all placeholders and plural forms exactly. List any string you are unsure about.”

Where MobileKit fits

The pack’s localization stage chooses languages per target country, freezes the source, builds the do-not-translate list, translates the app and the listing, re-renders screenshots and records each language’s review status. The setup above is the same plumbing. See Build a Flutter app with Claude Code.

Source read on the day this post was written: Flutter: internationalization.

Questions

How do I generate the localization code?

Flutter's documentation says to enable the generate flag in the flutter section of pubspec.yaml, add an l10n.yaml file, put your ARB files in the folder it names, and run flutter pub get or flutter run. You can also run flutter gen-l10n to generate the files without running the app.

Can Claude Code translate my strings?

Yes, but treat the result as a draft. Keep placeholders exactly, give plurals every form the language needs, and have a native speaker review anything that matters, especially legal text.

Should I translate the store listing too?

Yes, and by meaning, not word for word. Search terms differ by language, so score the keywords again in each country's store rather than translating the English list.

Try it on your next idea

One payment, every update to this major version, and a refund window if it is not for you. Refund policy.