Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌉 LangBridge · Multi-Language Code Translator

Paste code → pick source & target language → get translated code. / 粘贴代码 → 选语言 → 得到翻译后的代码。

LangBridge is a dual-engine code translator: a rule engine for 9 language pairs (zero-dependency, instant), and an AI engine for any language pair (via DeepSeek API).


Quick Start / 快速开始

Web / 网页

Open web/index.html in your browser — paste code, pick languages, click convert. 浏览器打开 web/index.html — 粘贴、选语言、转换。

CLI / 命令行

# Rule engine (instant, no API key needed)
node bridge.js py2js app.py              # Python → JavaScript
node bridge.js json2go schema.json       # JSON → Go struct
node bridge.js js2ts app.js              # JS → TypeScript
node bridge.js sql2json schema.sql       # SQL DDL → JSON Schema

# AI engine (any pair, needs API key)
node bridge.js ai py2cpp algorithm.py --key sk-xxx
node bridge.js ai java2py Main.java

Rule Engine Pairs / 规则引擎支持

Source / 源 Target / 目标 Pair / 语言对
🐍 Python 📜 JavaScript py2js
📜 JavaScript 🐍 Python js2py
📜 JavaScript 📘 TypeScript js2ts
📘 TypeScript 📜 JavaScript ts2js
📋 JSON 🔵 Go struct json2go
📋 JSON 🦀 Rust struct json2rs
📋 JSON 🟣 C# class json2cs
📋 JSON ☕ Java class json2java
🗄️ SQL DDL 📋 JSON Schema sql2json

AI Engine / AI 引擎

For any language pair not in the rule engine (e.g., Python → C++, Java → Python, Ruby → JS), use AI mode:

# Set your API key
export DEEPSEEK_API_KEY=sk-xxx

# Translate anything
node bridge.js ai py2cpp algorithm.py
node bridge.js ai rb2js script.rb

Get a free API key: platform.deepseek.com

Web UI / 网页界面

Features:

  • ✅ Split-pane editor (input left, output right)
  • ✅ 10+ language selectors
  • ✅ Rule engine (instant) + AI mode toggle
  • ✅ One-click copy & download
  • ✅ Works offline (rule engine only)
  • ✅ Dark theme

Philosophy / 设计理念

Most code translators are either:

  • Too simple — regex find/replace, fails on real code
  • Too heavy — require installing compilers, transpilers, and 500 npm packages

LangBridge is different:

  • Rule engine: Heuristic pattern matching covering 90% of real-world code patterns. Zero dependencies, instant results.
  • AI engine: LLM-powered for the remaining 10% — complex cross-paradigm translations.

You choose the right tool for the job.

License / 协议

MIT

About

🌉 Multi-language code translator — Python↔JS, JSON→Go/Rust/C#/Java, SQL→JSON + AI engine. Zero deps.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages