A Chrome/Edge browser extension that helps you learn foreign languages by providing instant AI-powered translations. Double-click words or highlight text to get translations in a convenient sidebar panel.
- Double-click Translation: Double-click any word for instant translation and sidebar opening
- Highlight Translation: Highlight text for translation when sidebar is open
- AI-Powered: Uses OpenRouter API with support for multiple AI models (Claude, GPT-4, Gemini, etc.)
- Non-Intrusive: All translations appear in a sidebar without disrupting webpage layout
- Customizable: Configure target language, AI model, and translation prompts
- Markdown Support: Formatted responses with rich text rendering
- Translation History: Keep track of all your translations in one session
- Keyboard Shortcuts: Quick sidebar access with Ctrl+Shift+T
- Universal Compatibility: Works on any website
- Download or clone this repository to your computer
- Extract the files to a folder (e.g.,
language-translator-extension)
- Open Chrome or Edge and navigate to
chrome://extensions/ - Enable Developer Mode (toggle switch in the top right corner)
- Click "Load unpacked" and select your extension folder
- Pin the extension to your browser toolbar (click the puzzle piece icon, then pin)
- Visit OpenRouter.ai
- Sign up for a free account
- Navigate to your API Keys section
- Generate a new API key (starts with
sk-or-) - Copy the key for the next step
- Click the extension icon in your browser toolbar
- Enter your OpenRouter API key in the settings popup
- Configure your preferences:
- Model: Enter any OpenRouter model (e.g.,
anthropic/claude-3.5-sonnet) - Target Language: Select the language you want translations in
- Prompts: Customize how the AI translates words vs longer selections
- Model: Enter any OpenRouter model (e.g.,
- Click "Save Settings"
- Double-click any word on any webpage
- The sidebar will automatically open and show the translation
- Perfect for quick vocabulary lookups while reading
- Open the sidebar first using
Ctrl+Shift+Tor the extension icon - Highlight any text (words, phrases, sentences, paragraphs)
- Translation appears automatically in the sidebar
- Great for translating longer passages or specific phrases
- Toggle sidebar: Press
Ctrl+Shift+Tor click the extension icon - Close sidebar: Press
Escapeor click the × button in sidebar header - Clear translations: Click "Clear All" to remove translation history
- Access settings: Click "Settings" button in the sidebar footer
Ctrl+Shift+T: Toggle sidebar visibilityEscape: Close sidebar (when sidebar is open)
You can use any model available on OpenRouter. Here are some popular choices:
google/gemini-2.5-flashopenai/gpt-4.1-mini
anthropic/claude-opus-4anthropic/claude-sonnet-4google/gemini-2.5-prodeepseek/deepseek-chat-v3-0324openai/gpt-4oopenai/gpt-4.1
Customize how translations work by editing the prompt templates in settings:
Word Translation Prompt (for double-clicked words):
Translate the word '{{text}}' into {{language}}. Provide a brief explanation.
Selection Translation Prompt (for highlighted text):
Translate this text into {{language}}: {{text}}
Template Variables:
{{text}}- The selected text or word{{language}}- Your chosen target language
- Open an article in a foreign language
- Double-click unknown words for quick definitions
- When you want to understand longer passages, press
Ctrl+Shift+Tto open sidebar - Highlight sentences or paragraphs for full translation
- Keep sidebar open to continue highlighting text for translation
- Double-click words you don't know
- Read the AI explanation in the sidebar
- Continue reading and double-clicking new words
- All translations stay in your sidebar history for review
- Open sidebar with
Ctrl+Shift+T - Highlight phrases, sentences, or paragraphs
- Get instant contextual translations
- Use "Clear All" to start fresh when moving to new content
- Local storage only: Your API key and settings stay on your device
- No data collection: We don't collect or store your translations
- Direct API calls: Communications go directly to OpenRouter
- Open source: Full source code available for review
- Ensure all files are in the same folder
- Check that Developer Mode is enabled in
chrome://extensions/ - Verify
manifest.jsonis present and valid
- Make sure you've saved your API key in settings
- Check browser console for error messages (F12 → Console tab)
- Try refreshing the webpage after configuring the extension
- Verify your OpenRouter API key is correct and has credits
- Check your internet connection
- Try a different model if one isn't responding
- For highlight translation: ensure sidebar is open first
- Use
Ctrl+Shift+Tto toggle sidebar - Check if extension is enabled in
chrome://extensions/ - Refresh the webpage and try again
Translation costs depend on your chosen model and usage:
- GPT-4o Mini: ~$0.15 per 1M tokens (most cost-effective)
- Claude 3.5 Sonnet: ~$3 per 1M tokens (best quality)
- GPT-4o: ~$5 per 1M tokens (premium option)
Typical usage: A few cents per day for moderate language learning (50-100 translations)
language-translator-extension/
├── manifest.json # Extension configuration
├── content.js # Main functionality
├── content.css # Sidebar styling
├── popup.html # Settings interface
├── popup.js # Settings logic
├── background.js # Extension background service
└── README.md # This file
- Edit the source files
- Go to
chrome://extensions/ - Click the reload button on the extension
- Test your changes on any webpage
- Issues: Report bugs via GitHub Issues
- API Questions: Check OpenRouter Documentation
- Feature Requests: Submit via GitHub Issues
MIT License - Feel free to modify and distribute.
Happy Language Learning! 🌍📚
Tip: Start with double-clicking words to build vocabulary, then graduate to highlighting full sentences for contextual understanding.