A VSCode extension for translating game text files with AI support. Supports multiple file formats (.txt, .json, .csv, .tsv) and various translation providers including OpenRouter, OpenAI, and free alternatives.
📖 Documentation: English | Tiếng Việt 🚀 Quick Start: English | Tiếng Việt
- Multiple Translation Providers: Google Translate (free), LibreTranslate, OpenRouter, OpenAI, Google Cloud Translation
- Smart Translation: Apply custom vocabulary before translation
- System Prompts: Customize AI behavior for game-specific translations
- Preview Mode: Review translations before applying
- Multi-line Support: Translate multiple lines of selected text
Search for "Game Text Translator" in VSCode Extensions and install.
- Go to Releases
- Download the latest
.vsixfile - In VSCode: Extensions → Install from VSIX...
- Select the downloaded file
git clone https://github.com/levi-soft/Translation-Tool.git
cd game-text-translator
npm install
npm run compile
code --install-extension game-text-translator-0.0.1.vsix- Open Settings: File → Preferences → Settings (or
Ctrl+,) - Search: "game text translator"
- Configure basic options:
Extension supports 5 AI providers with different quality and pricing:
- googleTranslate: Google Translate (free)
- Pros: Fast, free
- Cons: Basic quality
- libreTranslate: Open-source AI
- Pros: Privacy-focused, free
- Cons: Average quality
- openRouter: Access to multiple AI models
- Models: Claude-3.5, GPT-4, Gemini, etc.
- Pricing: From $0.001/1K tokens
- openAI: Official GPT models
- Models: GPT-3.5, GPT-4, GPT-4o
- Pricing: From $0.002/1K tokens
- googleCloud: Google Cloud Translation
- Pros: High quality for Asian languages
- Pricing: $20/1M characters
- Source Language: Source language code (en, ja, zh, ko, vi, etc.)
- Target Language: Target language code (vi, en, zh, ja, etc.)
Examples:
- English → Vietnamese:
en→vi - Japanese → Vietnamese:
ja→vi - Chinese → Vietnamese:
zh→vi
- Sign up: openrouter.ai
- Get API key: Dashboard → API Keys
- VSCode Setting:
"Game Text Translator: OpenRouter Api Key" - Choose Model: Select your preferred AI model in settings
Available Models:
- x-ai/grok-4-fast:free (default): Free Grok-4 model, fast and cost-effective for game text
- google/gemini-2.5-flash: Gemini 2.5 Flash, fast and efficient for translation
- openai/gpt-4.1-mini: Compact GPT-4.1 Mini, reliable quality for game localization
- Sign up: platform.openai.com
- Get API key: API Keys section
- VSCode Setting:
"Game Text Translator: OpenAI Api Key"
- Create project: Google Cloud Console
- Enable Translation API
- Create API key: APIs & Services → Credentials
- VSCode Setting:
"Game Text Translator: Google Cloud Api Key"
Customize AI translation behavior for game-specific content. The system prompt is now entered in a multiline text area for better readability and editing.
Default System Prompt:
You are a professional Vietnamese game translator specializing in video game localization.
Your task is to translate game text from English to Vietnamese naturally and accurately.
Guidelines:
- Maintain the original tone and style of the game text
- Use appropriate gaming terminology and slang
- Keep cultural references intact when possible
- Ensure translations fit the character limit if specified
- Preserve any special formatting or placeholders
- Make translations sound natural to Vietnamese gamers
Translate the following text:
Examples by game genre:
RPG Fantasy:
You are a professional Vietnamese game translator specializing in fantasy RPG games.
Guidelines:
- Maintain epic, heroic tone throughout
- Use "Anh Hùng" for Hero, "Phép Thuật" for Magic, "Rồng" for Dragon
- Keep fantasy terminology consistent
- Preserve the sense of adventure and wonder
Translate the following fantasy RPG text:
Horror Game:
You are a professional Vietnamese game translator specializing in horror games.
Guidelines:
- Maintain suspense and fear in the translation
- Use tense Vietnamese that creates unease
- Keep the atmosphere of dread and tension
- Translate jump scares and horror elements effectively
Translate the following horror game text:
Mobile Game:
You are a professional Vietnamese game translator specializing in casual mobile games.
Guidelines:
- Keep fun, light tone throughout
- Use simple Vietnamese suitable for all ages
- Make translations engaging and accessible
- Consider short attention spans in mobile gaming
Translate the following mobile game text:
Ensure consistent translation of special terms:
{
"Hero": "Anh Hùng",
"Mana": "Năng Lượng",
"Quest": "Nhiệm Vụ",
"Inventory": "Túi Đồ",
"Level Up": "Lên Cấp",
"Boss": "Trùm Cuối",
"Dungeon": "Ngục Ngầm",
"Spell": "Phép Thuật",
"Potion": "Thuốc Phục Hồi",
"Guild": "Bang Hội",
"Critical Hit": "Đòn Chí Mạng",
"Experience": "Kinh Nghiệm"
}Tips:
- Add character names, location names
- Use same term for same concept
- Update dictionary when encountering new terms
- Open any text file
- Select text to translate (can select multiple lines)
- Right-click → "Translate Selection"
- View preview and Apply
Default provider: Google Translate (free)
- Settings → Search "translation provider"
- Select desired provider
- Enter API key if needed (for premium providers)
- Test translation to compare quality
- Settings → "system prompt"
- Write prompt suitable for game genre
- Settings → "vocabulary"
- Add dictionary for game terms
- Setup provider: OpenRouter (for high quality)
- System prompt:
Translate RPG game text. Maintain epic fantasy tone. Use "Anh Hùng" for Hero, "Phép Thuật" for Magic. - Vocabulary:
{ "Mana": "Năng Lượng", "Quest": "Nhiệm Vụ", "Level": "Cấp Độ" } - Translate text selections from game scripts and dialogue
- Setup provider: Google Translate (free, fast)
- System prompt:
Translate casual mobile game. Keep fun, simple tone. Use easy Vietnamese for all ages. - Translate text selections from UI strings and messages
- Setup provider: OpenRouter with Claude
- System prompt:
Translate horror game text. Maintain suspense and fear. Use tense Vietnamese that creates unease. - Vocabulary: Horror-specific terms
- Translate text selections from scary dialogue and descriptions
- Check Developer Console for errors
- Verify API keys for premium providers
- Test with Google Translate first
- Ensure valid JSON format
- Check nested objects are processed
- Review translated JSON validity
- Ensure header row exists
- Check delimiter (comma for CSV, tab for TSV)
- Verify UTF-8 encoding
- Node.js 16+
- Git
git clone https://github.com/levi-soft/Translation-Tool.git
cd game-text-translator
npm install
npm run compilenpm run watch # Watch for changes and compilePress F5 in VSCode to launch extension development host.
npm run compile
npx vsce package # Creates .vsix file- Create a Microsoft Developer Account
- Install VSCE:
npm install -g vsce - Create a Personal Access Token (PAT) for Azure DevOps
-
Package the extension:
npm run compile vsce package
This creates a
.vsixfile -
Login to marketplace:
vsce login <publisher-name>
Enter your Personal Access Token when prompted
-
Publish:
vsce publish
- Go to VSCode Marketplace Publisher Portal
- Upload the
.vsixfile directly
Update package.json with your publisher info:
{
"publisher": "your-publisher-name",
"name": "game-text-translator",
"displayName": "Game Text Translator"
}- Go to GitHub.com and create a new repository
- Name it
Translation-Toolor similar - Don't initialize with README (we already have one)
git init
git add .
git commit -m "Initial commit: Game Text Translator VSCode extension"
git branch -M main
git remote add origin https://github.com/levi-soft/Translation-Tool.git
git push -u origin maingame-text-translator/
├── src/
│ ├── extension.ts # Main extension file
│ ├── services/
│ │ └── TranslationService.ts
│ └── parsers/
│ └── FileParser.ts
├── .vscode/
│ ├── launch.json
│ └── tasks.json
├── out/ # Compiled JS (generated)
├── node_modules/ # Dependencies (generated)
├── package.json
├── tsconfig.json
├── README.md
├── .gitignore
├── .vscodeignore
└── game-text-sample.json # Sample file
Error: running scripts is disabled on this system
Solution: Run PowerShell as Administrator and execute:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserError: 'npm' is not recognized
Solution: Install Node.js 16+ from nodejs.org
Error: Could not find a declaration file for module 'papaparse'
Solution: Install type definitions:
npm install --save-dev @types/papaparseError: 'vsce' is not recognized
Solution: Install VSCE globally:
npm install -g vsce- Close all VSCode windows before installing
- Use command:
code --install-extension game-text-translator-0.0.1.vsix - Or manually: VSCode → Extensions → Install from VSIX
- Requires VSCode 1.74.0 or higher
- Update VSCode to latest version
- Check VSCode Console: Help → Toggle Developer Tools → Console
- Verify API keys for premium providers (OpenRouter, OpenAI, Google Cloud)
- Test with free providers first (Google Translate, LibreTranslate)
- Ensure stable internet connection
- Check API key validity and quotas
- Google Translate: No API key needed
- Others: Configure keys in VSCode Settings
See BUILD.md for comprehensive troubleshooting guide.
- Fork the repository
- Create a feature branch
- Make changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details