Symfony Translation Shortcut
Quick keyboard shortcut to add translation keys to Symfony YAML files and auto-replace with Twig functions.
Features
- Keyboard shortcut:
Ctrl+Alt+I to launch command
- Automatic selection: Gets selected text from editor
- YAML management: Adds keys with proper indentation and hierarchy
- Multi-language support: Updates multiple translation files simultaneously
- Twig integration: Automatically replaces text with Twig translation function
Usage
- Select text to translate in the editor
- Press
Ctrl+Alt+I or run command "Add Symfony Translation Key"
- Enter i18n key (ex:
homepage.greeting )
- Key and value are automatically added to YAML files and text is replaced with Twig function
Configuration
The extension automatically creates .vscode/settings.json with default configuration on first use if it doesn't exist.
Manual configuration (optional) - Multi-language support:
{
"symfonyTranslationShortcut.translationFilePath": {
"fr": "${workspaceFolder}/translations/app.fr.yaml",
"en": "${workspaceFolder}/translations/app.en.yaml"
}
}
The extension automatically adds the same translation key to all configured files.
Example Usage
Select text to translate in your Twig template:
<h1>Welcome to our website</h1>
Press Ctrl+Alt+I
Enter translation key (ex: homepage.welcome )
Result:
Installation
Download from Releases
- Go to Releases
- Download the latest
symfony-i18n-helper-x.x.x.vsix file
- Install via VS Code:
code --install-extension symfony-translation-shortcut-0.2.2.vsix
Contributing
See CHANGELOG.md for version history and changes.
License
This extension is released under the MIT License.
| |