Home

Awesome

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

From local file

From remote link

Usage

Once you have the plugin installed simply, open any PDF in your collections.

Q&A

Q I want to translate manually.
A Go to Edit->Preferences->PDF Translate->General, uncheck the Automatic Translation. Click the translate button on the popup or sidebar 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 seletions and translate them together.
A Press Alt/Option when selecting text in PDF.

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

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

Q I want to change the font size.
A Go to Edit->Preferences->PDF Translate->Advanced and set the font size.

Settings

General

Service

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

Translate EngineRequire SecretSupported Languages
Google TranslateNo100+
Google Translate(API)NoUse translate.googleapis.com
CNKINohttps://dict.cnki.net
Youdao TranslateNo100+?
NiuTransYes400+
Youdao ZhiyunYes100+
Microsoft TranslateYes(free 2M)200+
LingoCloud(Caiyun) TranslateYeszh, en, ja, es, fr, ru
DeepL TranslateYes(free 500k)100+
Aliyun TranslateYes(free-1M)200+
Baidu TranslateYes(free-QPS1/free-2M)200+
Baidu FieldYes(free-QPS1/free-2M)en-zh
Tencent TranslateYes(QPS5, free-5M)15
GPT(OpenAI)Yes(free-$18)Based on the gpt-3.5-turbo model
GeminiYes(free-)Based on the Gemini Pro model

If the engine 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).

Microsoft Translate
Apply here. Copy your secret and paste it into the settings.
The secret format is MY_SECRET.

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

DeepL Translate
Apply here. The secret format is secretToken or secretToken#glossaryId (if you want to specify some translate glossary).

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

About VOCABID
登录控制台,选择文本翻译服务,点击右侧的术语表,选择新建,填写表名称和语言方向,添加需要的术语表,然后获取对应词表 id 即可。

Official Document

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

Chinese Document

Huoshan Apply here The secret format is accessKeyId#accessKeySecret

Aliyun Translate Apply here. The secret format is accessKeyId#accessKeySecret.

Chinere 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

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

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

GPT
Apply here.
The secret format is sk-#SecretKey(split with '#').

Support third-party compatible APIs.

Chinese Document

User Interface

Advanced

Development & Contributing

This addon 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. Add service config to src/utils/config.ts > SERVICES;
  2. Add translation task processor under src/modules/services/${serviceId}.ts with the same format with other services. The export function set the translation result to data.result if runs successfully and throw an error if fails;
  3. Import the task processor function in src/modules/services/index.ts.
  4. Add locale string service.${serviceId} in addon/chrome/locale/${lang}/addon.properties.
  5. Build and test.

Extra options for translate service

If the service requires extra options, the minimal implement would be putting them in the secret input in the prefs window, like the existing services does.

If there are complex options, please bind a callback in src/modules/settings/index.ts > secretStatusButtonData which create a highly customizable dialog window with ztoolkit.Dialog. See the example of NiuTrans login here: https://github.com/windingwind/zotero-pdf-translate/blob/main/src/modules/settings/niutrans.ts

Disclaimer

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

My Other Zotero Addons

Sponsors

Thanks peachgirl100 and other anonymous sponsors!

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

Contributors

<a href="https://github.com/windingwind/zotero-pdf-translate/graphs/contributors"> <img src="https://contrib.rocks/image?repo=windingwind/zotero-pdf-translate" /> </a>