thomashempel / AlfredGoogleTranslateWorkflow

A workflow for Alfred that implements translation from any language to any other language that is supported by google
MIT License
401 stars 41 forks source link

Default behavior #10

Closed AmirAzodi closed 9 years ago

AmirAzodi commented 10 years ago

Hi Thomas,

Thank you for the great workflow. I added these lines to my script —in line 56 of googleTranslate.php— before the $request is parsed so that I wouldn't have to always add the "de>en" prefix. I think this might be useful for other people who mostly translate between two specific languages.

Cheers, Amir

/**
* The default value should ideally be set
* in the workflow's config and passed down
*/
$default = 'de>en';
/**
* Space is added for the explode function
*/
$default .= ' ';
if (strpos($request,'>') === false && strpos($request,'<') === false) {
    $request = $default . $request;
}
thomashempel commented 10 years ago

Hi asazodi,

in general I like the idea. The point is, not everybody want's this default. Most people most likely want another one. Unfortunately, there is no good way in Alfred to have settings for a workflow.

So maybe this can be done in the workflow script node. I will think about that and let you know.

By the way, in most cases you don't have to use the full syntax. You can only specify the target language and have something like "translate en Haus". Most of the times, Google will detect the correct source language.

Best wishes, Thomas

raine commented 9 years ago

Thanks @asazodi and @thomashempel

99% of the time I want to translate to English so I made en the default for myself, so that I can just type translate koira.

@thomashempel If there's no way to configure workflow from Alfred GUI, at least you could provide a way to hack the default by changing a single string in a file, and add a small remark in README about that. It's better than having to copy paste code from github into right place which is very error prone.

Also, could something like this work?

screenshot 2014-12-09 13 44 03

Cheers.

thomashempel commented 9 years ago

I recently found something that makes this possible. I will have a look at it as soon as I can find the time to do so.

Greets, Thomas

thomashempel commented 9 years ago

Please checkout the V3 branch: https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/tree/V3

thomashempel commented 9 years ago

This is fixed in V3.0.0