Git Product home page Git Product logo

tisfeng / raycast-easydict Goto Github PK

View Code? Open in Web Editor NEW
350.0 4.0 21.0 103.88 MB

A Raycast Extension for looking up words or translating text in an easy way. Support 48+ languages, support Linguee and Youdao dictionary, support OpenAI, DeepL, Google, Bing, Apple, Baidu, Tencent, Volcano, Youdao and Caiyun translation.

Home Page: https://www.raycast.com/isfeng/easydict

License: MIT License

TypeScript 96.79% Shell 0.09% JavaScript 2.33% Swift 0.79%
dictionary eudic raycast tencent apple shortcuts baidu caiyun deepl youdao

raycast-easydict's Introduction

Easydict

Easily look up words or translate text.

🇨🇳 🇺🇸 🇯🇵 🇰🇷 🇫🇷 🇪🇸 🇵🇹 🇮🇹 🇷🇺 🇩🇪 🇸🇦 🇸🇪 🇳🇱 🇷🇴 🇹🇭 🇸🇰 🇭🇺 🇬🇷 🇩🇰 🇫🇮 🇵🇱 🇨🇿 🇹🇷 🇱🇹 🇱🇻 🇺🇦 🇧🇬 🇮🇩 🇲🇾 🇸🇮 🇪🇪 🇻🇳 🇮🇷 🇵🇰 🇹🇱 🇹🇦 🇮🇳 🇵🇭 🇫🇮 🇰🇭 🇱🇦 🇧🇳 🇲🇲 🇳🇴 🇷🇸 🇭🇷 🇲🇳 🇮🇱

What is Easydict? 【中文介绍】

Easydict is an easy dictionary, for looking up words or translating text easily. Use it out of the box, automatically detect the input text language, and support Linguee and Youdao Dictionary, support OpenAI, 🍎 MacOS system translation, DeepL, Google, Bing, Baidu, Tencent, Volcano, Youdao, and Caiyun translation.

easydict-1-1671806758

OpenAI-Translate-1679670891

Features

  • Out of the box, easy to look up words or translate text.
  • Automatically detect the input language and automatically query the preferred language.
  • Provide word-rich query information, including basic translation, pronunciation, the types of exams that include the word, multiple parts of speech and explanations, forms and tenses, web translations, and web phrases.
  • Support automatic query selected text, enabled by default.
  • Support screenshot OCR translate.
  • Support to open the Eudic Dictionary and quickly look up words, if installed on your Mac.
  • Support automatic playback of word pronunciation. Use Cmd + S to play the pronunciation of words manually.
  • Support Youdao Text to Speech(TTS).
  • Support to sort query results manually.
  • Support Arguments.
  • Support Fallback Commands.
  • Support system proxy.
  • Support Linguee and Youdao Dictionary.
  • Support macOS system translation. (Please see How to use 🍎 macOS system translation in Easydict?)
  • Support OpenAI, DeepL, Google, Bing, Baidu, Tencent, Volcano, Youdao, and Caiyun translation.
  • Support 48+ languages.

If you like this extension, please give it a Star ⭐️, thanks!


Recommendation

My other project, Easydict is a concise and easy-to-use translation dictionary macOS App that allows you to easily and elegantly look up words or translate text, feel free to try it!

Look up word iShot_2023-03-17_18.01.22_11zon-1679056100

Translate text iShot_2023-01-28_17.49.53-1674901731

Auto select translate iShot_2023-01-20_11.01.35-1674183779

OCR screenshot translate iShot_2023-01-20_11.26.25-1674185209


Arguments

arguments-1666060638

hello-1666060655

Youdao Modern Chinese Dict

xiaxi-1665674049

yi-1665582552

ai

ai-1665582690

Linguee Dictionary:English <--> Chinese

easydict-3

image-20220822170315915

Linguee Dictionary:English <--> French

easydict-3

image-20220822163332948

Show More Details(Shortcut Cmd + M

showMore-1664440735

uk

Translation

easydict-4-1663604001

easydict-5-1663604086

easydict-6-1666538717

Installation

Easydict is an extension of Raycast, so you need to install Raycast first.

Raycast is a blazingly fast, totally extendable launcher. Similar to Alfred but it's completely free!

Install from Raycast Store

Manually Install

git clone https://github.com/tisfeng/Raycast-Easydict.git && cd Raycast-Easydict

npm install && npm run dev

Advanced

Actually, it works well without you having to do any extra work. The next are advanced documents for those who want to use Easydict better or understand how the extension works.

setting-1664441069

Supported Languages

Currently we support 48 languages: Chinese-Simplified, Chinese-Traditional, English, Japanese, Korean, French, Spanish, Portuguese, Italian, German, Russian, Arabic, Swedish, Romanian, Thai, Slovak, Dutch, Hungarian, Greek, Danish, Finnish, Polish, Czech, Turkish, Lithuanian, Latvian, Ukrainian, Bulgarian, Indonesian, Malay, Slovenian, Estonian, Vietnamese, Persian, Hindi, Telugu, Tamil, Urdu, Filipino, Khmer, Lao, Bengali, Burmese, Norwegian, Serbian, Croatian, Mongolian, Hebrew.

Language Detection

Currently, we support 5 language detection APIs, including Baidu, Tencent, Volcano, Apple and Bing. Apple language detection is a macOS feature, but you need to install a shortcut to use it.

Considering user privacy, only Bing language detection is enabled by default (no App Key is required, and no user personal data is recorded!) Other language detection APIs are enabled only when the corresponding translation feature is enabled. Note, however, that in general, the more language detection APIs are enabled, the more accurate the text will be and the faster the response time will be.

Details of the languages supported by each language detection service are as follows:

Languages Bing 🍎 Apple Baidu Volcano Tencent
Chinese (Simplified)
Chinese (Traditional)
English
Japanese
Korean
French
Spanish
Portuguese
Italian
German
Russian
Arabic
Swedish
Romanian
Thai
Slovak
Dutch
Hungarian
Greek
Danish
Finnish
Polish
Czech
Turkish
Lithuanian
Latvian
Ukrainian
Bulgarian
Indonesian
Malay
Slovenian
Estonian
Vietnamese
Persian
Hindi
Telugu
Tamil
Urdu
Filipino
Khmer
Lao
Bengali
Burmese
Georgian
Serbian
Croatian
Mongolian
Hebrew

Dictionary

Youdao Dictionary

Support 5 languages, (Chinese), English, French, Japanese, Korean.

Linguee Dictionary

Support 19 languages, (Chinese, Japanese, Russian), English, French, Spanish, Portuguese, Italian, German, Swedish, Romanian, Slovak, Dutch, Hungarian, Greek, Danish, Finnish, Polish, Czech.

Translation

Currently, we support DeepL, Google, Bing, 🍎 Apple, Baidu, Tencent, Volcano, Youdao and Caiyun translation, total 9 translation services.

Google and DeepL translations will use the system proxy by default. (DeepL works without a proxy, but sometimes requests time out)

Note ⚠️: Since the Chinese version of Google Translate is currently unavailable, you can only use the international version, so you need to use a proxy to use Google Translate.

Supported translation languages:

Languages Youdao DeepL Google Bing 🍎 Apple Baidu Volcano Tencent Caiyun
Chinese (Simplified)
Chinese (Traditional) ⚠️ ⚠️ ⚠️
English
Japanese
Korean
French
Spanish
Portuguese
Italian
German
Russian
Arabic
Swedish
Romanian
Thai
Slovak
Dutch
Hungarian
Greek
Danish
Finnish
Polish
Czech
Turkish
Lithuanian
Latvian
Ukrainian
Bulgarian
Indonesian
Malay
Slovenian
Estonian
Vietnamese
Persian
Hindi
Telugu
Tamil
Urdu
Filipino
Khmer
Lao
Bengali
Burmese
Norwegian
Serbian
Croatian
Mongolian
Hebrew

Note: ⚠️ means the translation of source language to Traditional Chinese is not supported, such as DeepL. If you enter Traditional Chinese for translation, it will be treated as Simplified Chinese.

Preferred Languages

The default preferred languages are simplified Chinese and English. You can change them according to your preferences.

Preference language has two main functions:

First, it improves the accuracy of automatic detection of input text language.

Preference language will be given priority in order during automatic detection. This is because some words may represent multiple languages at the same time, and the automatic detection program cannot work as expected. In most cases, the automatic detection of input text is very useful, except for very few special cases. For example, the English word heel will be automatically recognized into Dutch by Youdao translation, and then the translation results are not what we expect. At this time, if your Easydict preferred language contains English, it will be recognized into English first and translated correctly.

Second, it is used to confirm your target translation language.

For example, if you input a sentence arbitrarily, it will be translated into the first preferred language. If the automatically recognized language is the same as your first preferred language, it will be automatically translated into the second preferred language.

Automatic Query Selected Text

Automatic query selected text of the frontmost application, this option is turned on by default.

In order to better match the automatic selected text feature, it is a good idea to set a hotkey for Easydict, such as Cmd + E, so that after selected the text, you can directly query words through the hotkey, which is very smooth and elegant.

Automatic Play Query Word Pronunciation

Automatically play the word audio after querying the word, turned on by default.

Note that when this option is started, the voice will be played only when the query is judged to be is_Word and in English, e.g. good, look for, etc. For other queries, the voice can be played with the shortcut Cmd + S.

The content of playing voice: English words are pronounced by the online Youdao dictionary first, and other words are pronounced by the TTS service of Youdao translation. For long text playback, use the say command.

Use Cmd + S to play the pronunciation of words manually.

beauty

Select Target Language

Specify the target language. This option is turned off by default.

By default, the extension will automatically select the preferred language as the target translation language. However, sometimes if you want to manually specify a language as the target language, you can turn on this option in the preferences and then you can temporarily select another target language in the action panel.

Sort Query Results Manually

You can sort query results by your preference, default is Youao Dictionary, Linguee Dictionary, DeepL, Google, Bing, Apple, Baidu, Tencent, Volcano, Youdao, Caiyun.

Name case are insensitive, use comma to separate. Example: youdao dictionary, linguee dictionary, deepl, google, bing, apple, baidu, tencent, volcano, youdao, caiyun. You can also specify a part of the sort, for example: youdao dictionary, apple, tencent,the actual sort is: youdao dictionary, apple, tencent, linguee dictionary, deepl, google, bing, baidu, volcano, youdao, caiyun.

Note: This sort is the overall sort, if a translation service is not enabled, the sort will be automatically ignored.

🍎 Apple Translate

Easydict support MacOS system translate, for more information, please see How to use macOS Apple System Translation in Easydict?

System Proxy

When this feature is turned on, Easydict will try to get the Mac system agent, and if successful, all subsequent network requests will be sent through the system agent. It is disabled by default. This feature is intended to counter IP blocking (some services such as Linguee have frequency restrictions on IPs), **but it can slow down the response time to requests, so please enable it only when needed. **

Note ⚠️: Please don't turn on Use System Proxy while using the developer tools with MitM, otherwise some service requests will report certificate errors, for example: #18 .

Use with PopClip

You need to install PopClip first, then add a shortcut key for Easydict, such as Cmd + E, then you can open Easydict quickly with PopClip!

Usage: Select the following code block, PopClip will show "Install Easydict", just click it.

  # popclip
  name: Easydict
  icon: search E
  key combo: command E

Ref: https://github.com/pilotmoon/PopClip-Extensions#extension-snippets-examples

Translation Services

For easy to use, we provide some built-in translation APIs appid and appkey, but these Services have request frequency limits. If many people use them at the same time, it is likely to slow down or even stop. Therefore, for a better use experience, you'd better apply for a dedicated appid and appkey, and then replace the built-in services on the Preferences page.

Don't worry, these translation services have free quotas. Generally speaking, personal use is enough.

The following application tutorial is from Bob. Follow the tutorial and you should be able to complete the application soon.

A2ECFJ-1664270926

Acknowledgements

  • This project is inspired by raycast-Parrot and Bob, and the first version is based on raycast-Parrot. Easydict has improved many UI displays, added more practical features, deleted some complex or inappropriate operations, and made a lot of optimization && improvements on the original project.
  • OCR Translate feature refers to ScreenOCR, thanks to aidevjoe's PR feat: add OCR recognition.

raycast-easydict's People

Contributors

dependabot[bot] avatar hernandor avatar hezhizhen avatar izualx avatar kxxoling avatar liyaodong avatar raffeyang avatar rookiezn avatar tisfeng avatar zhenpengwu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

raycast-easydict's Issues

可以结合 PopClip 实现更好的使用体验

功能描述

结合 popclip 可以实现更高效的划词,所幸实现这一功能不需要太多努力

使用场景(可选)

CleanShot 2023-01-23 at 12 11 49

实现方法

  1. 安装 PopClip
  2. 仿照 Saladict 创建一个插件,其中 apple script 部分设置好触发快捷键
  3. 设置 Raycast 当中 EasyDict 的快捷键,应当与 PopClip 插件一致。

关于快捷键的问题。

功能描述

翻译是一个很高频的操作,我之前用的一个工具,可以双击 command键实现聚合翻译,这样既不容易误触也很容易快捷操作。

但是在 raycast 中的组合键又很容易和其他应用的快捷键冲突,设置太复杂了,又不方便触发翻译? 有什么好的办法吗?

Google 翻译出现异常

描述问题

目前谷歌翻译会报错,这是接口出了问题 ,似乎是谷歌关闭了谷歌**版翻译通道 https://translate.google.cn

参见:Google疑似关闭了Google翻译的**站点

解决

计划改用 https://translate.google.com 接口,但这个接口只能走代理,也就是说如果你想继续使用谷歌翻译,需要自行开启电脑上的代理软件,否则建议关闭谷歌翻译选项,用其他翻译替代。

Easydict 今后 Google 翻译会默认启用系统代理。与此同时,为了优化 DeepL 翻译体验,也将默认启用系统代理(DeepL 其实不走代理也能用,但发现有时会请求超时)。

使用 EasyDict 直接 crash

描述问题

使用 Raycast 翻译,会直接报错:

image

x2: The operation was aborted.

c:index.js:70:17
AbortSignal.m:easydict.js:162:17318
[nodejs.internal.kHybridDispatch]:event_target:731:20
AbortSignal.dispatchEvent:event_target:673:26

复现步骤

设置快捷键为 zms,然后查询任意单词即可复现

期望的结果

不报错

运行环境

macOS 13.1

Windows version

Hi.
Could you, please, make a Windows version of your app?

优化启动速度

每次打开的时候需要等待一定时间才能输入并显示,能不能优化一下启动速度(或者typing立刻显示,查询结果允许延迟)。

🚀 Feature Request: 添加一个单独的 Ollama 翻译服务

Please confirm the following:

  • I have carefully read the README
  • I have searched through the issues page and didn't find a similar feature request.(Including issue that has been closed)
  • Easydict has been upgraded to the latest version
  • I understand and agree to the above, and understand that the project maintainer has limited energy, issues that do not follow the rules may be ignored or closed directly

Feature description

在这个 PR #51 中,我们添加了 HTTP 请求支持和自定义 OpenAI model,借此已经可以实现本地 Ollama 翻译了。

但这样会占用原本的 OpenAI 翻译,因此我希望添加一个单独的 Ollama 翻译服务,让它们能够共存。

image

Use case

ollama 的一些模型如 yiqwen 翻译效果。

Proposed solution (optional)

No response

Are you willing to submit a PR to implement this feature

  • I'm willing to submit PR

或许可以窗口保持最前吗?

嗨~
首先感谢你们的开发🥳我认为这个插件真的非常非常的好用,解决了我工作流中的痛点,蟹蟹!
与此同时,想问一下,或许目前有或者未来有可能开发窗口置于最前这个功能吗,因为在翻译大段文字时,可能想要看着翻译内容做笔记,但是现在鼠标一点击别的地方,翻译框就消失了😂

回车键复制翻译结果

功能描述

翻译完成后,回车默认会打开对应翻译产品的官网。如果需要拷贝翻译结果,需要先按cmd+k再回车,请问是否可以更改为回车即复制结果呢?

🐞 反馈问题:不能自动 query 选中文本

请先确认以下事项

  • 已仔细阅读了 README
  • issues 页面搜索过问题,但未能找到解决方法
  • Easydict 已升级到最新版本

问题描述

raycast 已经更新到最新版本,同时 easydict plugin 也是应用商店内最新的版本。

设置如图:
image

重现步骤

在选中文本并敲击 快捷键时,并不会自动 query 选中文本:
image

求作者大大支支招。

期望结果

希望能够自动 query 选中文本。

解决方案(可选)

No response

🐞 反馈问题:OpenAI Translate Error While OpenAI Translate is disabled

请先确认以下事项

  • 已仔细阅读了 README
  • issues 页面搜索过问题,但未能找到解决方法
  • Easydict 已升级到最新版本

问题描述

The error notification pop up while OpenAI Translate is disabled, the error message the API token is not provided.
Screen Shot 2023-03-28 at 13 53 05

Screen Shot 2023-03-28 at 13 56 01

重现步骤

N/A

期望结果

If any service is disabled, the related error message should not pop up.

解决方案(可选)

No response

第一次启动查询延迟较长

第一次启动查询的时速度比较慢,是不是因为没有保持长连接,等一小段时间后再查询又需要再次建立连接。

请求添加Easydict原版就有的OCR功能,以及一些碎碎念

功能描述

Easydict原版就有的OCR功能,不太理解为什么插件版反而没有此功能🤔
相对的,Easydict原版反而没有私有API功能,只能说个人开发确实太忙、太辛苦了。

碎碎念

考虑到raycast内插件似乎不好做热键,也不如直接做软件市场更大,也许放弃raycast插件,集中精力做第三方软件才是更正确的,从功能性和营利性来看都是如此。
同理,十分感谢提供DeepL等宝贵的的Api,但是考虑到价格和用量,建议还是将DeepL、Google等相对难以获取的API作为付费功能,然后关闭彩云火山的自带借口,让用户自行导入免费Api,更加有利于健康发展。

🐞 反馈问题:新版本不能正常使用

请先确认以下事项

  • 已仔细阅读了 README
  • issues 页面搜索过问题,但未能找到解决方法
  • Easydict 已升级到最新版本

问题描述

  1. query specified in argument 不会传进 command 内
  2. 一直在加载,不加载 result

重现步骤

N/A

期望结果

N/A

解决方案(可选)

No response

🚀 功能建议:调用本地Eudic查词

请先确认以下事项

  • 已仔细阅读了 README
  • issues 页面搜索过,未发现类似功能建议
  • Easydict 已升级到最新版本

功能描述

建议添加本地欧路词典查词,而不是查询结果后,再通过更多命令打开Eudic。
不知道这个好实现么?

使用场景(可选)

No response

实现方案(可选)

No response

bug

image

第一次输完你按空格后,后续的输入再按空格会变成拼音

🥹 寻找对该项目感兴趣,有意继续开发和维护的小伙伴

这个项目当初只是我一时兴起做的,当时甚至想过开发一个跨平台桌面版的 Easydict,而不仅仅只是一个 Raycast 扩展,但受限于自己业余低劣的 JS 水平,最终放弃了 tisfeng/Easydict#57 (comment)

现在,我的精力主要在另一个项目 Easydict ,如果有小伙伴想继续参与维护这个项目,我可以邀请你加入,Raycast 商店版也一样 https://www.raycast.com/isfeng/easydict

如果没有,那这个项目将会进入缓慢维护阶段,只接受 PR,不再接受 issue。

Easydict

Easdict

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.