zotero-pdf-translate README

The project's README from github.com/windingwind/zotero-pdf-translate. As one markdown file: README.md.

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

Usage

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

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

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+?
iCIBA Translate No [Free] https://www.iciba.com/translate
MyMemory No [Free 5k/day per IP] https://mymemory.translated.net/
(Free upgrade: enter your email in Settings to get 50k/day per IP quota)
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 LLM Translate 有道智云子曰大模型
Apply here.
The secret format is MY_APPID#MY_SECRET.

登录控制台,点击创建应用,输入应用名称,在选择服务一栏勾选大模型翻译,大模型翻译仅支持中英互译。

Official Document

NiuTrans
Apply here.
The secret format is MY_APIKEY#dictNo(optional)#memoryNo(optional).

Chinese Document

Microsoft Translate
Apply here. Copy your secret and paste it into the settings.
The secret format is serviceKEY#region(required if the region is not global).

See this issue for detailed steps to set up the Microsoft Translate.

LingoCloud(Caiyun) Translate
Apply here.

DeepL Translate
Apply official API or third-party API.
The secret format is secretToken or secretToken#glossaryId (if you want to specify some translate glossary).

Aliyun Translate
Apply here.
The secret format is accessKeyId#accessKeySecret#endpoint(optional).

The endpoint is the region of the service, default https://mt.aliyuncs.com. For cn-hangzhou, the endpoint is mt.cn-hangzhou.aliyuncs.com. See also here.

Chinese Document

Baidu Translate
Apply here.
The secret format is MY_APPID#MY_KEY#ACTION(optional, see https://api.fanyi.baidu.com/doc/21, default 0)(split with '#').

Baidu Field Translate 百度垂直领域翻译
Apply here.
The secret format is MY_APPID#MY_KEY#DOMAIN_CODE(split with '#').

Domain Code 领域 支持语言方向
it 信息技术领域 中文(简)-> 英语、英语 -> 中文(简)
finance 金融财经领域 中文(简)-> 英语、英语 -> 中文(简)
machinery 机械制造领域 中文(简)-> 英语、英语 -> 中文(简)
senimed 生物医药领域 中文(简)-> 英语、英语 -> 中文(简)
novel 网络文学领域 中文(简)-> 英语
academic 学术论文领域 中文(简)-> 英语、英语 -> 中文(简)
aerospace 航空航天领域 中文(简)-> 英语、英语 -> 中文(简)
wiki 人文社科领域 中文(简)-> 英语
news 新闻资讯领域 中文(简)-> 英语、英语 -> 中文(简)
law 法律法规领域 中文(简)-> 英语、英语 -> 中文(简)
contract 合同领域 中文(简)-> 英语、英语 -> 中文(简)

Chinese Document

OpenL Translate
Apply here.
The secret format is service1,service2,...#apikey(split with '#'; split service codes with ',').

Supported service codes are: deepl,youdao,tencent,aliyun,baidu,caiyun,wechat,sogou,azure,ibm,aws,google, See Service Code

Chinese Document

Tencent Translate
Apply here.
The secret format is secretId#SecretKey#Region(optional, default ap-shanghai)#ProjectId(optional, default 0)(split with '#').

Chinese Document

Xftrans 讯飞翻译
Apply here.

GPT
Apply OpenAI ChatGPT API or Azure OpenAI REST API.
The secret format is sk-* for ChatGPT, and MY_APIKEY for AzureGPT and Custom GPT.

Support third-party or self-deployed compatible APIs.

Chinese Document

Gemini
Apply here.
The secret format is MY_APIKEY.

Qwen-MT
Apply here.
The secret format is MY_APIKEY.

Claude
Apply here.

LibreTranslate
See LibreTranslate. API Key is optional.

MTranServer
See MTranServer. Token is optional.

MTranServer only supports zh-en language pairs for v2.1.1 and previous versions. For MTranServer v3.0.0+, please check the checkbox in the Config panel to use zh-Hans or zh-Hant language. See explanation of the supported languages.

NLLB
See nllb-api or NLLB Serve.

Pot
See Pot. Translate results show in Pot.

User Interface

Advanced

Development & Contributing

This plugin is built based on the Zotero Plugin Template. See the setup and debug details there.

To startup, run

git clone https://github.com/windingwind/zotero-pdf-translate.git
cd zotero-pdf-translate
npm install
npm run build

The plugin is built to ./build/*.xpi.

Contributing

Add new translate service

  1. Copy src/modules/services/_template.ts > src/services/<your-service-id>.ts;
  2. Fill in the required fields (id, type, and translate) and optional fields (name, helpUrl, defaultSecret, secretValidator(secret), and config(settings)) following the introduction. The translation function sets the translation result to data.result if runs successfully and throws an error if fails;
  3. Import the new service object in src/modules/services/index.ts.
  4. Add locale string service.${serviceId} and service-<your-service-id>-dialog-xxx(if necessary) in addon/locale/${lang}/addon.ftl.
  5. Build and test.

Disclaimer

Use this code under AGPL. No warranties are provided. Keep the laws of your locality in mind!

My Zotero Plugins

Sponsors

Thanks peachgirl100, youngfish42, and other anonymous sponsors!

If you want to leave your name here, please email me or leave a message with the donation.

Contributors

zotero-pdf-translate (windingwind/zotero-pdf-translate)

Searching Database…

Что это такое?Zotero PDF Translate — это плагин для Zotero, который переводит PDF, EPub, веб-страницы, метаданные, аннотации и заметки на ваш целевой язык.
Это отдельное приложение или плагин для Zotero?Это расширение (файл .xpi), которое вы устанавливаете в менеджер библиографии Zotero, а не отдельное приложение.
Нужен ли мне API-ключ для какого-нибудь сервиса перевода?Сервис по умолчанию, Google Translate, работает бесплатно и без секретного ключа; для других сервисов, таких как DeepL, Microsoft, Baidu, Aliyun, GPT или Gemini, нужно получить и ввести собственный секретный ключ API.
Одинаково ли он работает со всеми сервисами перевода?У каждого стороннего сервиса свой формат ключа и свои языковые ограничения: например, MTranServer в старых версиях поддерживает только пары zh-en, а некоторые сервисы доменов Baidu поддерживают только определённые направления перевода между китайским и английским.
Работает ли он в Windows, macOS и Linux?Да, как кроссплатформенный плагин для Zotero он работает везде, где работает Zotero, а сочетания клавиш немного различаются: Ctrl в Windows/Linux и Cmd в macOS.
Сколько сервисов перевода он поддерживает?Более 20, включая Google Translate, DeepL, Microsoft, Baidu, Aliyun, Tencent, Youdao, GPT, Gemini, Claude, а также варианты для самостоятельного развёртывания, такие как LibreTranslate и MTranServer.
Можно ли переводить выделенный текст прямо в аннотации PDF?Да, когда вы выделяете или подчёркиваете текст, перевод добавляется в комментарий к аннотации, и вы можете позже изменить его и перевести заново через Update Annotation.
Есть ли способ сравнить переводы из нескольких сервисов сразу?Да, отдельное окно перевода позволяет просматривать и сравнивать переводы из нескольких сервисов рядом.
Могу ли я добавить свой сервис перевода?Да, разработчики могут скопировать файл-шаблон сервиса, заполнить обязательные поля, такие как id и функцию translate, зарегистрировать сервис в индексе сервисов и добавить строки локализации перед сборкой.
Size
6.4 MB
Stars
12.1K
Age
4y
Commits · 90 Days