A powerful translation extension for Zed editor that brings real-time text translation directly into your development environment.
- 🌍 Multiple Language Support: Translate text between various languages including English, Chinese, Japanese, Korean, French, German, Spanish, Russian, Italian, and Portuguese
- ⚡ Quick Access: Use simple slash commands to translate text instantly
- 🎯 Smart Language Detection: Automatically detects source language
- 💡 Developer Friendly: Designed specifically for developers who work with multilingual codebases and documentation
- Clone this repository:
git clone https://github.com/your-username/zed-extension-translate.git
cd zed-extension-translate- In Zed, open the Extensions view (
Cmd+Shift+XorCtrl+Shift+X) - Click on "Install Dev Extension"
- Select the directory containing this extension
Once published, you can install it directly from Zed:
- Open Extensions view (
Cmd+Shift+XorCtrl+Shift+X) - Search for "Translate"
- Click Install
This extension provides three slash commands for quick translation:
Translate text to any supported language.
Examples:
/translate zh Hello World
→ Translates "Hello World" to Chinese
/translate ja Good morning
→ Translates "Good morning" to Japanese
/translate en 你好世界
→ Translates "你好世界" to English
Quick command to translate text to Chinese.
Example:
/translate-zh Hello, how are you?
→ 你好,你好吗?
Quick command to translate text to English.
Example:
/translate-en 今天天气真好
→ The weather is really nice today
To use translation commands more efficiently, configure keyboard shortcuts in your Zed keymap.
- Open command palette:
Cmd/Ctrl+Shift+P - Type "zed: open keymap" and press Enter
- Add the following configuration to your
keymap.json:
[
{
"context": "Editor",
"bindings": {
// Open AI panel to use slash commands
"ctrl-shift-t": "workspace::ToggleRightDock",
// Add selected text to AI context
"ctrl-alt-t": "agent::AddSelectionToThread"
}
}
]- Select text you want to translate
- Press
Ctrl+Shift+Tto open AI panel - Type
/translate-zhor/translate-en - Press
Enterto get translation
For more detailed usage instructions, see USAGE_GUIDE.md.
- English (en)
- Chinese (zh, zh-CN)
- Japanese (ja)
- Korean (ko)
- French (fr)
- German (de)
- Spanish (es)
- Russian (ru)
- Italian (it)
- Portuguese (pt)
- 📝 Documentation Translation: Quickly understand code comments in different languages
- 🔍 Code Review: Translate commit messages and pull request descriptions
- 📚 Learning: Understand foreign language tutorials and documentation
- 🌏 International Teams: Communicate effectively with team members worldwide
- 💬 Quick Reference: Translate error messages and stack traces
- Rust installed via rustup
- Zed editor
cargo build --release- Start Zed in foreground mode for detailed logs:
zed --foreground- Install the extension as a dev extension (see Installation section)
zed-extension-translate/
├── extension.toml # Extension metadata
├── Cargo.toml # Rust dependencies
├── src/
│ └── lib.rs # Main extension code
├── slash_commands/ # Slash command definitions
│ ├── translate.toml
│ ├── translate-zh.toml
│ └── translate-en.toml
├── keymap-example.json # Keyboard shortcuts example
├── USAGE_GUIDE.md # Detailed usage guide
├── README.md # This file
└── LICENSE # MIT License
- Add more translation engines (DeepL, OpenAI, etc.)
- Implement caching for faster repeated translations
- Add text-to-speech functionality
- Support for custom API keys
- Translation history and wordbook
- Batch translation support
- In-editor documentation translation
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This extension is inspired by the excellent Translation Plugin for JetBrains IDEs.
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to the Zed team for creating an extensible editor
- Inspired by Translation Plugin for JetBrains IDEs
- Built with ❤️ for developers working across languages