deanishe Posted February 23, 2014 Share Posted February 23, 2014 (edited) Translate between hundreds of languages with Glosbe.com. By default, the workflow is set up to translate between German and English: .ende English query — show German translations of English query. .deen German query — show English translations of German query. ENTER — copy selected translation to the clipboard. CMD+ENTER — open translation in browser. glosbehelp — open the included help file in your browser. glosbelang [query] — view and search supported languages. To use other language pairs, you will have to edit the workflow, either changing the included English <-> German Script Filters or adding your own using them as a template. For more information and to download the workflow, see the Packal page or grab it from GitHub. Edited June 19, 2014 by deanishe juliosecco, milopus and vanderholm 3 Link to comment
paulw Posted February 23, 2014 Share Posted February 23, 2014 This is great, thanks. Especially since the WordReference workflow won't work for those of us who didn't get an API. I added another script filter to let me just type in the three-letter language codes myself, if I want, with keyword ".trans" and script: python translate.py {query} So I can just type ".trans eng fra word" and get an output. Link to comment
deanishe Posted February 24, 2014 Author Share Posted February 24, 2014 Yeah, I was upset I didn't get an API key for WordReference That's a good idea, but be aware it won't work if your query has more than one word. You can also use "en" and "fr" for English and French. Save you a couple of characters … Link to comment
paulw Posted February 24, 2014 Share Posted February 24, 2014 Thanks, deanishe. Would multiple word queries work in my script filter with some kind of quoting? I can't seem to get multiple words to work with your built-in workflow, either though. Can you give an example? Link to comment
deanishe Posted February 24, 2014 Author Share Posted February 24, 2014 (edited) For example, balance sheet (as distinct from balance) works fine in the workflow as supplied. You can enter multi-word queries as-is if you enclose the actual query in single-quotes: keyword en de 'balance sheet' Or deselect Double Quotes in the Script Filter's Escaping options, then you can use double quotes to include apostrophes in your query: keyword en de "Fuller's earth" Edited February 24, 2014 by deanishe Link to comment
paulw Posted February 24, 2014 Share Posted February 24, 2014 Ah, works perfectly. Thanks! Link to comment
Don Dahl Posted March 1, 2014 Share Posted March 1, 2014 Hey, great workflow! One feature request though Since I'm from Denmark i'd need to use weird letters like æ ø å in my queries some times. The workflow doesn't support this. Can this be fixed? Link to comment
deanishe Posted March 1, 2014 Author Share Posted March 1, 2014 Oops! My fault for not testing properly after fiddling with the code. The bug is fixed. Grab the fixed version from GitHub or Packal. Don Dahl 1 Link to comment
mrgreen Posted March 29, 2014 Share Posted March 29, 2014 Hey guys I love the script. It is such a time saver. As I am using it for german-serbian, I prefer to open the glosbe URL and looking up all possible translations in full sentences. Therefore my question: How do I change the script so that e.g. after the search ".desrp kindergarten" and pressing ENTER button the URL http://de.glosbe.com/de/sr/kindergarten is opened? I tried the Open URL trigger, but it uses the given translation instead of the original query. Link to comment
deanishe Posted March 29, 2014 Author Share Posted March 29, 2014 It's not as straightforward as that, I'm afraid I've updated the workflow with the ability to open the translations in your browser. If you grab the new version from Packal, hitting ⌘+↩ on a result will open the webpage. I'm afraid you'll have to set up your own keywords again, though, as it will replace them on install. That's probably easier than trying to update the workflow in place by hand. Link to comment
dan_djorgi Posted March 29, 2014 Share Posted March 29, 2014 Great Workflow! Thanks a lot, deanishe! Link to comment
mrgreen Posted June 19, 2014 Share Posted June 19, 2014 (edited) It's not as straightforward as that, I'm afraid I've updated the workflow with the ability to open the translations in your browser. If you grab the new version from Packal, hitting ⌘+↩ on a result will open the webpage. I'm afraid you'll have to set up your own keywords again, though, as it will replace them on install. That's probably easier than trying to update the workflow in place by hand. Wow thx 1. Another quick request: When there are no translations for a query, it't not possible to go to the glosbe.com website by using cmd+enter Any chance you can implement it to open the URL in case it shows "No translations for '...'" 2. How is the chance to display glosbe examples within alfred results? Edited June 19, 2014 by mrgreen Link to comment
deanishe Posted June 19, 2014 Author Share Posted June 19, 2014 (edited) I've updated the workflow so you can ⌘+↩ on the "No translations…" error to go to the website.I've also changed it to always show definitions regardless of language (previously, they had to match the destination language).Regarding examples: no, it's not possible to show them in Alfred, as the Glosbe API does not provide examples. Edited June 19, 2014 by deanishe Link to comment
Easytiger Posted September 10, 2014 Share Posted September 10, 2014 Hi, I am having some trouble with another workflow and was wondering if it is possible to use just one command to start the translation. At the moment I need to hit "en" for an translation into German and "de" for a translation into english. However, it would be great if I could just write "de" and get a translation depending of the word I am writing, regardless of the language. The workflow would need to automatically identify which language the word is and give me the output accordingly. Is this possible? Cheers Link to comment
deanishe Posted September 10, 2014 Author Share Posted September 10, 2014 Unfortunately, guessing the language of a word is tricky and error prone. It works well when you have several words or sentences to work with, but not with just one word, which is the main use case of this workflow (it's a dictionary rather than a machine translation service). I mean, if I enter die, after, trainee, prise, rat, shooting or kindergarten, are those English or German words? Link to comment
juliosecco Posted February 27, 2019 Share Posted February 27, 2019 (edited) I use and like Glosbe workflow a lot, but it has has suddenly stopped working the workflow outputs 'error contacting glosbe.com' here the debug: Starting debug for 'Glosbe Translation' [2019-02-27 11:10:41][ERROR: input.scriptfilter] Code 1: 11:10:41 translate.py:133 DEBUG script args : [u'eng', u'ita', u'c'] 11:10:41 translate.py:135 DEBUG docopt args : {u'--help': False, u'--langs': False, u'--openhelp': False, u'--text': False, u'<dest>': u'ita', u'<query>': u'c', u'<source>': u'eng'} 11:10:41 translate.py:60 DEBUG Calling http://glosbe.com/gapi_v0_1/translate with args : {u'dest': u'ita', u'phrase': u'c', u'from': u'eng', u'pretty': u'true', u'format': u'json'} 11:10:41 workflow.py:1894 DEBUG Cached data saved at : /Users/juliomacr/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-glosbe/4f19be0f2b1109e6fcec4edfc976b244.cpickle 11:10:41 workflow.py:2243 ERROR object of type 'int' has no len() Traceback (most recent call last): File "/Users/juliomacr/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F9FF7FEC-7E02-4F79-8A95-EFE9A465638C/workflow/workflow.py", line 2236, in run func(self) File "translate.py", line 180, in main if not len(results): TypeError: object of type 'int' has no len() 11:10:41 workflow.py:2267 DEBUG Workflow finished in 0.270 seconds. [2019-02-27 11:10:41][WARNING: input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 64.)'. Row 2, Col 195: 'XML declaration allowed only at the start of the document' in XML: <?xml version="1.0" encoding="utf-8"?> <items><item valid="no"><title>Error contacting Glosbe.com</title><subtitle /><icon>/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns</icon></item></items><?xml version="1.0" encoding="utf-8"?> <items><item valid="no"><title>Error in workflow 'net.deanishe.alfred-glosbe'</title><subtitle>object of type 'int' has no len()</subtitle><icon>/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns</icon></item></items> [2019-02-27 11:10:42][ERROR: input.scriptfilter] Code 1: 11:10:41 translate.py:133 DEBUG script args : [u'eng', u'ita', u'chai'] 11:10:41 translate.py:135 DEBUG docopt args : {u'--help': False, u'--langs': False, u'--openhelp': False, u'--text': False, u'<dest>': u'ita', u'<query>': u'chai', u'<source>': u'eng'} 11:10:41 translate.py:60 DEBUG Calling http://glosbe.com/gapi_v0_1/translate with args : {u'dest': u'ita', u'phrase': u'chai', u'from': u'eng', u'pretty': u'true', u'format': u'json'} 11:10:41 workflow.py:1894 DEBUG Cached data saved at : /Users/juliomacr/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-glosbe/61142e8582e6d754836e7b7c06eba7bd.cpickle 11:10:41 workflow.py:2243 ERROR object of type 'int' has no len() Traceback (most recent call last): File "/Users/juliomacr/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F9FF7FEC-7E02-4F79-8A95-EFE9A465638C/workflow/workflow.py", line 2236, in run func(self) File "translate.py", line 180, in main if not len(results): TypeError: object of type 'int' has no len() 11:10:41 workflow.py:2267 DEBUG Workflow finished in 0.307 seconds. [2019-02-27 11:10:43][ERROR: input.scriptfilter] Code 1: 11:10:42 translate.py:133 DEBUG script args : [u'eng', u'ita', u'chair'] 11:10:42 translate.py:135 DEBUG docopt args : {u'--help': False, u'--langs': False, u'--openhelp': False, u'--text': False, u'<dest>': u'ita', u'<query>': u'chair', u'<source>': u'eng'} 11:10:42 translate.py:60 DEBUG Calling http://glosbe.com/gapi_v0_1/translate with args : {u'dest': u'ita', u'phrase': u'chair', u'from': u'eng', u'pretty': u'true', u'format': u'json'} 11:10:43 workflow.py:1894 DEBUG Cached data saved at : /Users/juliomacr/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-glosbe/315b3bffae742b7bebdf80c9dfcc2f75.cpickle 11:10:43 workflow.py:2243 ERROR object of type 'int' has no len() Traceback (most recent call last): File "/Users/juliomacr/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F9FF7FEC-7E02-4F79-8A95-EFE9A465638C/workflow/workflow.py", line 2236, in run func(self) File "translate.py", line 180, in main if not len(results): TypeError: object of type 'int' has no len() 11:10:43 workflow.py:2267 DEBUG Workflow finished in 0.438 seconds. Edited February 27, 2019 by juliosecco Link to comment
deanishe Posted February 27, 2019 Author Share Posted February 27, 2019 It's not the workflow, it's the Glosbe API. Nothing I can do, I'm afraid Link to comment
juliosecco Posted February 27, 2019 Share Posted February 27, 2019 Yes, I supposed that 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