Jump to content

Polyglot - yet another Google Translate workflow


Recommended Posts

  • 2 months later...
  • Replies 144
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Hey,   I've made my own translation workflow, as the existing ones which I could find didn't quite suit my needs or lacked in some aspects.   Features: "Natural language" inp

Update v1.1.5   I've pushed a new version of the workflow to npm, you can upgrade by running $ npm install -g alfred-polyglot Notable changes since v1.1.3:   v1.1.5 - F

It's a JavaScript interpreter/platform. It does the same thing as Python and Ruby and Perl, just they are included with macOS.   In any case, this workflow won't run without Node…  

Posted Images

Hello.

 

Been having trouble w/ this one. I downloaded Node.js and ran "$ npm install --global alfred-polyglot" in Terminal. It seemed like it was doing something and then got the errors below. I'm not sure if I was supposed to, but based on the resulting text below, I then ran: `chsh -s /bin/zsh`

 

If I try to run "$ npm install --global alfred-polyglot" again I get: zsh: command not found: $.

 

As this workflow doesn't show up in Alfred, I don't' know how to debug it.

 

Assuming this doesn't work for me, how do I undo whatever I did in Terminal as well as uninstall Node.js (can I install it in any case or do I need it on my system after the install)?

 

Thanks!

 

Last login: Mon Jan 20 21:16:45 on console

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
Foxs-MacBook-Pro:~ fox$ npm I alfred-polyglot

> alfred-polyglot@1.4.0 postinstall /Users/fox/node_modules/alfred-polyglot
> alfy-init

npm WARN saveError ENOENT: no such file or directory, open ‘/Users/fox/package.json’
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/fox/package.json’
npm WARN fox No description
npm WARN fox No repository field.
npm WARN fox No README data
npm WARN fox No license field.

+ alfred-polyglot@1.4.0
added 238 packages from 86 contributors and audited 462 packages in 25.518s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Foxs-MacBook-Pro:~ fox$ trans !set default-language (language)
-bash: !set: event not found
Foxs-MacBook-Pro:~ fox$ trans !set default-language (en)
-bash: !set: event not found
Foxs-MacBook-Pro:~ fox$ trans !set default-language (English)
-bash: !set: event not found
Foxs-MacBook-Pro:~ fox$ trans !set default-language (en)
-bash: !set: event not found
Foxs-MacBook-Pro:~ fox$

 

 

 

Link to post
2 hours ago, romebot said:

If I try to run "$ npm install --global alfred-polyglot" again I get: zsh: command not found: $.

 

You're just supposed to run npm install --global alfred-polyglot

 

The $ represents your shell prompt. It's a convention to show that "this is a shell command".

 

2 hours ago, romebot said:

As this workflow doesn't show up in Alfred, I don't' know how to debug it.

 

It's not so much a workflow as a Node module that contains a workflow. It won't show up in Alfred if the npm installation doesn't work.

Edited by deanishe
Link to post

Hi and thanks! so I did what you said, and it started loading something. and then the terminal says this:

 

Last login: Wed Jan 22 10:01:19 on ttys000
fox@Foxs-MacBook-Pro ~ % $ npm install --global alfred-polyglot
zsh: command not found: $
fox@Foxs-MacBook-Pro ~ % npm install --global alfred-polyglot
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR!   stack: "Error: EACCES: permission denied, access '/usr/local/lib/node_modules'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/fox/.npm/_logs/2020-01-22T11_54_44_700Z-debug.log
fox@Foxs-MacBook-Pro ~ %

 

Link to post
6 hours ago, romebot said:

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules

 

You don't have permission to install the Node module. You may have accidentally run npm with admin permissions. Or it might be something to do with Catalina. Don't know.

 

You'll have to ask @Nikersify. He's the expert.

Link to post
  • 1 month later...
[~]$ npm install --global alfred-polyglot

> alfred-polyglot@1.4.0 postinstall /usr/local/opt/nvm/current/lib/node_modules/alfred-polyglot
> alfy-init

+ alfred-polyglot@1.4.0
added 238 packages from 86 contributors in 5.207s
[drwatson@zoro](06:36:50)(5.646s)
[~]$ trans !set default-language vietnamese
fish: Unknown command: trans

package.json doesn't even have a "bin" section so how could trans get installed ?

The doc doesn't really explain how the workflow gets installed either. How does this thing work ?

Edited by drwatson
Link to post
36 minutes ago, drwatson said:

[~]$ npm install --global alfred-polyglot

> alfred-polyglot@1.4.0 postinstall /usr/local/opt/nvm/current/lib/node_modules/alfred-polyglot
> alfy-init

+ alfred-polyglot@1.4.0
added 238 packages from 86 contributors in 5.207s
[drwatson@zoro](06:36:50)(5.646s)
[~]$ trans !set default-language vietnamese
fish: Unknown command: trans

package.json doesn't even have a "bin" section so how could trans get installed ?

The doc doesn't really explain how the workflow gets installed either. How does this thing work ?

 

type “trans” in alfred not the console bud

Link to post

I am suffering exactly the same problem. The translation dialogue pops up but when I starting to write my words the google, amazon search suggestions appear. I deactivated the standard translation dialogue and changed the initiation phrase. Nothing helped. Do you have an Idea what I could try? Thanks in advance

Link to post
2 hours ago, Bo-Frost-Mann said:

I am suffering exactly the same problem. The translation dialogue pops up but when I starting to write my words the google, amazon search suggestions appear. I deactivated the standard translation dialogue and changed the initiation phrase. Nothing helped. Do you have an Idea what I could try? Thanks in advance

 

do you see the workflow in the workflows tab of your alfred settings?

Link to post
9 minutes ago, Bo-Frost-Mann said:

thanks for the quick answer.

 

Yes I do and it is also activated. Initially it always looks like everything is working well (when I start the workflow by typing the starting phrase) but when I type the word that should be translated the searches appear.

 

 

can you go into the workflow's settings and paste the debug output? you can show the output by clicking this bug icon:

YannkKP.png

Link to post
  • 4 months later...

Hi, right after I press space after trans it redirects me to google or amazon search... Any ideas on how to fix that? here's the debug:

 

[01:12:32.755] Google Translate[Script Filter] Queuing argument ''
[01:12:33.573] Google Translate[Script Filter] Script with argv '' finished
[01:12:33.574] ERROR: Google Translate[Script Filter] Code 1: {
	"items": [
		{
			"title": "Error: command.match is not a function",
			"subtitle": "Activate this item to try again. | ⌘L to see the stack trace",
			"autocomplete": "",
			"icon": {
				"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
			},
			"valid": false,
			"text": {
				"largetype": "TypeError: command.match is not a function\n    at module.exports (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/lib/index.js:16:15)\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:7:21\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:36:3\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:38:3)\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:251206)\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:245054\n    at Generator.next (<anonymous>)\n    at bl (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:245412)\n    at kl (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:247659)\n    at Object.u (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:287740)",
				"copy": "TypeError: command.match is not a function\n    at module.exports (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/lib/index.js:16:15)\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:7:21\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:36:3\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:38:3)\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:251206)\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:245054\n    at Generator.next (<anonymous>)\n    at bl (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:245412)\n    at kl (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:247659)\n    at Object.u (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:287740)"
			}
		}
	]
}
{
	"items": [
		{
			"title": "/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:1\nError: EACCES: permission denied, open '/Users/marcosfavero/.config/configstore/google-translate-api.json'\nYou don't have access to this file.\n\n    at Object.openSync (fs.js:461:3)\n    at Object.readFileSync (fs.js:364:35)\n    at Configstore.get (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:35:26)\n    at new Configstore (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:28:45)\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/@vitalets/google-translate-token/index.js:70:14)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)",
			"subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
			"valid": false,
			"text": {
				"copy": "```\n/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:1\nError: EACCES: permission denied, open '/Users/marcosfavero/.config/configstore/google-translate-api.json'\nYou don't have access to this file.\n    at Configstore.get (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:35:26)\n    at new Configstore (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:28:45)\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/@vitalets/google-translate-token/index.js:70:14)\n```\n\n-\nGoogle Translate 1.4.0\nAlfred 4.1\ndarwin 19.5.0",
				"largetype": "/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:1\nError: EACCES: permission denied, open '/Users/marcosfavero/.config/configstore/google-translate-api.json'\nYou don't have access to this file.\n    at Configstore.get (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:35:26)\n    at new Configstore (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:28:45)\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/@vitalets/google-translate-token/index.js:70:14)"
			},
			"icon": {
				"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
			}
		}
	]
}
[01:12:33.577] ERROR: Google Translate[Script Filter] JSON error: Garbage at end. in JSON:
{
	"items": [
		{
			"title": "Error: command.match is not a function",
			"subtitle": "Activate this item to try again. | ⌘L to see the stack trace",
			"autocomplete": "",
			"icon": {
				"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
			},
			"valid": false,
			"text": {
				"largetype": "TypeError: command.match is not a function\n    at module.exports (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/lib/index.js:16:15)\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:7:21\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:36:3\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:38:3)\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:251206)\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:245054\n    at Generator.next (<anonymous>)\n    at bl (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:245412)\n    at kl (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:247659)\n    at Object.u (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:287740)",
				"copy": "TypeError: command.match is not a function\n    at module.exports (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/lib/index.js:16:15)\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:7:21\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:36:3\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/index.js:38:3)\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:251206)\n    at /usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:245054\n    at Generator.next (<anonymous>)\n    at bl (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:245412)\n    at kl (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:247659)\n    at Object.u (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/esm/esm.js:1:287740)"
			}
		}
	]
}
{
	"items": [
		{
			"title": "/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:1\nError: EACCES: permission denied, open '/Users/marcosfavero/.config/configstore/google-translate-api.json'\nYou don't have access to this file.\n\n    at Object.openSync (fs.js:461:3)\n    at Object.readFileSync (fs.js:364:35)\n    at Configstore.get (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:35:26)\n    at new Configstore (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:28:45)\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/@vitalets/google-translate-token/index.js:70:14)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)",
			"subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
			"valid": false,
			"text": {
				"copy": "```\n/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:1\nError: EACCES: permission denied, open '/Users/marcosfavero/.config/configstore/google-translate-api.json'\nYou don't have access to this file.\n    at Configstore.get (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:35:26)\n    at new Configstore (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:28:45)\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/@vitalets/google-translate-token/index.js:70:14)\n```\n\n-\nGoogle Translate 1.4.0\nAlfred 4.1\ndarwin 19.5.0",
				"largetype": "/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:1\nError: EACCES: permission denied, open '/Users/marcosfavero/.config/configstore/google-translate-api.json'\nYou don't have access to this file.\n    at Configstore.get (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:35:26)\n    at new Configstore (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/configstore/index.js:28:45)\n    at Object.<anonymous> (/usr/local/Cellar/node/14.4.0/lib/node_modules/alfred-polyglot/node_modules/@vitalets/google-translate-token/index.js:70:14)"
			},
			"icon": {
				"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
			}
		}
	]
}

 

Edited by favero_
Correct code
Link to post
  • 5 months later...
  • 4 weeks later...
  • 2 weeks later...

😀 Hi there,

It took me a while to find this awesome workflow, I compared several ones but this one seems to be the best one.

However, whenever I finish installing the NPM package,Restart Alfred, I don't see anything called polyglot.

 

I am kind of tech savvy, but I feel a little stupid. Could someone please guide me and tell me how to actually use this workflow?

I am running Alfred 3.8.6, and the NPM installation worked flawlessly.

 

Many thanks🙏

 

 

npm.png

Link to post
  • 1 month later...

Hey. Any update with the 403 Error? I have the latest node and npm, ran the install in terminal without sudo, installed with no issues, restarted to be sure all ok, checked that settings pane existed in Alfred - still I get the error every time that I try to use the workflow.

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...