Quick Start
Installation
From VSCode Marketplace (Recommended)
- Open VSCode
- Press
Ctrl+Shift+Xto open the Extensions panel - Search for "variable-translator"
- Click Install
From VSIX
- Download the
.vsixfile - Press
Ctrl+Shift+Pin VSCode - Type "Extensions: Install from VSIX..."
- Select the downloaded
.vsixfile
Build from Source (Developers)
bash
# Clone the project
git clone https://github.com/AnsStory/hias-variable-translator.git
# Install dependencies
npm install
# Type-check compile
npm run compile
# Build
npm run build
# Package a .vsix
npm run vsce:packageZero configuration
The extension uses the Pinyin service by default, so it works right after installation with no setup. For higher-quality translation, configure an online service — see Translation Services.
Basic Usage
File Path Translation
- Right-click in the Explorer to create a new file (or folder)
- Enter a path containing non-English characters, e.g.
测试文件/测试.js - Pick a naming format from the popup (e.g. camelCase)
- The file is created as
testFile/test.js
If you press Esc to cancel the format picker, the original file is kept as-is without translation.
Selection Translation
- Select non-English text in the editor, e.g.
用户名称 - Press
Alt+Shift+T - Pick a naming format
- The text is replaced with English, e.g.
userName
Translate & Copy to Clipboard
- Select non-English text
- Press
Alt+Shift+C - Pick a naming format
- The translation is copied to the clipboard — the original text is not replaced
Undo a File Translation
- Press
Alt+Shift+Zwithin 1 minute after a file translation (orCtrl+Zwhen focus is in the Explorer or another non-text-input area) - The translated file is deleted and directories created by the translation are cleaned up
- The corresponding editor tab is closed automatically
Keyboard Shortcuts
| Shortcut | Feature |
|---|---|
Alt+Shift+T | Translate selection |
Alt+Shift+C | Translate & copy to clipboard |
Alt+Shift+Z | Undo file translation |
Ctrl+Z | Undo file translation (within 1 minute, focus outside text input areas) |
Alt+Shift+D | Toggle file translation |
Alt+Shift+S | Switch translation service |
See Shortcuts for details.