Jump to content

Google Translate (Languages Configurable)


Recommended Posts

Okay, so if you look here: http://www.packal.org/workflow/translate-api, you'll find a new copy of this workflow that uses the paid translation API. It seems to work just fine with my tests. You'll have to get an API key from Google.

 

The workflow has a different bundleid, so it won't replace the old one, and the keyword for this one is just "tr".

 

I changed the behavior so that it outputs only one language at a time so that you don't pay for what you don't need. Also, the workflow is setup so that translations are cached for about a month, so if you keep translating the same word over and over, it won't actually hit the Google API after the first time.

 

Lastly, the "speak" action was taken out because that was also part of the unofficial API that is no longer working. I'll see if I can get that back in there sometime.

 

Hey Shawn!

 

Thank you for your new workflow. If anybody else have problems with setting up an API key (basically I've followed https://cloud.google.com/translate/v2/getting_started?hl=en#setup):

 

  1. create or select a project in the Google Developers Console and enable the API -> I've created a new Project
  2. project settings page -> Add my billing informations
  3. Add a Browser-API-Key without adding a HTTP-Referrer
  4. Added the Browser-API-Key in the workflow
  5. I had to wait a few minutes, after my api-key was accepted when trying to translate something. (The best thing is to debug the workflow within alfred app -> after a few minutes waiting the 403 forbidden error was gone.)

@Shawn: Is it possible to enable more language at the same time - as it was in the "previous" workflow which don't used the translate API? I often translate DE>EN and EN>DE. Or maybe a 2nd keyword which translates the 2nd configuration.

 

Thanks for the new workflow!!!!

Edited by alfredappuser
Link to comment

Hi, i have a problem, transalate docent works. When i write nothing happend

wnuczus_php0k4JgS_Zrzut%20ekranu%202015-

 

See the above posts for a better explanation. The regular translate workflow is no longer working because Google shutdown the API. You can grab the "Translate API" workflow (again see above) for a version that works with the paid API.

Link to comment

@Shawn: Is it possible to enable more language at the same time - as it was in the "previous" workflow which don't used the translate API? I often translate DE>EN and EN>DE. Or maybe a 2nd keyword which translates the 2nd configuration.

 

Thanks for the new workflow!!!!

 

I could re-implement that logic. I took it out because the new one is paid, and I didn't want users to blow extra characters on the problem, but, again, I can re-implement it. Give me a couple of days. Work is crazy right now.

Link to comment

I can't find where to add my API in the workflow. Any help?

 

When you first start typing, it should tell you that there is no API key installed. Just press enter, and it will bring up an AppleScript dialog box that you can paste your API key into. After that, it's stored in the OS X Keychain, so you can either manipulate it there, or just delete it from there.

Link to comment

When you first start typing, it should tell you that there is no API key installed. Just press enter, and it will bring up an AppleScript dialog box that you can paste your API key into. After that, it's stored in the OS X Keychain, so you can either manipulate it there, or just delete it from there.

 

Oh, ok. I think I must have still been using the non-API script. Works great, thank you!

Link to comment

Hi and good day,

 
My php seems to be ok, ( PHP 5.5.27 ) - on Yosemite -
 
I get: "Type to translate…" then:

Alfred wants to go on to the web, "Search Google:"

 

Hopefully this can be resolved, maybe it's Google's fault?

 

/

with best regards,

Omar KN

 

Stockholm, Sweden

Link to comment

Hi and good day,

 
My php seems to be ok, ( PHP 5.5.27 ) - on Yosemite -
 
I get: "Type to translate…" then:

Alfred wants to go on to the web, "Search Google:"

 

Hopefully this can be resolved, maybe it's Google's fault?

 

/

with best regards,

Omar KN

 

Stockholm, Sweden

 

Are you using the Translate workflow or the Translate API workflow? The first one (keyword: trans) no longer works because Google shutdown that API. The second one (keyword: tr) should be working quite well, but you need to get an API key from Google before it can work.

Link to comment

Hi Shawn,

 

Got the API, although didn't see anywhere I would have to pay.

 

+ don't know where to enter it / in the script? (it has only: php action.php "{query}")

 

 

When in Alfred I type "tr" it actually worked the first try!!! but later not, then it always falls back to "trans" and sends me to the Google translate webpage.

 

Could you please shed some light on this topic :-)

 

/

with best regards,

Omar KN

Stockholm, Sweden

(PS: the .configure action does work)

(PS: On the packal.org/workflow/translate - page there is vs. 1.3.1 for download, although there seems to be an update version 1.3.2 )

Edited by OmarKN
Link to comment
  • 2 weeks later...

Hi and good day,

 
Got the API key & almost everything working fine now,
 
except for when I use the hotkey to launch the Translate API workflow it always proposes the word ”trans”, although it is ”tr ” set as keyword.
 
Also a system sound can be hears at that moment.
 
- I restarted the Mac,
- removed all other earlier versions of translate workflows from Alfred
- checked other apps if they use the same hotkeys
 
So to make it work I always have to delete the letters "ans" to get the letters "tr ", what could be the reason here? Some old plist maybe?
 
(debug doesn't do anything for workflows)
 
/

with best regards,

Omar KN

Stockholm, Sweden

Link to comment
  • 4 weeks later...

I could re-implement that logic. I took it out because the new one is paid, and I didn't want users to blow extra characters on the problem, but, again, I can re-implement it. Give me a couple of days. Work is crazy right now.

 

please my friend, it took me 2 hours to get it working.. i thought it was like the old workflow where you could do that. 

Link to comment
  • 2 weeks later...

The workflow with the official API is no longer working for me:

 

[sTDERR: alfred.workflow.input.scriptfilter] [09:56:21][filter.php:86][ERROR] Request completely failed, and no cached data exists. cURL debug information follows:

[09:56:21][filter.php:86][ERROR] cURL error number: 22

[09:56:21][filter.php:86][ERROR] cURL error message: `The requested URL returned error: 403 Forbidden`.

Link to comment

The workflow with the official API is no longer working for me:

 

[sTDERR: alfred.workflow.input.scriptfilter] [09:56:21][filter.php:86][ERROR] Request completely failed, and no cached data exists. cURL debug information follows:

[09:56:21][filter.php:86][ERROR] cURL error number: 22

[09:56:21][filter.php:86][ERROR] cURL error message: `The requested URL returned error: 403 Forbidden`.

 

 

 

I don't have problems. Do you set up your project at google?

Link to comment
  • 2 weeks later...

Are you using the Translate workflow or the Translate API workflow? The first one (keyword: trans) no longer works because Google shutdown that API. The second one (keyword: tr) should be working quite well, but you need to get an API key from Google before it can work.

 

This means that Translate workflow is dead? I'm confused because it works sometimes (circa 50%). If this workflow Should be the workflow removed from packal and similar pages?

Link to comment
  • 1 month later...

This means that Translate workflow is dead? I'm confused because it works sometimes (circa 50%). If this workflow Should be the workflow removed from packal and similar pages?

 

I'm going to leave it up there in case anyone has any interest in the code. A newer version of Packal (yet to be released; sorry, so busy), has a deprecated flag that can be set as well as a deprecated_for flag that will notify the users as to which one to download.

Link to comment

Starting debug for 'Translate API'

 
[sTDERR: alfred.workflow.input.scriptfilter] [15:21:51][filter.php:122][ERROR] Request completely failed, and no cached data exists. cURL debug information follows:
[15:21:51][filter.php:122][ERROR] cURL error number: 22
[15:21:51][filter.php:122][ERROR] cURL error message: `The requested URL returned error: 403 Forbidden`.
[15:21:52][filter.php:122][ERROR] Request completely failed, and no cached data exists. cURL debug information follows:
[15:21:52][filter.php:122][ERROR] cURL error number: 22
[15:21:52][filter.php:122][ERROR] cURL error message: `The requested URL returned error: 403 Forbidden`.
[15:21:52][filter.php:122][ERROR] Request completely failed, and no cached data exists. cURL debug information follows:
[15:21:52][filter.php:122][ERROR] cURL error number: 22
[15:21:52][filter.php:122][ERROR] cURL error message: `The requested URL returned error: 403 Forbidden`.
[15:21:53][filter.php:122][ERROR] Request completely failed, and no cached data exists. cURL debug information follows:
[15:21:53][filter.php:122][ERROR] cURL error number: 22
[15:21:53][filter.php:122][ERROR] cURL error message: `The requested URL returned error: 403 Forbidden`.
Link to comment

 

Starting debug for 'Translate API'

 
[sTDERR: alfred.workflow.input.scriptfilter] [15:21:51][filter.php:122][ERROR] Request completely failed, and no cached data exists. cURL debug information follows:
[15:21:51][filter.php:122][ERROR] cURL error number: 22
[15:21:51][filter.php:122][ERROR] cURL error message: `The requested URL returned error: 403 Forbidden`.
[15:21:52][filter.php:122][ERROR] Request completely failed, and no cached data exists. cURL debug information follows:
[15:21:52][filter.php:122][ERROR] cURL error number: 22
[15:21:52][filter.php:122][ERROR] cURL error message: `The requested URL returned error: 403 Forbidden`.
[15:21:52][filter.php:122][ERROR] Request completely failed, and no cached data exists. cURL debug information follows:
[15:21:52][filter.php:122][ERROR] cURL error number: 22
[15:21:52][filter.php:122][ERROR] cURL error message: `The requested URL returned error: 403 Forbidden`.
[15:21:53][filter.php:122][ERROR] Request completely failed, and no cached data exists. cURL debug information follows:
[15:21:53][filter.php:122][ERROR] cURL error number: 22
[15:21:53][filter.php:122][ERROR] cURL error message: `The requested URL returned error: 403 Forbidden`.

 

 

The 403 error is happening because Google is denying you access to the translation.

 

Read through the (short) introduction and then follow the setup instructions here: https://cloud.google.com/translate/v2/getting_started.

 

After that, set the API key correctly in the workflow.

Link to comment

The 403 error is happening because Google is denying you access to the translation.

 

Read through the (short) introduction and then follow the setup instructions here: https://cloud.google.com/translate/v2/getting_started.

 

After that, set the API key correctly in the workflow.

 

 

I can't understand what's going on. I used this workflow some time ago with the paid API and decided to stop until the multiple langue support was released. Now the workflow no longer works. :(

Link to comment

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