Jump to content
avk_tp

WordReference - A multilingual translation dictionary

Recommended Posts

Update: WordReference is no longer accepting new registrations for API keys, but those who have already registered can continue to use them. As such, new users won't be able to set this up.

 

---

 

Schermata%202013-06-04%20alle%2020.48.45

 

For the language learners among us, here's a workflow that returns results from http://wordreference.com into Alfred.

 

As you can see from the screenshot, you'll get various definitions in the original language (designated using the relevant flag), with each definition proceeded by translations in the target language (parts of speech and the gender of nouns (where applicable) are also included). Pressing enter will take you to the entry page on wordreference.com.

 

Numerous dictionaries are included (I can add additional ones carried by the WordReference website if there are any requests), with the specific dictionary called up using the first two letters of the original language followed by the first two letters of the target language. That means:

 

enfr: English to French

fren: French to English

enit: English to Italian

iten: Italian to English

enes: English to Spanish

esen: Spanish to English

 

pten: Portuguese to English

enpt: English to Portuguese

 

In addition, typing frc, itc or esc, followed by a verb (in French, Italian or Spanish respectively) and then pressing enter will call up (in your browser) the conjugation table for the verb. For example:

 

Schermata%202013-06-04%20alle%2021.32.55

 

Lastly, note that in order to use the workflow you must first register for an API with wordreference.com (this is necessary to prevent excessive calls from any given API). That can be done by using the 'getapi' keyword in Alfred, or using this link: http://www.wordreference.com/docs/APIregistration.aspx. You then set the API by using the 'setapi' keyword. 

 

And just in case you "tl:dr" that:

Schermata%202013-06-04%20alle%2021.35.00

 

 

DOWNLOAD (Version 0.6 - 07/05/13)

 

 

Updates will be released via Alleyoop 2 and posted here. Let me know if you've got any feedback. Also, thanks to everyone in the help forums who helped me overcome my near total inability to code.

Edited by avk_tp

Share this post


Link to post

Hi Anthony, thanks for the workflow, it's very useful.

I'd like to add German, I had a look to the code and it repeat itself in several ways (all the {lang1}{lang2}.php files could be unificated passing the languages as a script argument from alfred, also all the loops in those files are very similar and could be done with a function), slimming it would make it easier to add languages and more maintainable.

If you'd like I'll gladly do this refactoring and add german language, tell me what you think about it.

Share this post


Link to post

Hi Anthony, thanks for the workflow, it's very useful.

I'd like to add German, I had a look to the code and it repeat itself in several ways (all the {lang1}{lang2}.php files could be unificated passing the languages as a script argument from alfred, also all the loops in those files are very similar and could be done with a function), slimming it would make it easier to add languages and more maintainable.

If you'd like I'll gladly do this refactoring and add german language, tell me what you think about it.

 

Sounds great to me!

 

I'm a real amateur, so although I could obviously add the German translations in myself I'd be hard pressed to do the refactoring. Just let me know if I can help out in some way.

Share this post


Link to post

Sounds great to me!

 

I'm a real amateur, so although I could obviously add the German translations in myself I'd be hard pressed to do the refactoring. Just let me know if I can help out in some way.

I slimmed it a bit, now there is only translate.php instead than one file per language pair and there is only one loop in the file

I also found out that german is not supported by the wordreference api...bad luck for me

Well anyway give it a look https://dl.dropboxusercontent.com/u/115338/WordReference.alfredworkflow

 

If you are open to contributions github would probably be the best way to handle them.

 

edit:

by the way I think that it would be more useful if it would copy the translation to clipboard instead than opening wordreference

the result could be compressed in one per line to show more like this:

- title: {translated term} ({pos} {sense})

- subtitle: {original term} ({pos} {sense})

what you think of these ideas?

Edited by francescolaffi

Share this post


Link to post

I slimmed it a bit, now there is only translate.php instead than one file per language pair and there is only one loop in the file

I also found out that german is not supported by the wordreference api...bad luck for me

Well anyway give it a look https://dl.dropboxusercontent.com/u/115338/WordReference.alfredworkflow

 

If you are open to contributions github would probably be the best way to handle them.

 

edit:

by the way I think that it would be more useful if it would copy the translation to clipboard instead than opening wordreference

the result could be compressed in one per line to show more like this:

- title: {translated term} ({pos} {sense})

- subtitle: {original term} ({pos} {sense})

what you think of these ideas?

 

Looks great! Definitely much more parsimonious than my version... thanks for going through it and fixing it up. 

 

As for the suggestion, I think that sounds good. We could always make it so that while enter copies the translation to clipboard, pressing control-enter could open the webpage (so that the option would still be there).

 

In the meanwhile I'll sign up for github in a few days (I'm travelling right now) and then return with a link for contribution purposes.

Share this post


Link to post

I slimmed it a bit, now there is only translate.php instead than one file per language pair and there is only one loop in the file

I also found out that german is not supported by the wordreference api...bad luck for me

Well anyway give it a look https://dl.dropboxusercontent.com/u/115338/WordReference.alfredworkflow

 

If you are open to contributions github would probably be the best way to handle them.

 

edit:

by the way I think that it would be more useful if it would copy the translation to clipboard instead than opening wordreference

the result could be compressed in one per line to show more like this:

- title: {translated term} ({pos} {sense})

- subtitle: {original term} ({pos} {sense})

what you think of these ideas?

 

Here's that link to the github page: https://github.com/mbdw/WordReference

Share this post


Link to post

Here's that link to the github page: https://github.com/mbdw/WordReference

Hi, I forked it and made a couple of pull requests, one that organize a bit the repo and the other with the copy on enter functionality + one term per line.

you can test how it works here https://raw.github.com/francescolaffi/alfred-wordreference-workflow/copy-on-enter/WordReference.alfredworkflow 

 

You can merge that code in your repo with the button that says accept pull request or merge it, or something like that.

I believe it is possible to use github to distribute the workflow and host the remote json, if you need help with it or github contact me.

Share this post


Link to post

Hi, I forked it and made a couple of pull requests, one that organize a bit the repo and the other with the copy on enter functionality + one term per line.

you can test how it works here https://raw.github.com/francescolaffi/alfred-wordreference-workflow/copy-on-enter/WordReference.alfredworkflow 

 

You can merge that code in your repo with the button that says accept pull request or merge it, or something like that.

I believe it is possible to use github to distribute the workflow and host the remote json, if you need help with it or github contact me.

 

Accepted the pull requests and I've updated the alleyoop update to make it all go through github. The only thing I can't figure out is how to replace the workflow file itself on github with the new one that contains the proper alleyoop reference. I feel like I'm missing something super simple...

 

Thanks again for all the help, by the way!

Share this post


Link to post

i did a pull request that updates the update.json in src and inside the workflow file, remember to keep online the remote json at https://dl.dropboxusercontent.com/u/4487203/wordreference.json

making it point to the workflow on github, because the update.json of older version on people computers are still pointing to that one

 

Done. And I like that tweaked way of returning the results in Alfred!

Share this post


Link to post

This looks like a really good workflow. Thanks for sharing. I have one problem. I am trying set the api but alfred immediately tries to search for the key instead of letting me enter it into the setapi action. See below.

 

Image%202013.07.11%209%3A48%3A54%20AM.pn

Share this post


Link to post

This looks like a really good workflow. Thanks for sharing. I have one problem. I am trying set the api but alfred immediately tries to search for the key instead of letting me enter it into the setapi action. See below.

 

setapi should be a keyword not a script filter, it was working fine few version ago, don't know how it got changed... astroMD77: try this version https://github.com/francescolaffi/alfred-wordreference-workflow/raw/master/WordReference.alfredworkflow it should work

 

avk_tp: I'll send a pull request with everything ready to release this fix

 

edit: fixed link, the software of this forum is not really good understanding where an url finish

Edited by francescolaffi

Share this post


Link to post

setapi should be a keyword not a script filter, it was working fine few version ago, don't know how it got changed... astroMD77: try this version https://github.com/francescolaffi/alfred-wordreference-workflow/raw/master/WordReference.alfredworkflow it should work

 

avk_tp: I'll send a pull request with everything ready to release this fix

 

edit: fixed link, the software of this forum is not really good understanding where an url finish

 

 

This looks like a really good workflow. Thanks for sharing. I have one problem. I am trying set the api but alfred immediately tries to search for the key instead of letting me enter it into the setapi action. See below.

 

Image%202013.07.11%209%3A48%3A54%20AM.pn

 

It's all merged now, so the updated version is on github. I'm not sure how setapi stopped working, either, since I confirmed that the the process looked exactly the same a few versions ago and worked fine. 

Share this post


Link to post

Any chance of adding Portuguese? Thanks

 

Done. You can download it here: http://db.tt/iVfinaFs (it's not up on github yet). Use pten for Portuguese to English and enpt for the reverse.

 

 

setapi should be a keyword not a script filter, it was working fine few version ago, don't know how it got changed... astroMD77: try this version https://github.com/francescolaffi/alfred-wordreference-workflow/raw/master/WordReference.alfredworkflow it should work

 

avk_tp: I'll send a pull request with everything ready to release this fix

 

edit: fixed link, the software of this forum is not really good understanding where an url finish

 

@francescolaffi: can you push it up onto github for me? I fiddled with it for awhile but keep getting errors in terminal (I don't think I've set it up right and need to look into it a bit more).

Edited by avk_tp

Share this post


Link to post

@francescolaffi: can you push it up onto github for me? I fiddled with it for awhile but keep getting errors in terminal (I don't think I've set it up right and need to look into it a bit more).

done, if you need some pointer setting up your dev environment pm me.

Share this post


Link to post

done, if you need some pointer setting up your dev environment pm me.

 

Merged it and made you a collaborator. And thanks for the offer; I'll pm you next time I'm trying to sort out some github stuff. 

Share this post


Link to post

Hi,

 

Any chance you could add English definition and English synonyms to the workflow? I am a translator and it can be very useful for me.

Thanks in advance.

 

Mahmoud

Share this post


Link to post

Hey Mahmoud,

 

The English monolingual dictionary cannot be accessed except through the wordference website, but I can add in the English thesaurus if you'd still want it on its own.

 

 

Let me know,

 

Anthony

 

Hi,

 

Any chance you could add English definition and English synonyms to the workflow? I am a translator and it can be very useful for me.

Thanks in advance.

 

Mahmoud

Share this post


Link to post

Hi Anthony,

 

Yes, please. I would really appreciate it if you could do that.

Thanks a million in advance.

 

Mahmoud

 

Hey Mahmoud, 

 

I took a look at the wordreference results for the thesaurus and I can't figure out a way to return them in Alfred without the whole thing becoming unwieldy. There are just too many different senses for words, which then have a whole slew of associated synonyms.

 

The only way I can think to do it is with a drill down menu, such that you enter a word (e.g. "cold") and then you choose among the potential meanings (e.g. "said of weather", "said of people", "absence of warmth", etc.), press enter, and then are returned a new list with synonyms for that particular sense of the word. Unfortunately I am not a real programmer so I wouldn't know where to even start to do that (and I can't say for certain whether the wordreference website makes it possible to do). 

 

So alas, you'll need to hope that an actual programmer can come to your rescue on that one. 

 

 

Sorry about that,

Anthony

Share this post


Link to post

Thank you for sharing this workflow, it's really useful for me. Is there any chance of adding portuguese-spanish and spanish-portuguese translations?

 

Sorry for the slow reply. Unfortunately only translations that involve English are made available by the wordreference API, so it's impossible at this point in time.

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