seigwen/DualTran-extension:AI 双语网页翻译浏览器扩展
seigwen/DualTran-extension
seigwen/DualTran-extension 是一款 AI 驱动的浏览器扩展,可在同一页面内将译文与原文并排显示,基于 FilipePS 的 Traduzir-paginas-web 并针对 AI 翻译做了增强。
AI-powered browser extension that translates web pages and displays the translated text alongside the original text in the same page.
Based on Traduzir-paginas-web by FilipePS, with significant enhancements for AI-powered translation.
Features
Translation Services
- Google Translate - Fast and reliable web page translation
- AI Translation - Leverage LLM models for higher quality translations
- Dual Display - Show translated text alongside original text
AI Provider Support (20+ providers)
| Category | Providers |
|---|---|
| Global | OpenAI, Anthropic, Google Gemini, Mistral, Cohere, Together AI, Groq, Perplexity, xAI (Grok) |
| Aggregator | OpenRouter (300+ models) |
| Enterprise | Azure OpenAI |
| China | DeepSeek, 智谱AI (GLM), 月之暗面 (Moonshot), 阿里通义千问 (Qwen), 百度文心 (ERNIE), 字节豆包 (Doubao), 讯飞星火 (iFlytek) |
| Additional | Deep Infra, Cerebras, Vercel AI Gateway |
Key Capabilities
- 🔄 One-click Translation - Translate entire pages with a single click
- 📝 Selected Text Translation - Translate selected text in a popup
- 🎯 Smart Translation - AI improves Google translations for better quality
- ⌨️ Keyboard Shortcuts -
Alt+Ttoggle,Alt+Stranslate selection,Alt+Qswitch service - 🌍 Multi-language Support - Supports 100+ languages
- 🎨 Customizable Display - Configure how translations appear (side-by-side, replace, etc.)
Installation
From Source (Developer Mode)
-
Clone this repository:
git clone https://github.com/seigwen/DualTran-extension.git cd DualTran-extension -
Install dependencies:
npm install
-
Build the extension:
npm run build
-
Load in Chrome:
- Open
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked"
- Select the
dist/chrome/folder
- Open
Development
For development with auto-rebuild:
npm run dev
Configuration
Setting up AI Providers
- Click the extension icon and go to Settings
- Select an AI provider from the dropdown
- Enter your API key
- Choose a model
Translation Modes
- Google Only - Use Google Translate
- AI Only - Use AI for translation
- Google + AI - Use Google first, then improve with AI
Building
# Development build (watch mode) npm run dev # Production build npm run build
Output goes to dist/chrome/.
Testing
# Run unit tests npm test # Run with coverage npm run test:coverage # Run E2E tests npm run test:browser-e2e
Project Structure
src/
├── background/ # Service Worker (background scripts)
├── contentScript/ # Content scripts (injected into web pages)
├── lib/ # Shared libraries
│ ├── ai/ # AI provider system
│ └── config.js # Configuration management
├── options/ # Settings page
├── popup/ # Extension popup
└── manifest.json # Extension manifest
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
License
This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.
Acknowledgments
- Original project: Traduzir-paginas-web by FilipePS
- AI SDK: Vercel AI SDK
Privacy
See Privacy Policy for details on data handling.
Support
来源:GitHub · github.com