Skip to content
Projects

yxw007/vscode-translate-next

View on GitHub

About

🎉一款简单易用支持多种翻译引擎的vscode插件,A translate vscode extension that supports multiple translation engines

AI & Machine Learning

How these counts are measured

Measured star growth

in 24h
Collecting history
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README_en.md

Original

vscode-translate-next

English | 日語 | 简体中文

GitHub License

A powerful VSCode translation extension that breaks language barriers and lets you focus on immersive coding 🚀

Powered by translate

✨ Features

  • Hover Translation — Translate on hover hover
  • Hover Comment Replace — Hover and replace comments inline hover-comment-replace
  • Replace All Comments — Batch translate all comments in your project comment-replace-all
  • Replace Selected Paragraph Comments — Select a block of code and batch translate the comments inside it select-comment-translate.gif
  • Translate Terminal Text — Select text in the terminal and translate instantly translate-terminal-text translate-terminal-shortcut-bnt
  • Extension Details Immersive Translation — Read foreign-language extensions with ease detail_translation
  • Markdown Preview Immersive Translation — Translate documents while previewing markdown-preview-translate
  • Selected Text Translation — Select any text and translate on the fly translateText
  • Smart Identifier from Selection — Turn Chinese or other non-English text into naming-convention-aware identifiers selectTextToVariableName
  • Custom Translation Engine — Bring your own translation service addCustomEngine

📋 Requirements

  • vscode >= 1.146.0

⚙️ Configure Translation Engine

alt text

Google and Bing work out of the box. For other engines, configure your API keys in settings.

📝 Tutorials

Keys shown in tutorials are for demonstration only — all have expired.

🎬 Video Tutorials

🧠 Smart Identifier from Selected Text

  1. Select some Chinese (or other non-English) text in your code, e.g. 获取用户信息
  2. Press Ctrl + Alt + Shift + T (Cmd + Alt + Shift + T on macOS), or right-click → Translate-next → Translate Selection to Identifier Name
  3. The selection is highlighted in red while processing; the first candidate (e.g. getUserInformation) is written to the selection and the suggestion list pops up
  4. Press Enter to keep the top candidate, press ↓ to pick GetUserInformation / get_user_information etc., or Ctrl + Z to revert
  • Detects the semantic role (variable, constant, class, interface, function, type alias, CSS class) and reorders candidates accordingly
  • If the selection is already English (e.g. getUserInfo), no translation request is made — it is converted to the other styles directly
  • Configure preferred styles per language with Translate-next.namingConventions, e.g.:
    { "python": { "variable": "snake_case", "function": "snake_case" } }
    

🖱️ Hover Scope (Customizable)

Controlled by Translate-next.hover.extensions:

  • Default: Built-in allowlist of mainstream programming languages — js,jsx,ts,tsx,java,py,c,h,cpp,cc,cxx,hpp,hh,hxx,rs,go,cs,php,rb,swift,kt,kts,scala,dart,lua
  • Usage: Comma-separated, with or without dots, e.g. ts,js,py or .ts,.js,.py
  • Special: Set to * to enable hover on all files (not recommended, may cause unnecessary token usage)
  • Note: If your extension isn't in the default list, just append it

💻 Supported Translation Engines

Engine Pricing Rating Description
Google Free ⭐⭐⭐⭐ Great results, requires access to Google
Bing Free ⭐⭐⭐⭐ No network restrictions, ready to use, a bit slow
Azure Translate 2M chars/month free ⭐⭐⭐⭐⭐ Great results, fast
Amazon Translate 2M chars/month free ⭐⭐⭐⭐⭐ Great results, fast
Baidu 1M chars/month free ⭐⭐⭐⭐⭐ Great results, fast
DeepL 1M chars/month free ⭐⭐⭐⭐⭐ Great results, fast
Tencent 5M chars/month free ⭐⭐⭐⭐ No longer recommended, service ends 2026/07/31
Custom Engine Fully customizable ⭐⭐⭐ Depends on your API, recommended: DeepSeek-v4-flash

🛠️ Quick Start

  1. Install — Get it from VS Code Marketplace
  2. Register — Create an account at translate.yanxuewen.cn
  3. Sign in login

⌨️ Shortcuts

Action Windows/Linux macOS
Replace selected text with translation Shift + Alt + T Shift + Alt + T
Switch target language Ctrl + Alt + Shift + L Cmd + Alt + Shift + L
Switch default translation engine Alt + Shift + E Alt + Shift + E
View extension logs Ctrl + Alt + Shift + O Cmd + Alt + Shift + O
Clear extension logs Ctrl + Alt + C Cmd + Alt + C
Translate terminal selected text Ctrl + Alt + `` Cmd + Alt + ``
Clear terminal translation logs Alt + C Alt + C
Open terminal translation panel Alt + Shift + O Alt + Shift + O
Enable/disable hover translation Ctrl + Alt + E Ctrl + Alt + E
Replace all comments Ctrl + Alt + Shift + C Cmd + Alt + Shift + C
Replace comments in selected paragraph Alt + Shift + C Alt + Shift + C
Selection to identifier name Ctrl + Alt + Shift + T Cmd + Alt + Shift + T

Shortcuts conflict? Adjust them in VS Code. You can also use the status bar buttons to switch language and engine:

alt text

❓ FAQ

1. fetch failed Error

alt text

Answer: If you haven't changed the default engine, Google is used. When your network can't reach Google, this error appears. Switch to another engine.

2. How Do I Get Keys for Other Engines?

Answer: Check the translate docs for each engine's configuration guide.

3. Shortcuts Not Working?

  • Cause 1: Conflicts with other VS Code shortcuts → modify the conflicting shortcut
  • Cause 2: Conflicts with external software → exit apps one by one to identify the conflict
  • Hidden tricks:
    • Right-click in the editor to replace selected text with translation alt text
    • Enable terminal translation button in the bottom bar via settings alt text

4. How to Avoid Excessive Character Usage?

  • Increase cache duration to reduce repeated translations alt text
  • Enable only the features you need alt text
  • Avoid hovering over large selections — selecting a large block and triggering hover translation consumes characters quickly

5. Why doesn't the "Log In" button in the bottom bar respond when I click it?

  • Possible cause: When you clicked "Log In" for the first time, you accidentally clicked "Do Not Authorize" or "Reject" in the authorization prompt that appeared.
  • Solution:
    • Press F1 in the editor -> Manage Trusted Domains
    • Add the plugin’s official website address to the Trusted Domains configuration file
      [
        ...
        "https://translate.yanxuewen.cn",
      ]
      

💖 Support the Project

If this tool has saved you time, consider supporting continued development:

  • Become a GitHub Sponsor

  • Buy me a coffee ☕ — every contribution helps drive improvements

    alt text

  • Follow and support my videos on Bilibili: 向往自由的码

  • Star ⭐ the project on GitHub and share it with other developers

Thank you for your support ❤️ — it will be prioritized for new features. For suggestions or requests, open an issue or message me.

📢 Learn More

  • For other engine configs, see the translate README
  • Problems? Leave a message, open an Issue, or contact me on WeChat (aa4790139)

📄 License

This project is released under the MIT License. See LICENSE for details.

Explore related projects

Loading…