https://github.com/tempo-riz/flutter-extract-to-arb-vscode
VS Code Extension to Extract and auto-translate Flutter text into ARB localization files. Skip the painful part !
https://github.com/tempo-riz/flutter-extract-to-arb-vscode
arb dart deepl extract flutter internationalization l10n translation
Last synced: 8 months ago
JSON representation
VS Code Extension to Extract and auto-translate Flutter text into ARB localization files. Skip the painful part !
- Host: GitHub
- URL: https://github.com/tempo-riz/flutter-extract-to-arb-vscode
- Owner: tempo-riz
- Created: 2025-06-19T09:52:01.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-19T10:18:56.000Z (10 months ago)
- Last Synced: 2025-10-20T22:53:12.452Z (8 months ago)
- Topics: arb, dart, deepl, extract, flutter, internationalization, l10n, translation
- Homepage: https://marketplace.visualstudio.com/items?itemName=ZealousFoundry.flutter-extract-to-arb
- Size: 2.83 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Flutter Extract to ARB
[](https://marketplace.visualstudio.com/items?itemName=zealousFoundry.flutter-extract-to-arb)
[](https://marketplace.visualstudio.com/items?itemName=zealousFoundry.flutter-extract-to-arb)
[](https://open-vsx.org/extension/ZealousFoundry/flutter-extract-to-arb)
## ๐ Links
Download the extension from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=zealousFoundry.flutter-extract-to-arb) or the [Open VSX Registry](https://open-vsx.org/extension/ZealousFoundry/flutter-extract-to-arb)
If you want to add a feature or file a bug, please open an issue on the [GitHub repository](https://github.com/tempo-riz/flutter-extract-to-arb-vscode)
## ๐ก Code Action
**Extract String to ARB** : Right-click a string (or quick fix it with `โ.` / `Ctrl+.`) and select "Extract String to ARB".

## ๐ Getting Started (Auto Setup)
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`, `pubspec.yaml` and `arb` files.

## โก๏ธ Commands (Premium Features)
๐ *Premium only*: Requires a valid license key. [Buy one for $9.90 โ](https://zealousfoundry.lemonsqueezy.com/buy/ce399620-be05-4078-b75d-a2a52e32888f "Purchase a license to unlock premium features")
Access from the Command Palette (`โงโP` / `Ctrl+Shift+P`):
- **Extract Texts (Current File)** : Extracts all `Text()` widget strings in the current Dart file to your ARB files.
- **Extract Texts (Project)** : Extracts all `Text()` widget strings from the `lib/` folder to your 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](https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization#configuring-the-l10n-yaml-file)
The extension also supports additional options:
### Extension-specific `l10n.yaml` options (with defaults)
```yaml
# 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 a suggested key name, 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: ""
# Explicitly set source language for google trad fallback
source-language: ""
```
For translation to work, you need to add your Deepl API key in vscode settings.json file (`โงโP` / `Ctrl+Shift+P` โ `Preferences: Open User Settings (JSON)`):
`"flutter.deeplApiKey": "your-key",`
You can get a generous free API key [here](https://www.deepl.com/en/pro#developer)
Finally, make sure `generate: true` is set in your `pubspec.yaml`:
```yaml
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:
```dart
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](https://github.com/sponsors/tempo-riz). Thank you! :)