Project Translator
A VSCode extension: An easy-to-use tool for multi-language localization of projects.
Available Translations
The extension supports translation to these languages:
Samples
Project |
Original Repository |
Description |
Stars |
Tags |
algorithm-visualizer |
algorithm-visualizer/algorithm-visualizer |
:fireworks:Interactive Online Platform that Visualizes Algorithms from Code |
47301 |
algorithm , animation , data-structure , visualization |
algorithms |
algorithm-visualizer/algorithms |
:crystal_ball:Algorithm Visualizations |
401 |
N/A |
cline-docs |
cline/cline |
Autonomous coding agent right in your IDE, capable of creating/editing files, executing commands, using the browser, and more with your permission every step of the way. |
39572 |
N/A |
cursor-docs |
getcursor/docs |
Cursor's Open Source Documentation |
309 |
N/A |
gobyexample |
mmcgrana/gobyexample |
Go by Example |
7523 |
N/A |
golang-website |
golang/website |
[mirror] Home of the go.dev and golang.org websites |
402 |
N/A |
reference-en-us |
Fechin/reference |
⭕ Share quick reference cheat sheet for developers. |
7808 |
awk , bash , chatgpt , cheatsheet , cheatsheets , css , golang , grep , markdown , python , reference , sed , snippets , vim |
styleguide |
google/styleguide |
Style guides for Google-originated open-source projects |
38055 |
cpplint , style-guide , styleguide |
vscode-docs |
microsoft/vscode-docs |
Public documentation for Visual Studio Code |
5914 |
vscode |
Requesting Project Translation
If you want to contribute a translation or need a project to be translated:
- Create an issue using the following template:
**Project**: [project_url]
**Target Language**: [target_lang]
**Description**: Brief description of why this translation would be valuable
- Workflow:
sequenceDiagram
Contributor->>Project Translator: Create translation issue
Project Translator->>Community: Review issue
Community-->>Contributor: Approve/Comment
Contributor->>New Project: Start translation
Contributor->>New Project: Submit to New Project
Contributor->>Project Translator: Create Pull Request, modify README.Samples
Project Translator-->>Project Translator: Review & Merge
- After the PR is merged, the translation will be added to the Samples section.
Current translations in progress: View Issues
Features
- 📁 Folder-level Translation Support
- Translate entire project folders to multiple languages
- Maintain original folder structure and hierarchy
- Support for recursive translation of subfolders
- Automatic detection of translatable content
- Batch processing for efficient large-scale translations
- 📄 File-level Translation Support
- Translate individual files to multiple languages
- Preserve original file structure and formatting
- Support for both folder and file translation modes
- 💡 Smart Translation with AI
- Automatically maintains code structure integrity
- Only translates code comments, preserves code logic
- Maintains JSON/XML and other data structure formats
- Professional technical documentation translation quality
- ⚙️ Flexible Configuration
- Configure source folder and multiple target folders
- Support for custom file translation intervals
- Set specific file types to ignore
- Support for multiple AI model options
- 🚀 User-Friendly Operations
- Real-time translation progress display
- Support for pause/resume/stop translation
- Automatic maintenance of target folder structure
- Incremental translation to avoid duplicate work
Installation
- Search for "Project Translator" in VS Code extension marketplace
- Click install
Configuration
The extension supports the following configuration options:
{
"projectTranslator.specifiedFolders": [
{
"sourceFolder": {
"path": "Source folder path",
"lang": "Source language code"
},
"targetFolders": [
{
"path": "Target folder path",
"lang": "Target language code"
}
]
}
],
"projectTranslator.specifiedFiles": [
{
"sourceFile": {
"path": "Source file path",
"lang": "Source language code"
},
"targetFiles": [
{
"path": "Target file path",
"lang": "Target language code"
}
]
}
],
"projectTranslator.currentVendor": "openai",
"projectTranslator.vendors": [
{
"name": "openai",
"apiEndpoint": "API endpoint URL",
"apiKey": "API authentication key",
"apiKeyEnvVarName": "Environment variable name for API key",
"model": "Model name to use",
"rpm": "Maximum requests per minute",
"maxTokensPerSegment": 4096,
"timeout": 30,
"temperature": 0.0
}
]
}
Key configuration details:
Configuration Option |
Description |
projectTranslator.specifiedFolders |
Multiple source folders with their corresponding destination folders for translation |
projectTranslator.specifiedFiles |
Multiple source files with their corresponding destination files for translation |
projectTranslator.translationIntervalDays |
Translation interval in days (default 7 days) |
projectTranslator.copyOnly |
Files to copy but not translate (with paths and extensions arrays) |
projectTranslator.ignore |
Files to ignore completely (with paths and extensions arrays) |
projectTranslator.skipFrontMatterMarkers |
Skip files based on front matter markers (with enabled and markers arrays) |
projectTranslator.currentVendor |
Current API vendor in use |
projectTranslator.vendors |
API vendor configuration list (can use apiKey directly or apiKeyEnvVarName for environment variables) |
projectTranslator.systemPrompts |
System prompt array for guiding the translation process |
projectTranslator.userPrompts |
User-defined prompt array, these prompts will be added after system prompts during translation |
projectTranslator.segmentationMarkers |
Segmentation markers configured by file type, supports regular expressions |
projectTranslator.debug |
Enable debug mode to log all API requests and responses to output channel (default: false) |
projectTranslator.logFile |
Configuration for debug log files (see Log File Feature) |
Usage
- Open command palette (Ctrl+Shift+P / Cmd+Shift+P)
- Type "Translate Project" and select the command
- If source folder is not configured, a folder selection dialog will appear
- Wait for translation to complete
During translation:
- Can pause/resume translation via status bar buttons
- Can stop translation process at any time
- Translation progress shown in notification area
- Detailed logs displayed in output panel
Development
Build System
This extension uses esbuild for fast bundling and development:
Available Scripts
npm run build
- Production build with minification
npm run compile
- Development build
npm run watch
- Watch mode for development
npm test
- Run tests
VS Code Tasks
- Build (Ctrl+Shift+P → "Tasks: Run Task" → "build") - Bundles extension for production
- Watch (Ctrl+Shift+P → "Tasks: Run Task" → "watch") - Development mode with auto-rebuild
Development Setup
- Clone the repository
- Run
npm install
to install dependencies
- Press
F5
to start debugging or run the "watch" task for development
The esbuild configuration:
- Bundles all TypeScript files into a single
out/extension.js
- Excludes VS Code API (marked as external)
Advanced Features
Using Environment Variables for API Keys
Project Translator supports using environment variables for API keys, which is a more secure approach than storing API keys directly in configuration files:
- Configure your vendor with an
apiKeyEnvVarName
property:
{
"projectTranslator.vendors": [
{
"name": "openai",
"apiEndpoint": "https://api.openai.com/v1",
"apiKeyEnvVarName": "OPENAI_API_KEY",
"model": "gpt-4"
},
{
"name": "openrouter",
"apiEndpoint": "https://openrouter.ai/api/v1",
"apiKeyEnvVarName": "OPENROUTER_API_KEY",
"model": "anthropic/claude-3-opus"
}
]
}
Set the environment variable in your system:
- On Windows:
set OPENAI_API_KEY=your_api_key
- On macOS/Linux:
export OPENAI_API_KEY=your_api_key
When the extension runs, it will:
- First check if
apiKey
is provided directly in the configuration
- If not, it will look for the environment variable specified by
apiKeyEnvVarName
This approach keeps your API keys out of configuration files and version control systems.
Skip Translation Based on Front Matter
Project Translator can skip translation of Markdown files based on their front matter metadata. This is useful for draft documents or files marked as not requiring translation.
To enable this feature, configure the projectTranslator.skipFrontMatterMarkers
option:
{
"projectTranslator.skipFrontMatterMarkers": {
"enabled": true,
"markers": [
{
"key": "draft",
"value": "true"
},
{
"key": "translate",
"value": "false"
}
]
}
}
With this configuration, any Markdown file with front matter containing draft: true
or translate: false
will be skipped during translation and directly copied to the target location.
Example Markdown file that would be skipped:
---
draft: true
title: "Draft Document"
---
This document is a draft and should not be translated.
Design Documentation
- Generates source maps for development builds
- Minifies code for production builds
- Provides problem matcher integration for VS Code
Notes
- Ensure sufficient API usage quota
- Recommended to test with small projects first
- Use dedicated API keys and remove them after completion
License
License