- Home
- Skills
- Madteacher
- Mad Agents Skills
- Flutter Internationalization
flutter-internationalization_skill
17
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill madteacher/mad-agents-skills --skill flutter-internationalization- SKILL.md8.9 KB
Overview
This skill is a complete guide for internationalizing Flutter apps using gen-l10n and the intl package. It shows how to configure code generation, create ARB message files, and wire localization into Material and Cupertino apps. The guide also covers number and date formatting, plural/select messages, locale overrides, and manual/custom strategies.
How this skill works
The skill explains two main approaches: gen-l10n (recommended) for automated ARB-based code generation, and the intl package for manual control. It walks through adding dependencies, creating l10n.yaml and ARB files, running flutter gen-l10n, and integrating generated delegates into MaterialApp. It also describes message types (placeholders, plurals, selects), formatting options, and advanced locale resolution and overrides.
When to use it
- Starting a new Flutter app that needs reliable localization with minimal boilerplate
- Translating an existing app to multiple languages and managing ARB files
- Formatting numbers, currency and dates according to user locales
- Supporting RTL languages and locale-specific layouts
- Implementing custom or legacy localization workflows with full control
Best practices
- Prefer gen-l10n for new projects to benefit from automated generation and safer APIs
- Add clear descriptions and placeholder metadata in ARB entries for translators
- Use placeholders and plural/select patterns instead of string concatenation
- Test every supported locale, including RTL layouts and edge-case formats
- Use format types for numbers/dates to ensure locale-aware rendering
- Keep messages short and reusable to simplify translation
Example use cases
- Add Spanish and English support using lib/l10n/app_en.arb and app_es.arb and run flutter gen-l10n
- Create parameterized greetings with placeholders and use AppLocalizations.of(context)!.greeting('Alice')
- Format currency and dates in messages using simpleCurrency or yMMMd patterns
- Temporarily force a locale for a widget with Localizations.override for previews or tests
- Implement a small app with a custom Map-based localization class for a lightweight footprint
FAQ
Use gen-l10n for most new projects because it automates ARB handling and generates type-safe APIs. Choose intl when you need manual control or are maintaining a legacy codebase.
How do I format currency and dates per locale?
Declare placeholder types and formats in your ARB entries (e.g., format: "simpleCurrency" or "yMMMd"). The generated code uses intl formatting tied to the current locale.
How can I test RTL languages?
Add RTL locales to supportedLocales, then run the app with those locales or wrap widgets with a Localizations.override to preview RTL behavior.