Flutter
Keep generated AppLocalizations calls and add published translation values, runtime languages, and revision-driven rebuilds.
Requirements: Flutter 3.22+, Dart 3.4+
Package referenceOn this page
Install and generate
Terminal · install
flutter pub add rerune:^1.3.0Start with Flutter localizations and ARB resources configured in the app. Generate the native localization API first, then generate the ReRune overlay. Run both generators again when keys or signatures change.
Terminal · generate localization code
flutter gen-l10n
dart run reruneLocalize a Flutter app with a coding agent
A short walkthrough of agent-assisted onboarding, ARB migration, SDK setup, and an OTA text update.
Watch on YouTubePrepare exported ARB files when needed
Flutter gen-l10n does not accept offset:0 in an ICU plural, even though that form can appear in API-exported ARB files. SDK 1.3.0 includes prepare-arb to create a Flutter-compatible copy. Use this step when your exported catalogs contain that syntax; ordinary Flutter-compatible ARBs can keep the standard generation sequence.
Keep source ARBs directly in lib/l10n, for example lib/l10n/app_en.arb. Point Flutter at the derived lib/l10n/flutter directory with the configuration below. prepare-arb takes no options and uses these fixed source and output directories.
l10n.yaml · use prepared catalogs
arb-dir: lib/l10n/flutter
template-arb-file: app_en.arb
output-dir: lib/l10n/gen
output-localization-file: app_localizations.dart
output-class: AppLocalizationsTerminal · prepare, then generate
dart run rerune prepare-arb
flutter gen-l10n
dart run reruneInitialize the generated configuration
Dart · main.dart startup
import 'package:flutter/widgets.dart';
import 'package:rerune/rerune.dart';
import 'l10n/gen/app_localizations.rerune.g.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await ReRune.setup(
otaPublishId: '<READ_ONLY_OTA_PUBLISH_ID>',
localizations: reRuneAppLocalizationsConfig,
);
runApp(const MyApp());
}Replace the generated import path and configuration name with those produced for your localization class. MyApp is your existing application widget. Setup restores available cache; a network update can happen afterward.
Rebuild when text changes
Dart · inside the app widget build method
ReRuneBuilder(
builder: (_) => MaterialApp(
localizationsDelegates: ReRune.localizationsDelegates,
supportedLocales: ReRune.supportedLocales,
home: const HomeScreen(),
),
)HomeScreen represents your existing starting screen. ReRuneBuilder rebuilds the wrapped subtree when localization revisions change. Existing widgets otherwise retain their rendered text until another rebuild occurs. Keep your current theme, routes, and application settings on MaterialApp.
Use ReRune.supportedLocales for a language picker that includes fetched dashboard languages. Store the selected locale in app state and pass it to MaterialApp.locale when the user chooses an override.
Add a Flutter language without rebuilding
Add and publish French, discover it through ReRune.supportedLocales, and restore it from cache in the same Flutter build. Recorded with Flutter SDK 1.1.0.
Watch on YouTubeFallback and release boundaries
A missing OTA message can fall back through the source locale and then bundled Flutter localization. Keep compiled fallback resources. Adding generated getters or changing placeholder signatures requires code generation and an application release.
The 1.2 series corrects runtime plural selection. Exact selectors such as =1 compare the original count. Plural categories and # use count minus the nonnegative integer offset; explicit count arguments retain the original value. A category such as one is not an implicit exact =1 match.