Seamless Flutter Localization with .arb Support
Translate your Flutter applications across all platforms with Lingo.dev's native support for Application Resource Bundle (.arb) files.
Quick Setup
Configure your Flutter project in three simple steps:
- Create an
i18n.json
configuration file - Define your source and target languages
- Point to your .arb files using the
[locale]
placeholder
{
"version": 1.2,
"locale": {
"source": "en",
"targets": ["es", "fr", "de"]
},
"buckets": {
"flutter": {
"include": ["lib/l10n/[locale].arb"]
}
}
}
TIP
The [locale]
placeholder automatically expands to the appropriate language code for each target language.
Understanding .arb Files
Flutter's .arb format combines simple translations with powerful metadata:
{
"helloWorld": "Hello World!",
"@helloWorld": {
"description": "The conventional newborn programmer greeting"
},
"welcomeUser": "Welcome, {username}!",
"@welcomeUser": {
"description": "A welcome message",
"placeholders": {
"username": {
"type": "String",
"example": "John Doe"
}
}
},
"itemCount": "{count, plural, =0{No items} =1{1 item} other{{count} items}}",
"@itemCount": {
"description": "A message showing the number of items",
"placeholders": {
"count": {
"type": "num",
"format": "compact"
}
}
}
}
This structure provides:
- Basic translations: Simple key-value pairs
- Contextual descriptions: Metadata for each string
- Dynamic placeholders: Variables within strings
- Pluralization rules: Different forms based on quantity
One Command Translation
Translate all your Flutter strings with a single command:
npx lingo.dev@latest i18n
This automatically:
- Processes your source .arb file
- Preserves all metadata and placeholders
- Creates or updates target language files
- Maintains the correct .arb structure
Smart Format Handling
Lingo.dev intelligently processes all aspects of .arb files:
1. Complete Structure Preservation
- Metadata: All descriptions and placeholder information remain intact
- Formatting: JSON structure and indentation are maintained
- Comments: Any JSON comments are preserved
2. Advanced Translation Features
- Placeholders: Variables like
{username}
are properly maintained - Pluralization: All quantity variations are correctly translated
- ICU Message Format: Complex message patterns are handled appropriately
Developer Best Practices
Improve Translation Quality
Add Descriptions: Always include the
description
field for contextjson"welcomeMessage": "Welcome to our app!", "@welcomeMessage": { "description": "Shown on the first screen after login" }
Provide Examples: For placeholders, include example values
json"placeholders": { "username": { "example": "JohnDoe123" } }
Optimize Your Workflow
Consistent Naming: Use predictable key patterns like
screen_element_action
Multiple Files: Split large apps into logical sections
json"flutter": { "include": [ "lib/l10n/[locale].arb", "lib/l10n/[locale]_settings.arb" ] }
Integration Testing: Verify translations with Flutter's localization testing tools
By integrating Lingo.dev into your Flutter development workflow, you maintain all the benefits of Flutter's internationalization system while gaining powerful AI-driven translation capabilities.