Problems developers face when localizing Flutter apps—and how IntlPull helps.
Multiple files to configure: l10n.yaml, pubspec.yaml, LocalizationsDelegate. Initial setup is verbose.
ARB is less common than JSON. Fewer translation tools support it natively.
Must run flutter gen-l10n after ARB changes. Easy to forget during development.
Why flutter_localizations is a great choice for Flutter localization.
Generate type-safe Dart code from ARB files. Autocomplete for message IDs.
vs string keys
Application Resource Bundle format. ICU MessageFormat syntax. Industry standard.
vs custom formats
Localized Material widgets out of the box. DatePicker, TimePicker in user's language.
vs manual widget localization
Automatic right-to-left layout for Arabic, Hebrew. Directionality widget included.
vs manual RTL handling
Full ICU syntax. Handle complex pluralization rules across languages.
vs simple interpolation
Translation changes hot reload instantly during development.
vs rebuild required
Get flutter_localizations running in your Flutter project.
Update pubspec.yaml with localization packages.
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: any
flutter:
generate: trueConfigure localization generation.
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
output-class: AppLocalizationsAdd translation files in lib/l10n.
// lib/l10n/app_en.arb
{
"@@locale": "en",
"hello": "Hello",
"@hello": {
"description": "Greeting message"
},
"itemCount": "{count, plural, =0{No items} =1{1 item} other{{count} items}}",
"@itemCount": {
"description": "Number of items",
"placeholders": {
"count": {
"type": "int"
}
}
}
}Set up localization delegates.
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: MyHomePage(),
);Access localized strings in widgets.
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return Column(
children: [
Text(l10n.hello),
Text(l10n.itemCount(5)),
],
);
}
}Connect IntlPull to manage translations professionally.
Add the CLI for translation management.
npm install -g @intlpull/cli
# Or use dart pub global activate intlpull_cliSet up the project configuration.
{
"projectId": "your-project-id",
"format": "arb",
"sourceLocale": "en",
"localesDir": "./lib/l10n",
"filePattern": "app_{locale}.arb"
}Push source and pull translations.
# Push English source
intlpull push --source ./lib/l10n/app_en.arb --format arb
# Pull all translations
intlpull pull --format arb --output ./lib/l10nRun code generation after pulling.
flutter gen-l10n