Docslate
A VS Code extension for translating technical documentation from English to Chinese, specifically designed for Chinese developers.
Features
- Translate entire Markdown documents
- Translate selected text with diff preview
- Preserve Markdown formatting and structure
- Smart handling of technical terms:
- Preserve uppercase terms (e.g., API, HTTP, JSON)
- Protect content within
{{}} brackets
- Maintain proper spacing between Chinese and English text
- Keep Markdown list indentation and formatting
Installation
- Install from VS Code Marketplace
- Get your API key from Niutrans
- Enter your API key when prompted on first use
Usage
Translate Entire Document
- Open a Markdown file
- Right-click and select "翻译此文档" (Translate Document)
- Review the translation in the diff view
- Click "确认翻译" (Confirm Translation) to apply changes
Translate Selected Text
- Select text in a Markdown file
- Right-click and select "翻译选中内容" (Translate Selection)
- Review the translation in the diff view
- Click "确认翻译" (Confirm Translation) to apply changes
Translation Rules
- Uppercase terms (like API, HTTP) remain unchanged
- Content within
{{}} is preserved exactly as is
- Proper spacing between Chinese and English text is maintained
- Markdown formatting and indentation are preserved
- "您" is automatically converted to "你" for a more casual tone
Requirements
- VS Code 1.96.0 or above
- Niutrans API key
Extension Settings
docslate.apiKey : Your Niutrans API key (stored securely)
Known Limitations
- Maximum text length for translation: 5000 characters
- Only supports English to Chinese translation
License
MIT
Contributing
Feel free to open issues or submit pull requests on GitHub.
| |