DualTran for VS Code

Translate the selection without leaving the editor. The translation appears inline at the end of the line
(press Esc to clear it), or side by side in a panel.
- Google — no account, no key.
- AI (BYOK) — any supported provider: Anthropic, Google Gemini, OpenAI, DeepSeek, xAI, Mistral,
Groq, Cohere, Together, Perplexity, DeepInfra, and every OpenAI-compatible endpoint
(OpenRouter, SiliconFlow, Moonshot, Zhipu, Ollama, LM Studio, …).
- The API key lives in VS Code
SecretStorage (the OS keychain), never in settings.json.
Languages
The interface ships 38 language catalogues (same set as the browser extension). VS Code applies the
languages its own UI supports (currently about a dozen); the rest are generated and become live the day
VS Code adds them — no code change needed.
On a headless Linux box the end-to-end suite needs an X server: xvfb-run -a npm run e2e.
npm run e2e:locale runs the same suite inside a German host: it downloads the
MS-CEINTL.vscode-language-pack-de VSIX once into .vscode-test/langpacks/,
unpacks it into a throwaway profile and starts VS Code twice (the first start
only builds the extension cache — without it --locale is ignored). The run
then asserts vscode.env.language === "de", that l10n.t returns our
l10n/bundle.l10n.de.json strings and that the manifest command titles come
from package.nls.de.json.
npm run i18n:sync # fill every catalogue (reuses the extension's translations, machine-translates the rest)
npm run i18n:check # missing key / empty value / lost placeholder → fail
npm run i18n:build regenerates package.nls.<locale>.json and l10n/bundle.l10n.<locale>.json from the
catalogues; npm run verify runs i18n:check.
Commands
| Command |
Shortcut |
What it does |
| DualTran: Translate Selection (inline) |
Ctrl+Alt+T / Cmd+Alt+T |
Ghost line under the selection (or the current line) |
| DualTran: Translate Selection (side panel) |
— |
Source and translation side by side |
| DualTran: Translate and Replace Selection |
— |
Overwrite the selection with the translation |
| DualTran: Clear Inline Translations |
Esc |
Remove ghost lines (Esc reaches DualTran only while a ghost line is on screen) |
| DualTran: Pick Target Language |
— |
Quick pick, saved to settings |
| DualTran: Settings |
— |
The settings panel: provider, model, endpoint, reasoning (real dropdowns) |
| DualTran: Choose AI Provider |
— |
Quick pick: one alphabetical list of providers |
| DualTran: Refresh Provider Catalogue |
— |
Drop the cached catalogue and fetch it again |
| DualTran: Set AI API Key |
— |
Stored in the OS keychain |
Settings
DualTran: Settings opens the extension's settings panel. It is the place where a provider and
its models are real dropdowns: the list merges the curated providers with the 200+ entries of
models.dev — one alphabetical list, no "more" divider — and the model list
follows the provider you picked. (VS Code's settings schema is a static JSON file, so a dependent
dropdown cannot live in the normal Settings page.)
| Row |
What it does |
| Translation engine |
Google (no account) or any supported AI provider with your key |
| Target language |
One of the 38 shipped languages |
| AI provider |
Select a provider until you pick one; then every models.dev provider the transport can call (~305) |
| Model |
That provider's models, alphabetically, plus Custom model… for a fine-tune |
| API endpoint |
Filled with the provider's API base when you pick it; your own edit is never overwritten |
| Reasoning effort |
lowest by default — resolved per model to none → minimal → low before sending |
| API key |
Stored in VS Code SecretStorage (the OS keychain), never in settings.json |
The provider list is bundled with the extension (npm run catalog:sync refreshes it at build time)
and refreshed from models.dev in the background, so the panel is complete even on an offline or
proxy-broken machine.
dualtran.engine, dualtran.sourceLanguage and dualtran.targetLanguage also live in
settings.json as usual. The AI values are kept in the extension's own store (the panel and the
Choose AI Provider quick pick write the same keys); a 0.2.0 settings.json is imported once
on first run.
A fresh install has no AI provider: until you pick one, an AI translation reports
"Choose an AI provider in settings before translating." and sends no request, and the status-bar
button opens the settings panel instead of failing.
For a local model with Ollama: endpoint http://127.0.0.1:11434/v1, model qwen2.5-coder:7b,
any non-empty key.
Install
From the Visual Studio Marketplace:
code --install-extension seigwenlee.dualtran
Or search DualTran in the Extensions view. Offline install: download the .vsix from
Releases and run
code --install-extension dualtran-0.1.0.vsix.
Privacy
The extension collects nothing. Text is sent only to the engine you choose (Google, or your own
endpoint). No DualTran server is involved.
License
MIT.
E2E
npm run e2e downloads VS Code stable once (.vscode-test/), launches the real extension host and runs checks against a local mock endpoint: commands registered, model/key/reasoning on the wire, exactly one retry without reasoning_effort when a gateway rejects it, the side-panel webview opening, and global settings persistence. Linux needs xvfb-run -a npm run e2e.