Download the extension from the Visual Studio Marketplace or the Open VSX Registry
Features
This extension adds a single code action :
Extract selected text, prompt for a key, add it to the ARB file, and translate it with DeepL for other ARB files.
Quick Setup
You should already have a l10n.yaml file in your project. If not, create one.
it uses flutter's official options for internationalization. see here
This extension extends existing options with the following options:
Options with default values
# l10n.yaml (extension specific options)
translate: true # Enable translation
generate : true # auto run flutter gen-l10n
key-prefix: AppLocalizations.of(context). # Key prefix for translation
auto-name-key: true # Generate key name based on text
key-name-language: en # Language to use for key name
import-line: "" # Import line if needed
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 free one here
And that's it! You're ready to go 🚀
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/PR on the GitHub repository
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 ;)
Changelog
You can find it here
I try to follow Semantic Versioning:
- Major: Breaking changes
- Minor: New features, but backward-compatible
- Patch: Bug fixes
Support
If you'd like to support this project, consider contributing here. Thank you! :)