MCPcopy
hub / github.com/windingwind/zotero-pdf-translate

github.com/windingwind/zotero-pdf-translate @v2.4.5 sqlite

repository ↗ · DeepWiki ↗ · release v2.4.5 ↗
325 symbols 743 edges 84 files 11 documented · 3%
README

Translate for ZoteroTranslate for Zotero

zotero target version Using Zotero Plugin Template

Translate for Zotero, a.k.a. Zotero PDF Translate, is a Zotero plugin.
Translate PDF, EPub, webpage, metadata, annotations, notes to the target language. Support 20+ translate services.

中文文档

Quick Start Guide

Install

Note If you're using Firefox as your browser, right-click the .xpi and select "Save As.."

  • In Zotero click Tools in the top menu bar and then click Plugins
  • Go to the Extensions page and then click the gear icon in the top right.
  • Select Install Plugin from file.
  • Browse to where you downloaded the .xpi file and select it.
  • Finish!

Usage

Open any PDF/EPub/webpage in the Zotero reader.

  • Select text, the translations are shown on the pop-up and the item pane(v0.2.0).

  • Highlight/Underline some text, the translations are added to the annotation comment(v0.3.0); Modify & retranslate the annotation text in the item pane and click the Update Annotation to modify the annotation text and translation(v0.6.6);

  • Add selected text along with translation to note(v0.4.0); Only works when a note editor is active.

  • Translate item titles with right-click menu or shortcut Ctrl+T(v0.6.0).

  • Translate item abstract with right-click menu(v0.8.0). Thanks @iShareStuff
  • Standalone translation window available(v0.7.0). View & compare translations from multiply services in one window!

  • Dictionary for single word translation(v0.7.1).

  • SentenceBySentence Translation(v1.1.0). After a translation, press shift+P and select Translate Sentences. Only for en2zh and en2en now. Thanks @MuiseDestiny
  • Since v2.2.0, the concat mode shortcut is ctrl (on Windows/Linux) or ⌘ (on macOS).

Q&A

Q I want to translate manually.
A Go to Edit->Settings->Translate->General, uncheck the Automatically Translate Selection. Click the Translate button on the pop-up or item pane to translate.

Q I want a translate shortcut.
A Press shortcut Ctrl+T after you selected some text. If you are in the collection view, the titles' translation will show/hide.

Q I want to concat different selections and translate them together.
A Press Ctrl/⌘ or select the Concat Mode check box on item pane when selecting text in PDF/EPub/webpage.

Q Not the language I want.
A The default target language is the same as your Zotero language. Go to Edit->Settings->Translate->Service and change the language settings.

Q Translation not correct or report an error.
A See Language Settings above and FAQ(#6). Make sure you use the right secret.

Q I want to change the font size.
A Go to Edit->Settings->Translate->User Interface and set the font size.

Q I want to resize the raw and result text area in the translate panel.
A Drag the separator up and down to adjust the size. Double-click the separator to reset the size.

Settings

General

  • Automatically Translate Selection, default true
  • Automatically Translate Annotation: Save annotation's translation to annotation comment or annotation body, default false
  • Automatically Translate Annotation from Sync: Automatically translate annotations synced from other devices if true, default false
  • Enable Reader Selection Pop-up: Show results in the pop-up panel or only in the item pane, default true
  • Show "Add Translation to Note" in Pop-up: default true

    Invisible if no active note editor opened.

  • Replace Raw: Use translation to replace the raw text when adding to note, default false
  • Enable Dictionary: Single word will be translated using dictionary service instead of translate service, default true
  • Show Play Buttons: Show the word pronunciation play buttons if available, default true
  • Auto-play Pronunciation, default false

Service

The default service is Google Translate. Currently, we support:

Translate Service Require Secret Supported Languages
Google Translate No [Free] 100+
Google Translate(API) No [Free] Use translate.googleapis.com
CNKI No [Free] https://dict.cnki.net
Haici Translate No [Free] https://fanyi.dict.cn
Youdao Translate No [Free] 100+?
Bing No [Free] en-zh
DeepLX No [Free] Based on DeepLX
DeepLX(API) No [Require config] DeepLX related projects
LibreTranslate Optional [Require config] LibreTranslate
MTranServer Optional [Require config] MTranServer
NLLB No [Require config] nllb-api or NLLB Serve
Pot No [Require config] Pot Translate results show in Pot
Huoshan Yes 50+
Volcengine Web No [Free] en, zh, and more (auto-detect, web version)
Youdao Zhiyun Yes 100+
Youdao LLM Yes LLM-based(en-zh)
Niu Trans Yes 400+
Microsoft Translate Yes(free 2M) 200+
LingoCloud(Caiyun) Translate Yes 10+
DeepL Translate Yes(free 500k) 100+
Aliyun Translate Yes(free-1M) 200+
Baidu Translate Yes(free-QPS1/free-2M) 200+
Baidu Field Yes(free-QPS1/free-2M) en-zh
OpenL Yes 11
Tencent Translate Yes(QPS5, free-5M) 15
Tencent Transmart No [Free] en, zh, and more (auto-detect, web version)
Xftrans Yes(free 2M) Xftrans API(70+), NiuTrans API(100+)
GPT Yes(free-$18) OpenAI(ChatGPT), AzureGPT, compatible GPT-like LLM (Custom GPT)
Gemini Yes(free-) LLM-based
Qwen-MT Yes(free-) LLM-based
Claude Yes LLM-based

If the service you want is not yet supported, please post an issue.

Google
Google does not require a secret, but you can put your own API URL in the secret to replace the default URL (translate.google.com/translate.googleapi.com).

Huoshan
Apply here.
The secret format is accessKeyId#accessKeySecret

Youdao Zhiyun Translate 有道智云
Apply here.
The secret format is MY_APPID#MY_SECRET#MY_VOCABID(optional).

About VOCABID
登录控制台,选择文本翻译服务,点击右侧的术语表,选择新建,填写表名称和语言方向,添加需要的术语表,然后获取对应词表 id 即可。
About Config -> Domain
登录控制台,点击创建应用,输入应用名称,在选择服务一栏勾选文本翻译,然后勾选领域化翻译即可开通领域化翻译。领域化翻译仅支持中英互译。

Official Document

**Youdao

Extension points exported contracts — how you extend this code

TranslateService (Interface)
(no doc)
src/modules/services/base.ts
TranslateTask (Interface)
(no doc)
src/utils/task.ts
Prefs (Interface)
(no doc)
typings/prefs.d.ts
ParsedResponse (Interface)
(no doc)
src/modules/services/gpt.ts
SecretValidateResult (Interface)
(no doc)
src/utils/secret.ts

Core symbols most depended-on inside this repo

getPref
called by 168
src/utils/prefs.ts
getString
called by 76
src/utils/locale.ts
setPref
called by 62
src/utils/prefs.ts
makeId
called by 40
src/modules/preferenceWindow.ts
onPrefsEvents
called by 26
src/modules/preferenceWindow.ts
_queryID
called by 25
src/elements/base.ts
addTextSetting
called by 24
src/utils/settingsDialog.ts
getLastTranslateTask
called by 14
src/utils/task.ts

Shape

Function 247
Method 53
Class 20
Interface 5

Languages

TypeScript100%

Modules by API surface

src/utils/task.ts19 symbols
src/utils/settingsDialog.ts19 symbols
src/modules/services/gpt.ts15 symbols
src/elements/panel.ts14 symbols
src/modules/services/index.ts12 symbols
src/hooks.ts12 symbols
src/elements/mathTextbox.ts12 symbols
src/modules/tabpanel.ts9 symbols
src/utils/crypto.ts8 symbols
src/modules/services/youdaozhiyunllm.ts8 symbols
src/modules/prompt.ts8 symbols
src/modules/services/xftrans.ts7 symbols

Dependencies from manifests, versioned

@eslint/js9.39.1 · 1×
@types/node22.16.5 · 1×
chokidar-cli3.0.0 · 1×
concurrently9.2.0 · 1×
cross-env10.1.0 · 1×
eslint9.39.1 · 1×
franc6.2.0 · 1×
husky9.1.7 · 1×
iso639-js1.1.3 · 1×
jsencrypt3.5.0 · 1×
katex0.16.25 · 1×
lint-staged16.2.7 · 1×

For agents

$ claude mcp add zotero-pdf-translate \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact