liwbcraft34 downloadsTranslate selected text via local API and manage your personal vocabulary.
一款为 Obsidian 打造的本地翻译 + 单词本管理插件,需配合开源的 LibreTranslate 使用。
本插件依赖 LibreTranslate 翻译服务,请确保已部署并运行。
docker run -d --name libretranslate -p 5000:5000 -m 1.5g --memory-swap 1.5g libretranslate/libretranslate:v1.9.5 --load-only en,zh
部署成功后,在插件设置中将 API 地址设置为 http://127.0.0.1:5000/translate。
API 需要接受 POST 请求,格式如下:
{
"q": "要翻译的文本",
"source": "auto",
"target": "zh"
}
返回格式需包含 translatedText 字段。
{你的仓库}/.obsidian/plugins/custom-translate/如果你想快速体验插件功能,可以下载示例配置文件:
example-data.json 文件💡 示例文件就是
vocabulary的值,直接复制替换到你data.json的vocabulary字段中即可。
插件会自动识别并翻译以下标签:
| 标签 | 显示 | 说明 |
|---|---|---|
a1 |
基础生活词 | CEFR 等级(最基础词汇) |
a2 |
日常表达词 | CEFR 等级(日常交流词汇) |
b1 |
抽象/学术/稍复杂词 | CEFR 等级(进阶词汇) |
core |
核心词 | 核心常用词汇 |
idiom |
习语 | 习语/惯用语 |
slang |
俚语 | 俚语/口语表达 |
formal |
正式 | 正式场合用语 |
informal |
非正式 | 非正式场合用语 |
technical |
专业术语 | 专业领域词汇 |
💡 你也可以使用自定义标签(如
my-tag),插件会直接显示原文(首字母大写)。
打开 Obsidian 设置 → 快捷键,搜索「Custom Translate」,即可为以下功能设置自定义快捷键:
MIT
An Obsidian plugin for local translation and vocabulary management, designed to work with the open-source LibreTranslate.
This plugin depends on LibreTranslate translation service. Please ensure it is deployed and running.
docker run -d --name libretranslate -p 5000:5000 -m 1.5g --memory-swap 1.5g libretranslate/libretranslate:v1.9.5 --load-only en,zh
After deployment, set the API URL to http://127.0.0.1:5000/translate in plugin settings.
The API should accept POST requests with:
{
"q": "text to translate",
"source": "auto",
"target": "zh"
}
And return a response with a translatedText field.
{your_vault}/.obsidian/plugins/custom-translate/To quickly experience the plugin features, you can download the example configuration file:
example-data.json file💡 The example file is the value of
vocabulary. You can copy its content and replace thevocabularyfield in yourdata.jsonwith it.
The plugin automatically recognizes and translates the following tags:
| Tag | Display | Description |
|---|---|---|
a1 |
Basic daily words | CEFR level (most basic vocabulary) |
a2 |
Everyday expressions | CEFR level (daily communication) |
b1 |
Abstract/Academic/Slightly complex words | CEFR level (intermediate vocabulary) |
core |
Core | Core/common words |
idiom |
Idiom | Idiomatic expressions |
slang |
Slang | Slang/colloquial expressions |
formal |
Formal | Formal usage |
informal |
Informal | Informal usage |
technical |
Technical | Technical/domain-specific terms |
💡 You can also use custom tags (e.g.,
my-tag). The plugin will display them as-is (with the first letter capitalized).
Go to Obsidian Settings → Hotkeys and search for "Custom Translate" to set your own shortcuts for:
MIT