This is an add-on for Zotero 6. It provides PDF translation for Zotero's built-in PDF reader.
- Download the latest release (.xpi file) from the Releases Page
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 clickAddons
- Go to the Extensions page and then click the gear icon in the top right.
- Select
Install Add-on from file
. - Browse to where you downloaded the
.xpi
file and select it. - Restart Zotero, by clicking
restart now
in the extensions list where the Zotero PDF Translate plugin is now listed.
Once you have the plugin installed simply, open any PDF in your collections.
-
Select some text, the translations are shown on the popup and the right sidebar(v0.2.0);
-
Highlight some text, the translations are added to the annotation comment(v0.3.0); Modify & retranslate the annotation text in the sidebar 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).
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, titles' translation will show/hide.
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.
- Enable Translation, default
true
- Automatic Translation, default
true
- Enable Popup: Show results in a right-click popup or only in the side bar, default
true
- Automatic Annotation Translation: Save annotation's translation as comment, default
true
- Show '
Add to Note' in Popup: default
true
Unvisible if no active note editor opened.
The default engine is Google Translate. Currently, we support:
Translate Engine | Require Secret | Supported Languages |
---|---|---|
Google Translate | No | 100+ |
Google Translate(API) | No | Use translate.googleapis.com |
Youdao Translate | No | 100+? |
Niu Translate(Trial) | No | 100+ UNSTABLE |
Niu Translate | Yes | 100+ |
Microsoft Translate | Yes(free 2M) | 200+ |
LingoCloud(Caiyun) Translate | Yes | zh, en, ja, es, fr, ru |
DeepL Translate | Yes(free 500k) | 100+ |
Baidu Translate | Yes(free-QPS1/free-2M) | 200+ |
Tencent Translate | Yes(QPS5, free-5M) | 15 |
If the engine you want is not yet supported, please post an issue.
You can change the source and target language here. For some Translate Engines, the secret
is required. They are listed below:
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.
Niu Translate
Apply here.
The secret format is MY_APIKEY
.
Baidu Translate
Apply here.
The secret format is MY_APPID#MY_KEY
(split with '#').
Tencent Translate
Apply here.
The secret format is secretId#SecretKey#Region(optional, default ap-shanghai)#ProjectId(optional, default 0)
(split with '#').
Font Size
: The font size of result text, default12
SideBar: Show xxx
: Show or hide sidebar elements, defaulttrue
SideBar: Reverse Raw/Result
: Reverse the order of Raw/Result in the sidebar iftrue
, defaultfalse
- Disable Automatic Translation when File Language is(split with ','): If you want to disable automatic translation in
zh
andja
files, setzh,ja
.
This section is for developers.
This repo can be used as a Zotero 6.x addon template. To start with, clone this repo and install npm dependencies:
git clone [email protected]:windingwind/zotero-pdf-translate.git
cd zotero-pdf-translate
npm i
Change the settings in package.json
. Modify addonRef
and addonID
to avoid confliction.
This section shows the directory structure of a template.
- All
.js/.ts
code files are in./src
; - Addon config files:
./addon/chrome.manifest
,./addon/install.rdf
; - UI files:
./addon/chrome/content/*.xul
. Theoverlay.xul
also defines the main entrance; - Locale files:
./addon/chrome/locale/*.dtd
; - Resource files:
./addon/chrome/skin/default/__addonRef__/*.dtd
;
│ .gitignore
│ .release-it.json # release-it conf
| jsconfig.json # https://code.visualstudio.com/docs/languages/jsconfig#
│ build.js # esbuild
│ LICENSE
│ package.json # npm conf
│ README.md # readme
│ update.rdf # addon update
│
├─.github # github conf
│
├─addon # addon dir
│ │ chrome.manifest #addon conf
│ │ install.rdf # addon install conf
│ │
│ └─chrome
│ ├─content # UI
│ │ │ overlay.xul
│ │ │ preferences.xul
│ │ │
│ │ └─scripts
│ ├─locale # locale
│ │ ├─en-US
│ │ │ overlay.dtd
│ │ │
│ │ └─zh-CN
│ │ overlay.dtd
│ │
│ └─skin # style
│ └─default
│ └─zoteropdftranslate
│ favicon.png
│ [email protected]
│
├─builds # build dir
│ └─zotero-pdf-translate.xpi
│
├─imgs # readme images
│
└─src # source code
│ index.ts # main entry
│ base.ts # base class
│ PDFTranslate.ts # main class
│ events.ts # events class
│ reader.ts # reader class
│ translate.ts # translate class
│ view.ts # UI class
│ prefs.ts # preferences class
│
└─translate # translate engines
baidu.ts
caiyun.ts
config.ts
deepl.ts
google.ts
microsoft.ts
niutrans.ts
tencent.ts
youdao.ts
# A release-it command: version increase, npm run build, git push, and GitHub release
# You need to set the environment variable GITHUB_TOKEN https://github.com/settings/tokens
# release-it: https://github.com/release-it/release-it
npm run release
Alternatively, build it directly using build.js: npm run build
- Clean
./builds
- Copy
./addon
to./builds
- Esbuild to
./builds/addon/chrome/content/scripts
- Replace
__buildVersion__
and__buildTime__
in./builds/addon
- Copy
./src/preferences.js
to./builds/addon/chrome/content/scripts
- Zip the
./builds/addon
to./builds/*.xpi
Use this code under AGPL. No warranties are provided. Keep the laws of your locality in mind!
Part of the code of this repo refers to other open-source projects within the allowed scope.
- zotero-scihub
- zotero-tag
- zotero-better-bibtex(
d.ts
)
- zotero-tag: Automatically tag items/Batch tagging