
🔗 Links
Download the extension from the Visual Studio Marketplace or the Open VSX Registry
If you want to add a feature or file a bug, please open an issue on the GitHub repository
💡 Code Action
Extract String to ARB
Right-click a string (or quick fix it with ⌘.
/ Ctrl+.
) and select "Extract String to ARB".
🛠️ Setup Command
Access from the Command Palette (⇧⌘P
/ Ctrl+Shift+P
):
Setup Localization for Project :
Sets up all necessary files for localization in your Flutter project, including l10n.yaml
, intl.dart
, and arb
files.
⚡ Manual Setup (I recommend using the setup command instead)
You should already have a l10n.yaml
file in your project. If not, create one.
This extension uses Flutter's official options for internationalization. See Flutter's i18n docs
The extension also supports additional options:
Extension-specific l10n.yaml
options (with defaults)
# Enable translation (via DeepL)
translate: true
# Auto-run flutter gen-l10n after extraction
generate: true
# Key prefix for translations
key-prefix: AppLocalizations.of(context)!.
# Generate key name
# "ask" = prompt with pre-filled text, true = infer from text, false = prompt manually
auto-name-key: true
# Language to use for key name generation
key-name-language: en
# Import line to insert if needed
import-line: ""
For the translation feature to work, you need to add your Deepl API key in vscode settings.json file:
"flutter.deeplApiKey": "your-key",
You can get a generous free API key here
finally set the generate option to true in your pubspec.yaml
file:
flutter:
generate: true # <---
And that's it! You're ready to go 🚀
😎 Pro tips
You can define an extension getter to access your translations more concisely:
extension ContextExt on BuildContext {
AppLocalizations get t => AppLocalizations.of(this);
}
// then instead of this
Text(AppLocalizations.of(context).yourKey)
// use it like this:
Text(context.t.yourKey)
Don't forget to update the key-prefix
& import-line
options in l10n.yaml ;)
☕ Support
If you'd like to support this project, consider contributing here. Thank you! :)