Bilingual Translate
pendingby solaristdeng
Translate markdown files using OpenAI-compatible APIs. Creates bilingual output with original and translated text line by line.
Bilingual Translate for Obsidian
A simple Obsidian plugin that translates markdown files using OpenAI-compatible APIs. Creates bilingual output with original text followed by translation, line by line.
Features
- Real-time translation: Watch translations appear as each line is processed
- Bilingual output: Original line followed by translated line
- OpenAI-compatible: Works with OpenAI, Ollama, OpenRouter, Azure, and any OpenAI-compatible API
- Smart parsing: Automatically skips code blocks, frontmatter, URLs, and images
- Preserves formatting: Keeps markdown syntax intact
Installation
Manual Installation
- Download
main.js,manifest.json, andstyles.cssfrom the releases - Create folder:
<YourVault>/.obsidian/plugins/obsidian-bilingual-translate/ - Copy the files into that folder
- Restart Obsidian
- Enable the plugin in Settings → Community plugins
Build from Source
git clone https://github.com/solaristdeng/obsidian-bilingual-translate.git
cd obsidian-bilingual-translate
npm install
npm run build
Configuration
Go to Settings → Bilingual Translate to configure:
| Setting | Description |
|---|---|
| API URL | Your OpenAI-compatible endpoint |
| API Key | Your API key |
| Model | Model name (e.g., gpt-4o-mini, llama3.1) |
| Temperature | Controls randomness (0-2). Lower values (0.3) recommended for translation. |
| Concurrency | Number of parallel translation requests. |
| Source Language | Language of original text (or auto-detect) |
| Target Language | Language to translate to |
Example API URLs
| Provider | URL |
|---|---|
| OpenAI | https://api.openai.com/v1/chat/completions |
| Ollama (local) | http://localhost:11434/v1/chat/completions |
| OpenRouter | https://openrouter.ai/api/v1/chat/completions |
| Azure OpenAI | https://<resource>.openai.azure.com/openai/deployments/<deployment>/chat/completions?api-version=2024-02-01 |
Usage
- Open any markdown file
- Open Command Palette (
Ctrl/Cmd + P) - Run "Bilingual Translate: Translate current file"
- Watch as translations appear line by line
You can also set a hotkey for the command in Settings → Hotkeys.
Example
Before:
# Hello World
This is a test document.
It demonstrates the translation feature.
After (translated to Chinese):
# Hello World
# 你好世界
This is a test document.
这是一个测试文档。
It demonstrates the translation feature.
它演示了翻译功能。
What Gets Translated
✅ Regular text paragraphs
✅ Headings
✅ List items
✅ Blockquotes
❌ Code blocks (...)
❌ Frontmatter (--- ... ---)
❌ URLs
❌ Image references
❌ Empty lines
Credits
This plugin was inspired by and built with reference to Kiss Translator, a browser extension for translating web pages. Special thanks to the Kiss Translator project for the translation approach and design inspiration.
License
MIT
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.