rustycamper Posted December 8, 2016 Share Posted December 8, 2016 (edited) 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 Flag Icons by GoSquared (http://www.gosquared.com/) Uses Alfred-Workflow library https://github.com/deanishe/alfred-workflow/ Edited December 12, 2016 by rustycamper Give credit where it's due. Link to comment
Scott Posted December 9, 2016 Share Posted December 9, 2016 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 comment
rustycamper Posted December 10, 2016 Author Share Posted December 10, 2016 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 comment
ckotte Posted March 1, 2017 Share Posted March 1, 2017 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 comment
deanishe Posted March 1, 2017 Share Posted March 1, 2017 @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. Link to comment
rustycamper Posted March 1, 2017 Author Share Posted March 1, 2017 (edited) 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 March 1, 2017 by rustycamper Clarification Link to comment
deanishe Posted March 1, 2017 Share Posted March 1, 2017 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 comment
deanishe Posted March 1, 2017 Share Posted March 1, 2017 16 minutes ago, ckotte said: I tried Google API AFAIK, you need the API key from https://console.developers.google.com/apis/credentials Link to comment
rustycamper Posted March 1, 2017 Author Share Posted March 1, 2017 3 minutes ago, deanishe said: 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? Thanks, we are enjoying it AFAIK the Msft translator API https://www.microsoft.com/en-us/translator/getstarted.aspx will not be affected. Link to comment
ckotte Posted March 3, 2017 Share Posted March 3, 2017 On 3/1/2017 at 9:15 PM, deanishe said: AFAIK, you need the API key from https://console.developers.google.com/apis/credentials Is this only the ID as a string?? I get error in workflow com.sozora.google-translate invalid request error 400. Looks like it doesn't accept the key Link to comment
GabrielSilva Posted March 6, 2017 Share Posted March 6, 2017 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? Link to comment
deanishe Posted March 6, 2017 Share Posted March 6, 2017 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 comment
rustycamper Posted March 7, 2017 Author Share Posted March 7, 2017 (edited) 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 March 7, 2017 by rustycamper Link to comment
ckotte Posted March 7, 2017 Share Posted March 7, 2017 (edited) 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..!? Edited March 7, 2017 by deanishe Removed API key Link to comment
deanishe Posted March 7, 2017 Share Posted March 7, 2017 @ckotte Don't post your API keys on the web. Especially not keys for APIs that cost money. Delete that API key now and create a new one. rustycamper 1 Link to comment
ckotte Posted March 7, 2017 Share Posted March 7, 2017 (edited) 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 March 7, 2017 by ckotte Link to comment
rustycamper Posted March 7, 2017 Author Share Posted March 7, 2017 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 comment
ckotte Posted March 7, 2017 Share Posted March 7, 2017 (edited) ok. it works now. you need to setup billing to start the 60 days trial Edited March 7, 2017 by ckotte Link to comment
mrx3k1 Posted March 11, 2017 Share Posted March 11, 2017 (edited) 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 "\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! Edited March 12, 2017 by mrx3k1 Link to comment
Tomasz Banas Posted June 27, 2017 Share Posted June 27, 2017 How can I set a source language? Google got confused multiple times. Link to comment
rustycamper Posted July 3, 2017 Author Share Posted July 3, 2017 On 6/27/2017 at 0:15 PM, Tomasz Banas said: How can I set a source language? Google got confused multiple times. You can't, I am sorry... Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now