VSCode Text Translator
简体中文
A Visual Studio Code extension that provides instant text translation using multiple translation services.
Features
Supports multiple translation services:
- Microsoft Translator
- DeepL
- Youdao
- Tencent Cloud
Two translation modes:
- Interactive target language selection (Alt+K)
- Quick translation to default language (Alt+D)
Context menu integration
Automatic source language detection
Configurable default target language
Usage
Interactive Translation
- Select the text you want to translate in the editor
- Either:
- Press
Alt+K
- Right-click and select "Translate" from the context menu
- Choose your target language from the dropdown list
- The selected text will be replaced with the translation
Quick Translation to Default Language
- Select the text you want to translate
- Press
Alt+D
- The text will be automatically translated to your default target language
Configuration
- Open VS Code Settings
- Search for "Text Translator"
- Configure the following settings:
- Choose your preferred translation service
- Set your default target language for quick translation (Alt+D)
- Enter the API credentials for your chosen service
Translation Service Settings
Microsoft Translator
textTranslator.microsoftApiKey : Your Microsoft Translator API Key
textTranslator.microsoftApiRegion : Your API region (default: global)
DeepL
textTranslator.deepLApiKey : Your DeepL API Key
Youdao
textTranslator.youdaoAppKey : Your Youdao API App Key
textTranslator.youdaoAppSecret : Your Youdao API App Secret
Tencent Cloud
textTranslator.tencentSecretId : Your Tencent Cloud Secret ID
textTranslator.tencentSecretKey : Your Tencent Cloud Secret Key
Default Language Setting
textTranslator.defaultTargetLanguage : Set your preferred target language for quick translation (Alt+D)
Supported Languages
- English (en)
- Chinese (zh)
- Japanese (ja)
- Korean (ko)
- French (fr)
- German (de)
- Spanish (es)
- Italian (it)
- Russian (ru)
Getting API Keys
Microsoft Translator
- Visit Azure Portal
- Create a Translator resource
- Get your API key and region from the resource overview
DeepL
- Visit DeepL API
- Sign up for an API account
- Get your API key from the account dashboard
Youdao
- Visit Youdao AI Platform
- Create a new application
- Get your App Key and App Secret
Tencent Cloud
- Visit Tencent Cloud Console
- Enable Machine Translation service
- Get your SecretId and SecretKey from the API key management
Error Messages
The extension provides clear error messages for common issues:
- Missing API credentials
- Network connection problems
- Invalid API responses
- Missing text selection
- Service-specific errors
License
This extension is licensed under the MIT License.
| |