GithubHelp home page GithubHelp logo

xfslove / alfred-google-translate Goto Github PK

View Code? Open in Web Editor NEW
615.0 13.0 65.0 61.11 MB

Alfred 3 workflow - translate with google api💵🚫

License: MIT License

JavaScript 100.00%
alfred3-workflow google-translate

alfred-google-translate's Introduction

Hi, all, due to the busy work, and not much time for maintenance, look forward to someone will fork and keep going. 🙏

alfred-google-translate

NPM

JetBrains' support

jetbrain

Installation

Requires the Alfred 3 or 4 Powerpack, Node.js 8+, and the alfred-language-configuration workflow.

To use this workflow you must also install the alfred-language-configuration workflow, and configure the language pair. See that README for instructions.

With NPM

  • Install with npm install -g alfred-google-translate.

Manually

Changelog

See all past and current releases.

Usage

Alfred workflow Keyword: tr [word or sentence] Example: tr kitchen sink or tr Hello, my name is Alfred

When translating a word you will see the translation as well as alternate translations if available.

With the first two results (which are the input word and the translation) you can…

  • press enter to read the item.
  • press cmd+C to copy the item.
  • press shift open the translate website.
  • press cmd+L to show the translation in large text.

The workflow will attempt to correct spelling mistakes which can be accepted with enter.

Environment Variables

name default value description
domain https://translate.google.com if you cannot access the default domain, you can config this.
大陆访问不了默认域名,所以如果使用2.x版本需要将这个变量设置为https://translate.google.cn. 或者还是使用1.x版本
voice remote avaliable values:
remote: fetch voice from google,
local: use macOS local voice (notice: maybe only works on English),
none: dont use voice
save_count 20 limit the translation history, see alfred-translate-history.
a value of 0 will keep no history
socks_proxy - not turned by default. you can specify local or remote socks proxy. format: socks://{host}:{port} example: local shadowsocks proxy 'socks://127.0.0.1:1086'
environment variables config snapshot:

env-config.png

env.png

Hotkey

If you download the workflow, you may have to manually set the hotkey yourself.

hotkey config snapshot:

hotkey.png

hotkey-config.png

hotkey and largetype snapshot:

result

Screenshots

corrected.png

  • press enter to read or cmd+C to copy

    general.png

  • press shift to open the translation website

    quicklook.png

  • press cmd+L to show the translation in large text like this.

Related

License

MIT ©

alfred-google-translate's People

Contributors

crazybunqnq avatar dcatfly avatar dependabot[bot] avatar frankupup avatar lingyv avatar warpling avatar xfslove 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alfred-google-translate's Issues

run error

[14:34:43.543] Logging Started...
[14:34:56.692] Google Translate[Script Filter] Queuing argument 'goo'
[14:34:57.242] Google Translate[Script Filter] Queuing argument 'google'
[14:35:04.274] Google Translate[Script Filter] Script with argument 'google' finished
[14:35:04.278] ERROR: Google Translate[Script Filter] Code 1: {
"items": [
{
"title": "google",
"subtitle": "Phonetic: ˈgo͞ogəl",
"quicklookurl": "https://translate.google.cn/#view=home&op=translate&sl=auto&tl=en&text=google",
"arg": "/var/folders/fv/jbxz4v8944l5z47y3mc52h600000gn/T/5a946a2a-2242-4656-9b7a-c0456e3daaa8.mp3",
"text": {
"copy": "google",
"largetype": "google"
},
"icon": {
"path": "tts.png"
}
},
{
"title": "google",
"subtitle": "Phonetic: ",
"quicklookurl": "https://translate.google.cn/#view=home&op=translate&sl=en&tl=auto&text=google",
"arg": "/var/folders/fv/jbxz4v8944l5z47y3mc52h600000gn/T/8304a186-edab-4570-92c2-9de707684d9e.mp3",
"text": {
"copy": "google",
"largetype": "google"
},
"icon": {
"path": "tts.png"
}
},
{
"title": "Definition[动词]: search for information about (someone or something) on the Internet using the search engine Google.",
"subtitle": "Example: I recently googled my 7th grade teacher and found his current e-mail address",
"quicklookurl": "https://translate.google.cn/#view=home&op=translate&sl=auto&tl=en&text=google",
"text": {
"copy": "search for information about (someone or something) on the Internet using the search engine Google.",
"largetype": "Definitions: search for information about (someone or something) on the Internet using the search engine Google.\n\nExample: I recently googled my 7th grade teacher and found his current e-mail address"
}
}
]
}
{
"items": [
{
"title": "HTTPError: Response code 404 (Not Found)\nUrl: https://translate.google.cn/translate_tts?client=t&tl=auto&ie=UTF-8&idx=0&total=1&textlen=6&q=google&tk=734758.889464\n at /Users/zbl/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.6B6BE3E4-03F9-4C9A-A9A9-68C305B7A59F/node_modules/got/index.js:123:13\n at processTicksAndRejections (internal/process/task_queues.js:85:5)",
"subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
"valid": false,
"text": {
"copy": "\nHTTPError: Response code 404 (Not Found)\nUrl: https://translate.google.cn/translate_tts?client=t&tl=auto&ie=UTF-8&idx=0&total=1&textlen=6&q=google&tk=734758.889464\n at /Users/zbl/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.6B6BE3E4-03F9-4C9A-A9A9-68C305B7A59F/node_modules/got/index.js:123:13\n\n\n-\nGoogle Translate 2.0.5\nAlfred 4.0.1\ndarwin x64 19.0.0",
"largetype": "HTTPError: Response code 404 (Not Found)\nUrl: https://translate.google.cn/translate_tts?client=t&tl=auto&ie=UTF-8&idx=0&total=1&textlen=6&q=google&tk=734758.889464\n at /Users/zbl/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.6B6BE3E4-03F9-4C9A-A9A9-68C305B7A59F/node_modules/got/index.js:123:13"
},
"icon": {
"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
}
}
]
}
[14:35:04.320] ERROR: Google Translate[Script Filter] JSON error: Garbage at end. in JSON:
{
"items": [
{
"title": "google",
"subtitle": "Phonetic: ˈgo͞ogəl",
"quicklookurl": "https://translate.google.cn/#view=home&op=translate&sl=auto&tl=en&text=google",
"arg": "/var/folders/fv/jbxz4v8944l5z47y3mc52h600000gn/T/5a946a2a-2242-4656-9b7a-c0456e3daaa8.mp3",
"text": {
"copy": "google",
"largetype": "google"
},
"icon": {
"path": "tts.png"
}
},
{
"title": "google",
"subtitle": "Phonetic: ",
"quicklookurl": "https://translate.google.cn/#view=home&op=translate&sl=en&tl=auto&text=google",
"arg": "/var/folders/fv/jbxz4v8944l5z47y3mc52h600000gn/T/8304a186-edab-4570-92c2-9de707684d9e.mp3",
"text": {
"copy": "google",
"largetype": "google"
},
"icon": {
"path": "tts.png"
}
},
{
"title": "Definition[动词]: search for information about (someone or something) on the Internet using the search engine Google.",
"subtitle": "Example: I recently googled my 7th grade teacher and found his current e-mail address",
"quicklookurl": "https://translate.google.cn/#view=home&op=translate&sl=auto&tl=en&text=google",
"text": {
"copy": "search for information about (someone or something) on the Internet using the search engine Google.",
"largetype": "Definitions: search for information about (someone or something) on the Internet using the search engine Google.\n\nExample: I recently googled my 7th grade teacher and found his current e-mail address"
}
}
]
}
{
"items": [
{
"title": "HTTPError: Response code 404 (Not Found)\nUrl: https://translate.google.cn/translate_tts?client=t&tl=auto&ie=UTF-8&idx=0&total=1&textlen=6&q=google&tk=734758.889464\n at /Users/zbl/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.6B6BE3E4-03F9-4C9A-A9A9-68C305B7A59F/node_modules/got/index.js:123:13\n at processTicksAndRejections (internal/process/task_queues.js:85:5)",
"subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
"valid": false,
"text": {
"copy": "\nHTTPError: Response code 404 (Not Found)\nUrl: https://translate.google.cn/translate_tts?client=t&tl=auto&ie=UTF-8&idx=0&total=1&textlen=6&q=google&tk=734758.889464\n at /Users/zbl/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.6B6BE3E4-03F9-4C9A-A9A9-68C305B7A59F/node_modules/got/index.js:123:13\n\n\n-\nGoogle Translate 2.0.5\nAlfred 4.0.1\ndarwin x64 19.0.0",
"largetype": "HTTPError: Response code 404 (Not Found)\nUrl: https://translate.google.cn/translate_tts?client=t&tl=auto&ie=UTF-8&idx=0&total=1&textlen=6&q=google&tk=734758.889464\n at /Users/zbl/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.6B6BE3E4-03F9-4C9A-A9A9-68C305B7A59F/node_modules/got/index.js:123:13"
},
"icon": {
"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
}
}
]
}

macos 10.15
alfred 4.0.1
alfred-google-translate:2.0.5

Run with error.

Error in the console:
[ERROR: input.scriptfilter] Code 1: /Users/Matthew/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/alfred-google-translate/index.js:65
const [text, relation] = x;
^

SyntaxError: Unexpected token [
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:142:18)
at node.js:939:3

node version:
v5.9.0
-> v11.14.0
system
default -> node (-> v11.14.0)
node -> stable (-> v11.14.0) (default)
stable -> 11.14 (-> v11.14.0) (default)
iojs -> N/A (default)
lts/* -> lts/dubnium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.16.0 (-> N/A)
lts/dubnium -> v10.15.3 (-> N/A)

Action items appear not to be working.

In alfred when on the 1st or 2nd item I can not copy, lookup or do any of the action commands you outlined. It will only speak the text.

Note: I over wrote this to just spit out the text translation in the index.js file by using the toText variable instead of the toArg

This output isn't very interesting or informative but hope it helps.

Output when hitting [Enter]

[12:13:38.638] Google Translate[Script Filter] Queuing argument 'testing'
[12:13:47.558] Google Translate[Script Filter] Queuing argument 'testing'
[12:13:48.454] Google Translate[Script Filter] Script with argv 'testing' finished
[12:13:48.457] Google Translate[Script Filter] {
"items": [
{
"title": "testing",
"subtitle": "Phonetic: ",
"quicklookurl": "https://translate.google.com/#view=home&op=translate&sl=en&tl=de&text=testing",
"arg": "/var/folders/fk/5c3q4j6911lg5993psshss_w0000gn/T/9f8fd0c5-7761-4f06-a8a8-55beda163502.mp3",
"text": {
"copy": "testing",
"largetype": "testing"
},
"icon": {
"path": "tts.png"
}
},
{
"title": "testen",
"subtitle": "Phonetic: ",
"quicklookurl": "https://translate.google.com/#view=home&op=translate&sl=de&tl=en&text=testen",
"arg": "/var/folders/fk/5c3q4j6911lg5993psshss_w0000gn/T/9d9066c1-e2b6-497f-8727-36b8b38a066c.mp3",
"text": {
"copy": "testen",
"largetype": "testen"
},
"icon": {
"path": "tts.png"
}
},
{
"title": "Definition[verb]: take measures to check the quality, performance, or reliability of (something), especially before putting it into widespread use or practice.",
"subtitle": "Example: Excavations of the ditch have recovered antlers that were left behind and after their age was tested it was revealed that the first henge was built over 50 centuries ago.",
"text": {
"copy": "take measures to check the quality, performance, or reliability of (something), especially before putting it into widespread use or practice.",
"largetype": "Definition: take measures to check the quality, performance, or reliability of (something), especially before putting it into widespread use or practice.\n\nExample: Excavations of the ditch have recovered antlers that were left behind and after their age was tested it was revealed that the first henge was built over 50 centuries ago."
}
},
{
"title": "Translation[noun]: Testen",
"subtitle": "Frequency: 0.1850 Synonyms: testing",
"text": {
"copy": "Testen",
"largetype": "Translation: Testen\n\nSynonyms: testing"
}
},
{
"title": "Translation[noun]: Prüfung",
"subtitle": "Frequency: 0.1122 Synonyms: examination,test,audit,testing,exam,check",
"text": {
"copy": "Prüfung",
"largetype": "Translation: Prüfung\n\nSynonyms: examination,test,audit,testing,exam,check"
}
},
{
"title": "Translation[noun]: Erprobung",
"subtitle": "Frequency: 0.0175 Synonyms: testing",
"text": {
"copy": "Erprobung",
"largetype": "Translation: Erprobung\n\nSynonyms: testing"
}
}
]
}
[12:13:51.220] Google Translate[Script Filter] Processing complete
[12:13:51.239] Google Translate[Script Filter] Passing output '/var/folders/fk/5c3q4j6911lg5993psshss_w0000gn/T/9d9066c1-e2b6-497f-8727-36b8b38a066c.mp3' to Copy to Clipboard

Output if I hit [CMD] + [Enter]

[12:15:47.015] Google Translate[Script Filter] Queuing argument 'testing'
[12:15:49.606] Google Translate[Script Filter] Script with argv 'testing' finished
[12:15:49.610] Google Translate[Script Filter] {
"items": [
{
"title": "testing",
"subtitle": "Phonetic: ",
"quicklookurl": "https://translate.google.com/#view=home&op=translate&sl=en&tl=de&text=testing",
"arg": "/var/folders/fk/5c3q4j6911lg5993psshss_w0000gn/T/d525b4e8-5794-4ccd-b28f-f396a4ab11a3.mp3",
"text": {
"copy": "testing",
"largetype": "testing"
},
"icon": {
"path": "tts.png"
}
},
{
"title": "testen",
"subtitle": "Phonetic: ",
"quicklookurl": "https://translate.google.com/#view=home&op=translate&sl=de&tl=en&text=testen",
"arg": "/var/folders/fk/5c3q4j6911lg5993psshss_w0000gn/T/e9cee485-d4f2-4c13-9a0a-ba1f08645dd9.mp3",
"text": {
"copy": "testen",
"largetype": "testen"
},
"icon": {
"path": "tts.png"
}
},
{
"title": "Definition[verb]: take measures to check the quality, performance, or reliability of (something), especially before putting it into widespread use or practice.",
"subtitle": "Example: Excavations of the ditch have recovered antlers that were left behind and after their age was tested it was revealed that the first henge was built over 50 centuries ago.",
"text": {
"copy": "take measures to check the quality, performance, or reliability of (something), especially before putting it into widespread use or practice.",
"largetype": "Definition: take measures to check the quality, performance, or reliability of (something), especially before putting it into widespread use or practice.\n\nExample: Excavations of the ditch have recovered antlers that were left behind and after their age was tested it was revealed that the first henge was built over 50 centuries ago."
}
},
{
"title": "Translation[noun]: Testen",
"subtitle": "Frequency: 0.1850 Synonyms: testing",
"text": {
"copy": "Testen",
"largetype": "Translation: Testen\n\nSynonyms: testing"
}
},
{
"title": "Translation[noun]: Prüfung",
"subtitle": "Frequency: 0.1122 Synonyms: examination,test,audit,testing,exam,check",
"text": {
"copy": "Prüfung",
"largetype": "Translation: Prüfung\n\nSynonyms: examination,test,audit,testing,exam,check"
}
},
{
"title": "Translation[noun]: Erprobung",
"subtitle": "Frequency: 0.0175 Synonyms: testing",
"text": {
"copy": "Erprobung",
"largetype": "Translation: Erprobung\n\nSynonyms: testing"
}
}
]
}

Workflow doesn't

Hi, I tried this workflow and it's properly installed, but if I type for example 'tr car', I only see 'Detected your input language is Englisch, not one of your Configuration' and nothing happens. Thanks in advance and greetings

Selection in MacOS don't work

I try use hotkey for fast translate but not working, in log I just see
"Passing output '' to Script Filter". But Using "MacOS Clipboard Contents" Works!

Any can help with this?
Thnks

Screen Shot 2020-05-07 at 21 46 13

中英长句互译

在翻译长句时,英译中没问题,但是中译英时,结果为两段中文。

image

alfred 4 npm安装失败

Error: Command failed: alfred-link
Error: Workflow directory `/Users/xxx/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows` does not exist
    at /usr/local/lib/node_modules/alfred-google-translate/node_modules/alfred-link/index.js:19:10

    at /usr/local/lib/node_modules/alfred-google-translate/node_modules/execa/index.js:201:11
    at processTicksAndRejections (internal/process/task_queues.js:89:5) {
  code: 1,
  killed: false,
  stdout: '',
  stderr: 'Error: Workflow directory ' +
    '`/Users/xxx/Library/Application Support/Alfred ' +
    '3/Alfred.alfredpreferences/workflows` does not exist\n    ' +
    'at ' +
    '/usr/local/lib/node_modules/alfred-google-translate/node_modules/alfred-link/index.js:19:10\n',
  failed: true,
  signal: null,
  cmd: 'alfred-link',
  timedOut: false
}

看报错还是在使用alfred3的目录

翻译基础设置功能

我也用了其他的google translate, 我个人认为你的模块缺少一个google translate 基础设置功能,就是把哪种语言翻译成哪种对应的语言。
这里有一个很好的例子,你可以借鉴一下。
https://github.com/DONSA/alfred-google-translate

我个人认为如果你能把这个基础设置功能结合进来,并把大段落翻译,和发音问题解决,你这个翻译模块趋向完美。

Select language pairs?

This is an amazing workflow! Is there any chance you could add a way to change to different language pairs, e.g. German <-> Spanish etc.

`shift` 不工作

shift 不工作,没有获取到当前查询的单词,Google translate 的 URL 更新了?

image

Error at index.js:105:17

I just input tr hello, it tells me to press command+L to show more details error

Error at /usr/local/lib/node_modules/alfred-google-translate/node_modules/china-google-translate-api/index.js:105:17 at <anonymous>

My nodejs version is

➜  china-google-translate-api npm --version
5.6.0

JSON error: Garbage at end. in JSON errors

[01:31:35.879] ERROR: Google Translate[Script Filter] JSON error: Garbage at end. in JSON:
{
"items": [
{
"title": "무기 타격치",
"subtitle": "Phonetic: mugi tagyeogchi",
"quicklookurl": "https://translate.google.com/#view=home&op=translate&sl=auto&tl=en&text=%E1%84%86%E1%85%AE%E1%84%80%E1%85%B5%20%E1%84%90%E1%85%A1%E1%84%80%E1%85%A7%E1%86%A8%E1%84%8E%E1%85%B5",
"arg": "/var/folders/n3/0qlv7v8n1hvd6mml886wzzbr0000gn/T/c45944ce-ad5b-462d-994b-43b4fd65dabe.mp3",
"text": {
"copy": "무기 타격치",
"largetype": "무기 타격치"
},
"icon": {
"path": "tts.png"
}
},
{
"title": "Weapons tagyeokchi",
"subtitle": "Phonetic: ",
"quicklookurl": "https://translate.google.com/#view=home&op=translate&sl=en&tl=auto&text=Weapons%20tagyeokchi",
"arg": "/var/folders/n3/0qlv7v8n1hvd6mml886wzzbr0000gn/T/a8eda803-6801-4376-9998-8e5d9ee4f4a3.mp3",
"text": {
"copy": "Weapons tagyeokchi",
"largetype": "Weapons tagyeokchi"
},
"icon": {
"path": "tts.png"
}
}
]
}
{
"items": [
{
"title": "HTTPError: Response code 404 (Not Found)\nUrl: https://translate.google.com/translate_tts?client=t&tl=auto&ie=UTF-8&idx=0&total=1&textlen=12&q=%E1%84%86%E1%85%AE%E1%84%80%E1%85%B5%20%E1%84%90%E1%85%A1%E1%84%80%E1%85%A7%E1%86%A8%E1%84%8E%E1%85%B5&tk=597562.1030535\n at stream.catch.then.data (/Users/zajako/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.83B28437-DDBE-4680-9B18-D1FF690AC29F/node_modules/got/index.js:123:13)\n at \n at process._tickDomainCallback (internal/process/next_tick.js:228:7)",
"subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
"valid": false,
"text": {
"copy": "\nHTTPError: Response code 404 (Not Found)\nUrl: https://translate.google.com/translate_tts?client=t&tl=auto&ie=UTF-8&idx=0&total=1&textlen=12&q=%E1%84%86%E1%85%AE%E1%84%80%E1%85%B5%20%E1%84%90%E1%85%A1%E1%84%80%E1%85%A7%E1%86%A8%E1%84%8E%E1%85%B5&tk=597562.1030535\n at stream.catch.then.data (/Users/zajako/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.83B28437-DDBE-4680-9B18-D1FF690AC29F/node_modules/got/index.js:123:13)\n at <anonymous>\n\n\n-\nGoogle Translate 2.0.6\nAlfred 4.0.4\ndarwin 18.7.0",
"largetype": "HTTPError: Response code 404 (Not Found)\nUrl: https://translate.google.com/translate_tts?client=t&tl=auto&ie=UTF-8&idx=0&total=1&textlen=12&q=%E1%84%86%E1%85%AE%E1%84%80%E1%85%B5%20%E1%84%90%E1%85%A1%E1%84%80%E1%85%A7%E1%86%A8%E1%84%8E%E1%85%B5&tk=597562.1030535\n at stream.catch.then.data (/Users/zajako/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.83B28437-DDBE-4680-9B18-D1FF690AC29F/node_modules/got/index.js:123:13)\n at "
},
"icon": {
"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
}
}
]
}

发音不工作

按照README 里的

tr translate

然后 cmd+enter 发音说的完全不知道是什么。。

Wanted: Where you found this workflow

First of all, thanks sincerely for constantly using and supporting. I will try our best to keep it better.

The purpose of this issue:

let me know where you found this workflow, and I will publish this workflow to more places for more people to use.

and hope to attract more people to contribute (code, idea, etc.)

Thanks again for your participation!

建议:加入显示音标

因为有的时候只想看音标而不方便听,例如:按一次cmd显示音标,再按一次enter发音

npm 安装失败

系统10.14

apple$ sudo npm install -g alfred-google-translate

> [email protected] postinstall /usr/local/lib/node_modules/alfred-google-translate
> alfy-init

{ Error: Command failed: alfred-link
Error: Alfred preferences not found at location /Users/apple/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist
    at pathExists.then.exists (/usr/local/lib/node_modules/alfred-google-translate/node_modules/resolve-alfred-prefs/index.js:15:10)
    at <anonymous>

    at Promise.all.then.arr (/usr/local/lib/node_modules/alfred-google-translate/node_modules/execa/index.js:201:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
  code: 1,
  killed: false,
  stdout: '',
  stderr: 'Error: Alfred preferences not found at location /Users/apple/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist\n    at pathExists.then.exists (/usr/local/lib/node_modules/alfred-google-translate/node_modules/resolve-alfred-prefs/index.js:15:10)\n    at <anonymous>\n',
  failed: true,
  signal: null,
  cmd: 'alfred-link',
  timedOut: false }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `alfy-init`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/apple/.npm/_logs/2018-10-17T02_45_21_697Z-debug.log

安装失败

npm ERR! Darwin 17.7.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "alfred-google-translate"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/yanjiaying/npm-debug.log

shift 无法打开网页

安装方式:根据文档提示 npm 安装和直接下载安装包,都发生如下情况

选中结果点击 shift,也没有打开网页,而是如下的空白

屏幕快照 2019-07-25 11 20 32

获取不到Selection in macOS

选中一些文本,按快捷键后弹出的框中没有内容。
这个是debug输出的日志

[15:58:56.549] Google Translate[Hotkey] Processing complete
[15:58:56.553] Google Translate[Hotkey] Passing output '' to Script Filter

但是如果选项改成macOS clipboard contents就能用,弹出的框中就有内容。

macOS 10.14.6, node v12.12,Alfred 4.0.6破解版

一直显示翻译中,提示输入错误

大佬求帮助~npm安装,v2.0.1
image

RequestError: connect ETIMEDOUT 88.191.249.182:443
Url: https://translate.google.cn/translate_a/single?client=t&sl=en&tl=zh-CN&hl=en&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=7&q=good&tk=629764.983966
at ClientRequest.req.once.err (/Users/gongz/.nvm/versions/node/v10.11.0/lib/node_modules/alfred-google-translate/node_modules/got/index.js:73:21)
at Object.onceWrapper (events.js:273:13)
at ClientRequest.emit (events.js:182:13)
at TLSSocket.socketErrorListener (_http_client.js:391:9)
at TLSSocket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)

发音问题

发现你的发音功能在单词上是可以的,但是如果是整句话,或者整段话,就无法发音了。请修复bug。

还有你的cmd+l功能,既然shift 是快照,那么为啥不用shift+l 这样更方便记忆?
或者你能不把shift 本身就改成cmd+l功能,这样不更好用 ?

大段落翻译仍有问题,63个单词以上,无法翻译。

今天学习的时候发现,只要单词超过63个,workflow就没有反应了。需要修复bug.
举例如下。
Although Botswana’s economic outlook remains strong, the devastation that AIDS has caused threatens to destroy the country’s future. In 2001, Botswana has the highest rate of HIV infection in the world. With the help of international donors it launched an ambitious national campaign that provided free antiviral drugs to anyone who needed them, and by March 2004, Botswana’s infection rate has dropped significantly.

HTTPError: Response code 404 (Not Found)

Once downloaded and configured alfred-language-configuration and installed node binary, this workflow gives the following error (input: tr hello):

HTTPError: Response code 404 (Not Found)
Url: https://translate.google.it//translate_a/single?client=gtx&sl=en&tl=it&hl=en&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=7&q=hello&tk=451152.18915
    at /Users/alfredo/.config/Alfred 4/Alfred.alfredpreferences/workflows/user.workflow.D3FB80B9-D5BA-4D6D-AC2D-44219BA0A779/node_modules/got/index.js:123:13

-
Google Translate 2.0.8
Alfred 4.0.5
darwin 18.7.0

Seems to be an error due to malformed URL. The string in excess is "translate_a/single". Once that string has been deleted, the request proceeds successfully, at least on browser.
If I manually remove the string '/translate_a/single' in the translate.js file (line 10), I get JSON error:

SyntaxError: Unexpected token < in JSON at position 0
Url: https://translate.google.it/?client=gtx&sl=en&tl=it&hl=en&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=7&q=hello&tk=211563.365023
    at JSON.parse (<anonymous>)
    at /Users/alfredo/.config/Alfred 4/Alfred.alfredpreferences/workflows/user.workflow.D3FB80B9-D5BA-4D6D-AC2D-44219BA0A779/translate.js:29:29

-
Google Translate 2.0.8
Alfred 4.0.5
darwin 18.7.0

无法中英互译

Alfred: 4.0.3
alfred-google-translate: 2.0.2

image

[22:31:57.967] Google Translate[Script Filter] Queuing argument '你好'
[22:31:58.636] Google Translate[Script Filter] Script with argv '你好' finished
[22:31:58.638] Google Translate[Script Filter] {
	"items": [
		{
			"title": "你好",
			"subtitle": "",
			"quicklookurl": "https://translate.google.cn/#view=home&op=translate&sl=en&tl=en&text=%E4%BD%A0%E5%A5%BD",
			"arg": "/var/folders/lf/0q4l0s7j6d57vfsvgmd2v0cw0000gn/T/20291c06-35e0-4f1e-90c0-ad970324573d.mp3",
			"text": {
				"copy": "你好",
				"largetype": "你好"
			},
			"icon": {
				"path": "tts.png"
			}
		},
		{
			"title": "你好",
			"subtitle": "",
			"quicklookurl": "https://translate.google.cn/#view=home&op=translate&sl=en&tl=en&text=%E4%BD%A0%E5%A5%BD",
			"arg": "/var/folders/lf/0q4l0s7j6d57vfsvgmd2v0cw0000gn/T/360f7081-cbf0-4bcd-93fc-75acf96516e5.mp3",
			"text": {
				"copy": "你好",
				"largetype": "你好"
			},
			"icon": {
				"path": "tts.png"
			}
		}
	]
}

都是默认配置,无法翻译成英文,同时英文也无法翻译成中文。

关于按键习惯反馈

按shift打开Google翻译页面
但是输入过程中经常使用shift 作为中英切换。。。
建议使用组合按键

大段落翻译无法实现

我画了大段落的文字,但只能翻译第一句话。您能帮我解决吗 ?怎么样可以画大段落复制,而直接翻译出来。

cmd+enter发音不工作

cmd + enter 发音不工作,出来的读音并不是查询到的读音,而是一个句子

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.