Rosetta
A VS Code / Cursor extension that translates selected text via CLI translation tools with automatic language direction detection.
简体中文
Features
- Keyboard shortcut: Select text →
Alt+T
- Auto language detection: CJK text → English, other text → Chinese
- Multi-provider support: CodeBuddy, Claude Code, Codex — each with independent model and prompt config
- Hover result display: Translation result appears automatically with one-click copy
- Customizable prompts: Each provider can have a different prompt template
Prerequisites
Install at least one of the following CLI tools:
| Provider |
Installation |
| CodeBuddy CLI |
npm install -g @tencent-ai/codebuddy-code |
| Claude Code |
npm install -g @anthropic-ai/claude-code |
| Codex CLI |
npm install -g @openai/codex |
Usage
- Select any text in the editor
- Press
Alt+T
- Wait for the
⏳ Translating… loading indicator
- Translation result appears in a hover popup — click Copy to copy to clipboard
Settings
General
| Setting |
Default |
Description |
rosetta.provider |
"CodeBuddy" |
Translation engine: CodeBuddy, ClaudeCode, Codex |
rosetta.timeout |
120 |
CLI timeout in seconds (range: 10-600) |
rosetta.defaultTargetLanguage |
"auto" |
Target language: auto (detect), zh, en |
Provider Settings
Each provider has its own path, model, and prompt configuration. Switching providers does not affect other providers' settings.
CodeBuddy
| Setting |
Default |
Description |
rosetta.providers.CodeBuddy.path |
"codebuddy" |
Path to CLI executable |
rosetta.providers.CodeBuddy.model |
"" |
Model (dropdown with 26 available models) |
rosetta.providers.CodeBuddy.prompt |
"Translate ... {lang} ..." |
Translation prompt template |
Claude Code
| Setting |
Default |
Description |
rosetta.providers.ClaudeCode.path |
"claude" |
Path to CLI executable |
rosetta.providers.ClaudeCode.model |
"" |
Model (supports sonnet/opus aliases or full names) |
rosetta.providers.ClaudeCode.prompt |
"Translate ... {lang} ..." |
Translation prompt template |
Codex
| Setting |
Default |
Description |
rosetta.providers.Codex.path |
"codex" |
Path to CLI executable |
rosetta.providers.Codex.model |
"" |
Model (gpt-5.4, gpt-5.4-mini, gpt-5.3-codex, etc.) |
rosetta.providers.Codex.prompt |
"Translate ... {lang} ..." |
Translation prompt template |
The {lang} placeholder in prompt templates is automatically replaced with Chinese or English.
Development
npm install
npm run compile # build once
npm run watch # rebuild on change
Press F5 in VS Code / Cursor to launch the Extension Development Host for debugging.
| |