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

 

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,

Link to post
  • 2 months later...

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?

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

 

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

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

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
Link to post
  • 3 months later...

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