Global Rank · of 600 Skills
flutter-localizing-apps AI Agent Skill
View Source: flutter/skills
SafeInstallation
npx skills add flutter/skills --skill flutter-localizing-apps 6.2K
Installs
Localizing Flutter Applications
Contents
- Core Configuration
- Defining ARB Resources
- App Integration
- Advanced Formatting
- Workflows
- Troubleshooting & Gotchas
Core Configuration
Configure the project to support code generation for localizations.
- Add required dependencies to
pubspec.yaml:
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: any
flutter:
generate: true # Required for l10n code generation- Create an
l10n.yamlfile in the project root to configure thegen-l10ntool:
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
# Optional: Set to false to generate files into lib/ instead of the synthetic package
# synthetic-package: false Defining ARB Resources
Store localized strings in Application Resource Bundle (.arb) files within the configured arb-dir.
Create the template file (e.g., lib/l10n/app_en.arb):
{
"helloWorld": "Hello World!",
"@helloWorld": {
"description": "The conventional newborn programmer greeting"
}
}Create translation files (e.g., lib/l10n/app_es.arb):
{
"helloWorld": "¡Hola Mundo!"
}App Integration
Initialize the Localizations widget by configuring the root MaterialApp or CupertinoApp.
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; // Adjust import if synthetic-package is false
return MaterialApp(
title: 'Localized App',
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [
Locale('en'), // English
Locale('es'), // Spanish
],
home: const MyHomePage(),
);Access localized values in the widget tree using the generated AppLocalizations class:
Text(AppLocalizations.of(context)!.helloWorld)Note: If using WidgetsApp instead of MaterialApp, omit GlobalMaterialLocalizations.delegate.
Advanced Formatting
Use placeholders, plurals, and selects for dynamic content. Define parameters in the @key metadata.
Placeholders
"hello": "Hello {userName}",
"@hello": {
"description": "A message with a single parameter",
"placeholders": {
"userName": {
"type": "String",
"example": "Bob"
}
}
}Plurals
"nWombats": "{count, plural, =0{no wombats} =1{1 wombat} other{{count} wombats}}",
"@nWombats": {
"placeholders": {
"count": {
"type": "num",
"format": "compact"
}
}
}Selects (Gender/Enums)
"pronoun": "{gender, select, male{he} female{she} other{they}}",
"@pronoun": {
"placeholders": {
"gender": {
"type": "String"
}
}
}Dates and Numbers
Use format and optionalParameters to leverage intl formatting.
"dateMessage": "Date: {date}",
"@dateMessage": {
"placeholders": {
"date": {
"type": "DateTime",
"format": "yMd"
}
}
}Workflows
Task Progress: Adding a New Language
Copy this checklist to track progress when introducing a new locale.
- Create a new
.arbfile in thearb-dir(e.g.,app_fr.arb). - Translate all keys present in the template
.arbfile. - Add the new
Localeto thesupportedLocaleslist inMaterialApp. - Run validator -> Execute
flutter gen-l10nto verify ARB syntax and regenerateAppLocalizations. - Review errors -> Fix any missing placeholders or malformed plural/select statements.
- If targeting iOS, complete the "Configuring iOS App Bundle" workflow.
Task Progress: Configuring iOS App Bundle
Flutter handles runtime localization, but iOS requires bundle-level configuration for the App Store and system settings.
- Open
ios/Runner.xcodeprojin Xcode. - Select the
Runnerproject in the Project Navigator. - Navigate to the
Infotab. - Under the Localizations section, click the
+button. - Add the newly supported languages/regions.
- Run validator -> Build the iOS app to ensure
project.pbxprojis correctly updated.
Troubleshooting & Gotchas
Missing Localizations Ancestor
Widgets like TextField and CupertinoTabBar require a Localizations ancestor with specific delegates (MaterialLocalizations or CupertinoLocalizations).
Error: No MaterialLocalizations found. or CupertinoTabBar requires a Localizations parent...
Fix: Ensure the widget is a descendant of MaterialApp/CupertinoApp. If building a standalone widget tree (e.g., in tests or a custom WidgetsApp), wrap the widget in a Localizations widget:
Localizations(
locale: const Locale('en', 'US'),
delegates: const [
DefaultWidgetsLocalizations.delegate,
DefaultMaterialLocalizations.delegate, // Required for TextField
DefaultCupertinoLocalizations.delegate, // Required for CupertinoTabBar
],
child: child,
)Advanced Locale Definition
If supporting languages with multiple scripts (e.g., Chinese), use Locale.fromSubtags to explicitly define the scriptCode and countryCode to prevent Flutter from resolving to an unexpected variant.
supportedLocales: const [
Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: 'CN'),
Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant', countryCode: 'TW'),
]Installs
Security Audit
View Source
flutter/skills
More from this source
Power your AI Agents with
the best open-source models.
Drop-in OpenAI-compatible API. No data leaves Europe.
Explore Inference APIGLM
GLM 5
$1.00 / $3.20
per M tokens
Kimi
Kimi K2.5
$0.60 / $2.80
per M tokens
MiniMax
MiniMax M2.5
$0.30 / $1.20
per M tokens
Qwen
Qwen3.5 122B
$0.40 / $3.00
per M tokens
How to use this skill
Install flutter-localizing-apps by running npx skills add flutter/skills --skill flutter-localizing-apps in your project directory. Run the install command above in your project directory. The skill file will be downloaded from GitHub and placed in your project.
No configuration needed. Your AI agent (Claude Code, Cursor, Windsurf, etc.) automatically detects installed skills and uses them as context when generating code.
The skill enhances your agent's understanding of flutter-localizing-apps, helping it follow established patterns, avoid common mistakes, and produce production-ready output.
What you get
Skills are plain-text instruction files — not executable code. They encode expert knowledge about frameworks, languages, or tools that your AI agent reads to improve its output. This means zero runtime overhead, no dependency conflicts, and full transparency: you can read and review every instruction before installing.
Compatibility
This skill works with any AI coding agent that supports the skills.sh format, including Claude Code (Anthropic), Cursor, Windsurf, Cline, Aider, and other tools that read project-level context files. Skills are framework-agnostic at the transport level — the content inside determines which language or framework it applies to.
Chat with 100+ AI Models in one App.
Use Claude, ChatGPT, Gemini alongside with EU-Hosted Models like Deepseek, GLM-5, Kimi K2.5 and many more.