A VS Code extension that translates code between multiple programming languages using AI. Easily convert code snippets or entire files between popular programming languages with just a few clicks.
- In-Editor Code Translation: Right-click and translate selected code blocks to your target language
- Multiple Language Support: Supports translation between Python, JavaScript, TypeScript, Java, C#, C++, Rust, Go, Ruby, PHP, and Swift
- Context-Aware: Automatically detects the source language based on file extension
- Preserve Comments: Option to preserve comments during translation
- Side-by-Side Preview: View translated code in a new editor tab
- Install the extension from the VS Code marketplace
- Open a code file in your editor
- Select the code you want to translate
- Right-click and select "Translate Selection" from the context menu
- Choose your target language from the dropdown
- View the translated code in a new editor tab
This extension contributes the following settings:
polygot.apiEndpoint
: API endpoint for the translation service (default:https://translate.u16p.com/api/v1/translate
)polygot.defaultTargetLanguage
: Default target language for translation (default:javascript
)polygot.preserveComments
: Whether to preserve comments during translation (default:true
)
Polygot: Translate Code
: Translate the entire current filePolygot: Translate Selection
: Translate the currently selected code
- Python
- JavaScript/TypeScript
- Java
- C/C++
- C#
- Go
- Ruby
- PHP
- Perl
- Rust
- Swift
- Kotlin
- Dart
- HTML/CSS/SCSS
- COBOL
- Fortran
- Pascal
- Scala
- Python:
.py
- JavaScript/TypeScript:
.js
,.jsx
,.ts
,.tsx
- Java/Kotlin/Scala:
.java
,.kt
,.scala
- C/C++:
.c
,.h
,.cpp
,.hpp
,.cc
- C#:
.cs
- Go:
.go
- Ruby:
.rb
- PHP:
.php
- Perl:
.pl
,.pm
- Rust:
.rs
- Swift:
.swift
- Dart:
.dart
- COBOL:
.cbl
,.cob
- Fortran:
.f
,.for
,.f90
- Pascal:
.pas
,.pp
- Web:
.html
,.htm
,.css
,.scss
- Python ↔ JavaScript/TypeScript/Java/C++/C#/Ruby/Go
- JavaScript/TypeScript ↔ Java/C++/C#/Dart/HTML
- Java ↔ C++/C#/Go/Kotlin/Scala/COBOL
- C++ ↔ C/Rust
- And many more combinations!
If you need support for additional language pairs, please contact us at info@unelmaplatforms.com with your request. We're constantly working to add support for more programming languages and would love to hear about your needs.
- VS Code 1.85.0 or higher
- Active internet connection for API access
- Large files may take longer to translate
- Some language-specific features may not translate perfectly and may require manual adjustment
- Added support for 20+ programming languages including:
- TypeScript
- C/C++
- C#
- Go
- Ruby
- PHP
- Perl
- Fortran
- Pascal
- Kotlin
- Scala
- Rust
- Swift
- Dart
- HTML/CSS/SCSS
- Added support for 50+ language pairs for translation
- Added file extension mapping for better language detection
- Improved language detection for various file types
- Added icon for the extension
Initial release of Polygot Code Translator with support for multiple programming languages and basic translation features.
Contributions are welcome! Please feel free to submit issues and pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.