Jump to content

Recommended Posts

Hi, happy to share yet another translation workflow. The existing ones I found didn't have support for some languages that I needed, so here we go https://github.com/rustycamper/alfred-translate-workflow/releases/latest

 


Translate from/to your favorite language using Google or Microsoft Translate.

 

Usage:
* `tr` <query>:
translate query.

* `tr-setapi` <API>: select Google or Microsoft Translate service.
* `tr-setkey` <API key>: set your API key.
* `tr-setlang` <language>: set target language (language to translate to).


Note: You won't need to set a source (from) language. Both Google and Microsoft are pretty good at guessing 
the origin language.

 

Features:
* Simple: setup once and just use it.
* Secure: keys are stored in Mac's native Keychain tool.
* Fast: repeat queries are cached for speed.

 

Keyboard Shortcuts:
* Enter: copy translation to clipboard.
* Command + C: copy translation to clipboard.
* Command + Y: show quick preview on the respective translation web site.
* Command + L: show translated text in large font.

 

Requirements:
The first time you run the workflow, it will prompt you to enter your API key for Google or Microsoft. 
* Instructions on how to get a Google API key: https://cloud.google.com/translate/docs/getting-started#set_up_your_project
* Instructions on how to get a Microsoft API key: https://www.microsoft.com/en-us/translator/getstarted.aspx

 

 

 

tr-setapi.gif

 

tr-setlang.gif

 

tr.gif

Edited by rustycamper
Give credit where it's due.

Share this post


Link to post

Sounds great, but the instructions at that link make getting a Google Translate API key seem like a massive project. As in, I'd have to use this workflow thousands of times to make it remotely worth the effort. Is there a shortcut or a cliff's note version?

 

Share this post


Link to post
11 hours ago, Scott said:

Sounds great, but the instructions at that link make getting a Google Translate API key seem like a massive project. As in, I'd have to use this workflow thousands of times to make it remotely worth the effort. Is there a shortcut or a cliff's note version?

 

Sorry, you Google requires you to have an API key. Please check out the updated workflow, as it now works with Microsoft Translate a well. Thanks,

Share this post


Link to post

Could you create a small guide how to create the key? I have the JSON file, but I can't get the workflow working. Do I need to copy the private key with \n or without or what is the API key??? How can I verify (without the Alfred workflow) if my API key works?

Share this post


Link to post

@ckotte The API key will be one of the values in the JSON file. Don't copy the \n: that's an encoded newline.

 

It's hard to say much beyond that because you didn't say whether you're using Google or Microsoft.

Share this post


Link to post
27 minutes ago, ckotte said:

Could you create a small guide how to create the key? I have the JSON file, but I can't get the workflow working. Do I need to copy the private key with \n or without or what is the API key??? How can I verify (without the Alfred workflow) if my API key works?

I am sorry but I won't be able to create a guide in the next 6 months as I am traveling South America with very sporadic access to internet and no laptop. @deanishe: thanks for answering mate!

Edited by rustycamper
Clarification

Share this post


Link to post
38 minutes ago, rustycamper said:

I am sorry but I won't be able to create a guide in the next 6 months as I am traveling South America with very sporadic access to internet and no laptop. @deanishe: thanks for answering mate!

 

That sounds awesome! Have a great time!

 

Does this mean that the workflow will go tits-up with the Microsoft API when they turn the old DataMarket/Data Services API at the end of March?

 

Share this post


Link to post

I'm having the same problem: "Error in workflow 'com.sozora.google-translate' - HTTP Error 403 - Forbidden"... I've followed your instructions, and I've set API KEY... But it doesn't work. Do you have any idea what's happening?

Share this post


Link to post

It's working fine for me…

 

First of all, enter tr workflow:update to make sure you're using the latest version.

 

Then you could try resetting the workflow (i.e. deleting its cached data) with tr workflow:reset

 

Choose your API and language again, and set your key again.

 

Do you have billing set up for your Google account? The Translation API isn't free, AFAIK. (It is very cheap to use, however.)

Share this post


Link to post

Correct, Google requires a credit card on file after the initial 3 month trial period. As @deanishe pointed out, it's very cheap - 2 cents per 1,000 characters to use the API.

Edited by rustycamper

Share this post


Link to post

ok. I didn't set up a billing yet so I should be in the 3 months trial period. I reset the workflow but still the same error.

 

I enabled the API, created a project with credentials as you can see..

 

Maybe you definitely need to setup billing..!?

 

Screen Shot 2017-03-07 at 18.31.33.png

Edited by deanishe
Removed API key

Share this post


Link to post

yes, its not working anyway. I didn't configure billing yet. but is there anything missing?

 

btw. is there any free tool to modify pictures to avoid such things?

Edited by ckotte

Share this post


Link to post

The clock starts ticking after you sign up for Google's cloud platform, not when you create an API key. This being said, try the following:

1. Try to access the API via your web browser: https://translation.googleapis.com/language/translate/v2?key=YOUR_API_KEY_HERE&source=en&target=es&q=cow

If you still get a 403 error, it's def. a problem with your key.

2. Make sure you've the translation API enabled https://support.google.com/cloud/answer/6158841?hl=en

Share this post


Link to post

Weird... I already implemented GMaps, GooglePlay Games, IAB, AdMob, Analytics, Google Cloud Console (HTTPS config) <- most things in Android and the web.. Never had that trouble to get a working key :D

"\n"? <_<

 

Edit: Replacing the new lines (\n) did not helped in my situation, but found a other solution.

 

Instructions (for dummies like me xD):

1. visit https://console.cloud.google.com/iam-admin/

2. create a new project.

3. search for translation api and activate.

4. create an api key (NOT a service - here are Google docs quite misleading I guess)

5. copy the key (it has approx. 50 chars and does not contain line-breaks)

6. in the workflow choose google as provider, setup your desired language

6. use this key for the workflow alfred ("tr-set api key")

7. never share your key

8. Profit!

 

Thanks rustycamper for this awesome workflow!

 

58c56899063dc_Anmeldedaten-translate2017-03-1216-22-28.png.7e7ee6dd54636317673af14515bb9ea6.png

Edited by mrx3k1

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...