PDF translation add-on for Zotero 6

Overview

PDFTranslateZotero PDF Translate

This is an add-on for Zotero 6. It provides PDF translation for Zotero's built-in PDF reader.

Quick Start Guide

Install

  • 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 click Addons
  • 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.

Usage

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);

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

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 T after you selected some text.

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-Functions

  • 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 'PDFTranslateAdd to Note' in Popup: default true

    Unvisible if no active note editor opened.

General-Translate Engine

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.

General-Language Settings

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.

Chinese Document

Baidu Translate
Apply here.
The secret format is MY_APPID#MY_KEY(split with '#').

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

Advanced-UI

  • Font Size: The font size of result text, default 12
  • SideBar: Show xxx: Show or hide sidebar elements, default true
  • SideBar: Reverse Raw/Result: Reverse the order of Raw/Result in the sidebar if true, default false

Advanced-Others

  • Disable Automatic Translation when File Language is(split with ','): If you want to disable automatic translation in zh and ja files, set zh,ja.

Development

This section is for developers.

Use this repo as a Zotero Addon Template

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.

Directory Structure

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. The overlay.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
│  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.js     # main entry
    │  PDFTranslate.js  # main class
    │  preferences.js   # pref functions, no esbuild
    │  reader.js    # Zotero.Reader functions
    │  translate.js # translate functions
    │  view.js      # UI functions
    │
    └─translate     # translate engines
            baidu.js
            caiyun.js
            config.js
            deepl.js
            google.js
            microsoft.js
            niutrans.js
            tencent.js
            youdao.js

Build

# 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

Build Steps

  1. Clean ./builds
  2. Copy ./addon to ./builds
  3. Esbuild to ./builds/addon/chrome/content/scripts
  4. Replace __buildVersion__ and __buildTime__ in ./builds/addon
  5. Copy ./src/preferences.js to ./builds/addon/chrome/content/scripts
  6. Zip the ./builds/addon to ./builds/*.xpi

Disclaimer

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

My Other Zotero Addons

  • zotero-tag: Automatically tag items/Batch tagging
Comments
  • [Bug] 谷歌Api中国翻译无法使用

    [Bug] 谷歌Api中国翻译无法使用

    Environment

    • OS: Windows
    • Zotero Version 6.0.13
    • Zotero PDF Translate Version(0.8.24)

    Additional context Zotero PDF Translate 使用过程中的翻译问题:

    今天使用Zotero进行论文翻译时突然无法正常使用(PS:9.27晚上还是正常的),查看Zotero PDF Translate信息后发现今天您更新了插件,经过测试发现,只有CNKI学术翻译和彩云两个api可以使用。

    其他几个api分别出现了不同的问题,汇总信息如下: 1. 谷歌Api中国可用 请求错误] 此翻译引擎不可用,可能是密钥错误,也可能是请求过快 可以尝试其他翻译引擎,或者来此查看相关回答: https://github.com/windingwind/zotero-pdf-translate/issues

    请注意,这些错误与zotero和此翻译插件无关! 错误详情如下:

    谷歌API(中国可用). Error: Request timed out 2. DeepL(Free)* 请求错误]

    此翻译引擎不可用,可能是密钥错误,也可能是请求过快 可以尝试其他翻译引擎,或者来此查看相关回答: https://github.com/windingwind/zotero-pdf-translate/issues

    请注意,这些错误与zotero和此翻译插件无关! 错误详情如下:

    DeepL(Free)*. Error: HTTP POST https://api-free.deepl.com/v2/translate failed with status code 403

    1. 小牛 [请求错误]

    此翻译引擎不可用,可能是密钥错误,也可能是请求过快 可以尝试其他翻译引擎,或者来此查看相关回答: https://github.com/windingwind/zotero-pdf-translate/issues

    请注意,这些错误与zotero和此翻译插件无关! 错误详情如下:

    小牛*. 13002:apikey is empty

    bug 
    opened by waityousea 23
  • [Feature] A PDF Translation Annotation Button on popmenu or translate pane

    [Feature] A PDF Translation Annotation Button on popmenu or translate pane

    When I opened a PDF with highlights, all highlights were translated and stored with the highlights if the Translation Annotation was checked in Preferences. However, most of them were not needed to be translated or stored. I would like only to store several of the translations for future reference. It may be a solution that a button on the popmenu or translate pane was added to allow users to make choices.

    Another suggestion:

    Whether a Copy Both beside Copy Raw and Copy Result buttons could be considered to make users copy both raw and result separated by a line break. It would be more convenient to copy them to other editors to build a corpus.

    Or, more directly, adding a button to store all the needed text and translation in an item child note with a special title or tag (such as Golden Sentence like a bioinformatic program TBtools developed by @CJ-Chen). The function of Golden Words, Golden Sentences in TBtools (link1, link2) should be easily implemented with your plugin, zotero's note editor (support some HTML tags) and note export function.

    enhancement 
    opened by zyx335588 18
  • [Need Help] Purchase Translation API?

    [Need Help] Purchase Translation API?

    I've received some suggestions about supporting more translate engines, like DeepL, Caiyun, etc. However, these translate services usually require payment to get the full API.

    This means either requiring the user to go through tedious steps to set up a key (and possibly paying for it), or requiring me to provide a full API with no restrictions. The latter requires a relatively large fee, but I cannot currently afford it.

    The prices are listed below:

    • DeepL US$6.99 per month unlimited
    • Microsoft $10 per million chars of standard translation

    Looking for suggestions!

    help wanted 
    opened by windingwind 16
  • [Bug]关于谷歌API(中国可用)似乎出bug

    [Bug]关于谷歌API(中国可用)似乎出bug

    Describe the bug 采用谷歌API(中国可用)翻译引擎时,单词可以翻译,但是两个单词以上或一个句子时就无法翻译。

    To Reproduce Steps to reproduce the behavior:

    1. 划一个词,出现翻译结果
    2. 划两个词,显示请求超时
    3. 划一个句子,也显示请求超时

    Expected behavior A clear and concise description of what you expected to happen.

    Screenshots image

    image

    Environment

    • OS: Windows
    • Zotero Version(Help->About Zotero):6.0.13
    • Addon Version(Tools->Add-ons):0.8.23

    Additional context Add any other context about the problem here.

    bug 
    opened by handsome-77 15
  • [Bug] CNKI Translate

    [Bug] CNKI Translate

    我用的是最新版本的翻译插件,但是用CNKI学术翻译一直报错说 [请求错误]

    此翻译引擎不可用,可能是密钥错误,也可能是请求过快 可以尝试其他翻译引擎,或者来此查看相关回答: https://github.com/windingwind/zotero-pdf-translate/issues

    请注意,这些错误与zotero和此翻译插件无关! 错误详情如下:

    CNKI学术翻译. 想知道这是为什么啊,有什么解决办法吗,谢谢

    bug 
    opened by taetaem 13
  • [Help wanted] 网搜无果,纯小白求帮助(我想规范加一个label提问的,但我不会,请见谅~)

    [Help wanted] 网搜无果,纯小白求帮助(我想规范加一个label提问的,但我不会,请见谅~)

    @windingwind 你好,有道智云控制台似乎更新了,你给的”Tern字幕组机翻小助手“那个参考步骤似乎不适用啦。现在创建应用后需要去“查看文档“,再”调试代码“。我现在已经创建应用成功啦,但在”创建示例“和将“应用和示例”这一步卡住了,请问要怎么办呢?另外,我是一个纯小白,请问我在有道的控制台创建应用后,已经有一个“ID”和"密钥“了,我看你在插件的主页也给了一个密钥MY_APPID#MY_SECRET#MY_VOCABID(optional),还有VOCABID那里也不太懂,请问我到底要怎样操作才能在Zotero里使用有道智云翻译呢?问题好长,感谢看完,期待回复~

    opened by neuronsandsynapses 13
  • [Bug]小牛翻译功能失效

    [Bug]小牛翻译功能失效

    你好,我想请问一下小牛翻译上一秒还可以用,下一秒就翻译不了了,我看solution那里好像是说显示change translate engine,是用不了这个了的意思吗?谢谢~

    [请求错误]

    此翻译引擎不可用,可能是密钥错误,也可能是请求过快 可以尝试其他翻译引擎,或者来此查看相关回答: https://github.com/windingwind/zotero-pdf-translate/issues

    请注意,这些错误与zotero和此翻译插件无关! 错误详情如下:

    小牛*. Error: Request timed out

    bug 
    opened by Dawnshyc 12
  • 希望能给弹窗写入权限,方便选中需要的文字保存到笔记,而不是点击了复制整个再去添加标记,这样很麻烦,因为我是个懒人。谢谢攻城狮

    希望能给弹窗写入权限,方便选中需要的文字保存到笔记,而不是点击了复制整个再去添加标记,这样很麻烦,因为我是个懒人。谢谢攻城狮

    Before Issue/提问之前

    1. See #6 and search the Issues Page to make sure this is not a duplicated issue;

    Issues not in the template format will be ignored/不按模板格式或不完整填写模板内容的提问将不会被回复。如果你看不懂英文可以用中文提问,但请有礼貌地详细描述你的问题,不要浪费大家的时间!!!

    Edit the template below and delete the section above/必须准确详细地填写编辑以下提问模版,并删除上面的内容,否则不会被回复

    Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

    Describe the solution you'd like A clear and concise description of what you want to happen.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

    enhancement 
    opened by 754932057 12
  • [Vote]将翻译的中文内容加入引用的内容中,不要加入评论内容中

    [Vote]将翻译的中文内容加入引用的内容中,不要加入评论内容中

    如果点选了自动翻译批注,批注了英文文章某些语句并翻译后,翻译内容会自动填入评论comments的区域,但是这样对于本身我要增加评论就会有些不便,是否可以将翻译内容另起一行添加到批注内容之后。

    理由和逻辑是:批注和翻译是批注的内容;comments是comments内容,两者从逻辑上不太一样,建议分开

    enhancement 
    opened by SeaCheChe 12
  • [Feature] Modify Annotation Translation

    [Feature] Modify Annotation Translation

    Yes, replace the original annotation text which highlighted will be better ,not add to comment area. False identification does not happen very often, but occasionally. If annotated citation text can be added from a area where they can be modified into the correct text, why not? 图片

    Originally posted by @lil-i321 in https://github.com/windingwind/zotero-pdf-translate/issues/89#issuecomment-1099960421

    enhancement 
    opened by windingwind 12
  • 不打开弹窗翻译,侧边栏不能自动翻译[Feature]

    不打开弹窗翻译,侧边栏不能自动翻译[Feature]

    Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

    Describe the solution you'd like A clear and concise description of what you want to happen.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

    bug 
    opened by Syzygy33 12
  • [Bug]Mac OS系统无法“添加翻译笔记”

    [Bug]Mac OS系统无法“添加翻译笔记”

    Describe the bug A clear and concise description of what the bug is. 在PDF中选取所需要的文字,自动弹出翻译,并显示出“添加翻译笔记”的按钮,但是点击“添加翻译笔记”的按钮后,只能显示出原文,无法显示中文翻译。

    To Reproduce Steps to reproduce the behavior:

    1. 选择需要翻译的文字
    2. 弹窗中显示 1672822139152
    3. 点此此按钮
    4. 右侧笔记中只能显示原文而无法显示翻译

    Expected behavior 理应在右侧笔记中出现中文翻译。

    Screenshots 1672822265636

    Environment

    • OS: macOS 12.6.2
    • Zotero Version 6.0.19
    • Addon Version 0.9.8

    Additional context Add any other context about the problem here.

    bug 
    opened by Sunzhiyu123 1
  • build(deps-dev): bump zotero-types from 0.0.8 to 0.1.2

    build(deps-dev): bump zotero-types from 0.0.8 to 0.1.2

    Bumps zotero-types from 0.0.8 to 0.1.2.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • [Feature] Hello! l love this plugin

    [Feature] Hello! l love this plugin

    I am using this plugin just fine. However, there is no Korean dictionary, so it is a bit inconvenient. Can't you add a Korean dictionary in advance? Thank you for always.

    enhancement 
    opened by newgenes 3
  • 希望能加入夜间模式

    希望能加入夜间模式

    Before Issue/提问之前

    1. See #6 and search the Issues Page to make sure this is not a duplicated issue;

    Issues not in the template format will be ignored/不按模板格式或不完整填写模板内容的提问将不会被回复。如果你看不懂英文可以用中文提问,但请有礼貌地详细描述你的问题,不要浪费大家的时间!!!

    Edit the template below and delete the section above/必须准确详细地填写编辑以下提问模版,并删除上面的内容,否则不会被回复

    Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

    Describe the solution you'd like A clear and concise description of what you want to happen.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

    enhancement 
    opened by torch132 0
Releases(v0.9.8)
Owner
null
Obsidian.md plugin to integrate with Zotero, create literature notes and insert citations from a Zotero library.

Obsidian Zotero Plugin Obsidian.md plugin to integrate with Zotero, create literature notes and insert citations from a Zotero library. Intro How to u

null 156 Jan 6, 2023
PDF Preview for Zotero.

Zotero PDF Preview Preview PDF attachments in the library view. Fast & easy. Do not require any third-party softwares. Quick Start Guide Install Downl

null 352 Jan 4, 2023
I'm trying to create simple program for adding the digital signature to a pdf file with self-signed certificate. I use node-signpdf and pdf-lib library.

pdf-digital-signature-with-node-signpdf-ejs I'm trying to create simple program for adding the digital signature to a pdf file with self-signed certif

null 5 Dec 25, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A good-looking Zotero add-on.

Chartero 简介 记录Zotero内置阅读器的浏览历史并通过各种图形呈现出来,方便读者对过去一段时间内学习过程的复盘与回顾。 使用说明 首选项参数 扫描周期:阅读时记录页码的时间间隔,推荐1秒 保存周期:保存历史数据的时间间隔,过小会导致卡顿 仪表盘 选择文献条目后,右侧边栏将出现“仪表盘”选

PasCal++ 104 Dec 20, 2022
Wrapper for PDF JS to add annotations

FabricJS layer on top of Mozilla's PDFJS to add ANNOTATIONS Features Supports PDFs with multiple pages Free draw tool Add text Add arrows Add rectangl

Ravisha Heshan 231 Jan 6, 2023
Japanese translation of vitejs.dev

Vite Docs JA Vite ドキュメントの日本語翻訳レポジトリです。現状、本レポジトリは翻訳作業用のものとして一時的に用意されています。将来的に、本レポジトリは別場所に移動される可能性があります。 貢献ガイド Vite 日本語翻訳ガイド を一読お願いします! はじめかた 本ドキュメントは V

vite 50 Dec 14, 2022
Offer a translation system to your users! a plugin capable of translating your website, simply and efficiently!

TranslateForMe Offer a translation system to your users, a plugin capable of translating your website, simply and efficiently! View Demo · Report Bug

Eduardo Castro 3 Jan 12, 2022
Font-end app to test the transformer model translation from Cape Verdian Creole to English

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Roberto Carlos 5 Sep 28, 2022
🚧 WIP: Bartosz Milewski's "Category Theory for Programmers" Korean translation 📚

프로그래머를 위한 범주론 본 레파지토리는 Bartosz Milewsk의 Category Theory for Programmers을 번역하며 학습한 레파지토리입니다. ?? 목차 Part 1. 범주:합성의 본질 타입과 함수 크고 작은 범주 Kleisli Categories

Minsu Kim 22 Aug 18, 2022
Simple, universal translation with pure JavaScript.

Simple Translator Simple, client-side translation with pure JavaScript. Table of Contents The problem The solution Installation In the browser Using N

Andreas Remdt 66 Nov 18, 2022
Translate text in images using Vision API, Translation API and Jimp

translate-image-text Translate text in images using Vision API, Translation API Rendered using React and canvas Installation Create a Google Cloud pro

Huy Le 4 Oct 26, 2022
Translate text in images using Vision API, Translation API and React with Canvas

manga-translator Manga translator app using Vision API, Translation API Rendered using React and canvas Installation Create a Google Cloud project, en

Huy Le 4 Oct 26, 2022
Zotero translator 优化

1. Zotero translators 中文维护小组-开智分组 2. 背景 响应阳老师剥削机器而非剥削人,为国内优质信息源新增translator,利用好工具提高效率 3. 安装 3.1. zotero安装 参考:Zotero(1):文献管理软件Zotero基础及进阶示范 - 阳志平的网志 3.

氦客船长 56 Dec 24, 2022
A plugin that will automatically download PDFs of zotero items from sci-hub

Zotero Scihub This is an add-on for Zotero and Juris-M that enables automatic download of PDFs for items with a DOI. Quick Start Guide Install Downloa

Ethan Willis 1.9k Jan 8, 2023
A note enhancement & full knowledge management workflow for Zotero.

Knowledge for Zotero A full knowledge management workflow in Zotero. User Guide(EN) | 用户指引(中文) Review.Writing.Best.Practice.mp4 Features Note as you g

null 1.3k Jan 9, 2023
Everything about note management. All in Zotero.

Zotero Better Notes Everything about note management. All in Zotero. User Guide(EN) | 用户指引(中文) All in Zotero: Best Note Practice Review.Writing.Best.P

null 1.3k Jan 9, 2023