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

translate on Alfred 3 #32

Open thiemehennis opened 8 years ago

thiemehennis commented 8 years ago

does this workflow work on Alfred 3? As is, it does not seem to work (on my machine), but I have not yet ruled out other options. Because the Packal workflow explicitly states 'Alfred 2' workflow, this seemed to me the obvious reason.

thomashempel commented 8 years ago

No it does not unfortunately. I don't have the Alfred 3 Powerpack so I can't port it.

thomashempel commented 8 years ago

Got a license... So I can check it. Thank you!

thomashempel commented 8 years ago

Okay, so I checked the workflow on Alfred 3 and it works for me so far. But that could be because I still have the Alfred 2 version around.

Can you please elaborate on what is not working in your setup?

thomashempel commented 8 years ago

Please check out pre-release 3.2.0 and let me know if that works for you: https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/releases/tag/3.2.0-pre1

thiemehennis commented 8 years ago

It does work! Thanks a lot! Have a nice week!

pepperonas commented 8 years ago

Hello, there is no action triggered on my machine. Here is some logging:

#1 /Users/martin/Google Drive/exchange/osx/config/alfred/Alfred.alfredpreferences/workflows/user.workflow.6E397583-7A9F-4EBE-8219-E626BB8A9F3E/GoogleTranslateWorkflow.php(122): St in /Users/martin/Google Drive/exchange/osx/config/alfred/Alfred.alfredpreferences/workflows/user.workflow.6E397583-7A9F-4EBE-8219-E626BB8A9F3E/vendor/stichoza/google-translate-php/src/Stichoza/GoogleTranslate/TranslateClient.php on line 263
[2016-08-31 21:41:12][ERROR: input.scriptfilter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Fatal error: Uncaught exception 'ErrorException' with message 'Server error: `POST http://translate.google.com/translate_a/t` resulted in a `503 Service Unavailable` response:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

Any idea how to fix it? I wish I could help you, but this workflow stuff is totally new to me.

thiemehennis commented 8 years ago

same here. Yesterday suddenly it stopped providing results. (and I just checked; still no results). It did work until recently though, so probably something on Google's end.

On Wed, Aug 31, 2016 at 9:44 PM, Martin Pfeffer notifications@github.com wrote:

Hello, at my machine it doesn't translate anything, no action is triggered. Here is some logging:

1 /Users/martin/Google Drive/exchange/osx/config/alfred/Alfred.alfredpreferences/workflows/user.workflow.6E397583-7A9F-4EBE-8219-E626BB8A9F3E/GoogleTranslateWorkflow.php(122): St in /Users/martin/Google Drive/exchange/osx/config/alfred/Alfred.alfredpreferences/workflows/user.workflow.6E397583-7A9F-4EBE-8219-E626BB8A9F3E/vendor/stichoza/google-translate-php/src/Stichoza/GoogleTranslate/TranslateClient.php on line 263

[2016-08-31 21:41:12][ERROR: input.scriptfilter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON: Fatal error: Uncaught exception 'ErrorException' with message 'Server error: POST http://translate.google.com/translate_a/t http://translate.google.com/translate_a/t resulted in a 503 Service Unavailable response: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/32#issuecomment-243878209, or mute the thread https://github.com/notifications/unsubscribe-auth/ACsPM096hY2q7-1quHHIsAR013vWpCE1ks5qldmjgaJpZM4Ji8B- .
DONSA commented 8 years ago

Yes, they must have changed something:

PHP Fatal error:  Uncaught exception 'ErrorException' with message 'Server error: `POST http://translate.google.com/translate_a/t` resulted in a `503 Service Unavailable` response:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="te (truncated...)
' in /Users/nlo/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.484AF645-7BFD-4C98-978D-2580B0BD3F27/vendor/stichoza/google-translate-php/src/Stichoza/GoogleTranslate/TranslateClient.php:263
Stack trace:
#0 /Users/nlo/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.484AF645-7BFD-4C98-978D-2580B0BD3F27/vendor/stichoza/google-translate-php/src/Stichoza/GoogleTranslate/TranslateClient.php(186): Stichoza\GoogleTranslate\TranslateClient->getResponse('asd')
#1 /Users/nlo/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.484AF645-7BFD-4C98-978D-2580B0BD3F27/GoogleTranslateWorkflow.php(122): Stichoza\GoogleTransla in /Users/nlo/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.484AF645-7BFD-4C98-978D-2580B0BD3F27/vendor/
ghost commented 8 years ago

Anyone has found a way to correct this ? Or is it due to some policy change by Google that is not authorizing some API ?

thomashempel commented 8 years ago

Looks like Google closed the door on the API again. :-/

gevgeny commented 7 years ago

Sad news. I just bought a license for Alfred 3 just because of this workflow ;). Any ideas how to workaround this issue ?

thiemehennis commented 7 years ago

I don't but Alfred is also useful without this workflow. But yes, this was my favourite as well!

hennis.nl // +31651855220 // Amsterdam, Delft

On Wed, Oct 19, 2016 at 11:25 AM, Eugene Gluhotorenko < notifications@github.com> wrote:

Sad news. I just buy a license for Alfred 3 just because of this workflow ;). Any ideas how to workaround this issue ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/32#issuecomment-254761098, or mute the thread https://github.com/notifications/unsubscribe-auth/ACsPM2o9BBnju99y0qrL-B_S9CDd_vQNks5q1eIbgaJpZM4Ji8B- .

thomashempel commented 7 years ago

Sorry, guys. But since Google is trying to earn money with the translation API, they regularly change the access and break these kind of clients. I'm not sure how to solve this and to be honest I'm not sure if can dedicate enough time to support this anytime soon.

gevgeny commented 7 years ago

Anyway thanks for the awesome try ;)

blackxored commented 7 years ago

It has apparently been fixed upstream at https://github.com/Stichoza/google-translate-php/issues/62. Obviously, I'm not that familiar, but if so this package only needs to update the dependency. Worst case scenario a bit of tweaking in the results might be required, but I don't think that'd be the case at all. Sadly I don't speak PHP so I'm hoping the author or someone more experienced than me would jump in. Thanks.

DONSA commented 7 years ago

I've created a pull request #34. Don't know if the author will aprove it, but you can still do the changes yourself. Run composer update stichoza/google-translate-php on the workflow folder and replace the file attached.

GoogleTranslateWorkflow.php.zip

johnwatsondev commented 7 years ago

@DONSA Hello, bro. I can't set the sourceLanguages and the targetLanguages with your approach. I also use Alfred 3.

I just create a blank workflow. Then I clone this repo and replace your GoogleTranslateWorkflow.php file in its src dir. I run the composer update stichoza/google-translate-php command under src working dir. Lastly, I copy all files in src folder to my blank workflow finder's dir.

Did I missed any important thing? Thanks for reply. BTW Could you send me a worked workflow?

DONSA commented 7 years ago

Hi, No need to create a new workflow. Just cd into workflow source folder and run composer on it. Then replace the attached file.

johnwatsondev commented 7 years ago

Thanks. Which release version did you use (3.2.0-pre1 or 3.1.2 in releases)?

DONSA commented 7 years ago

V3.1.2

kopiro commented 7 years ago

Thank you @DONSA

olbrew commented 7 years ago

Does this still work for you all? The operations work but the translation invariably returns ARRAY. Am I doing something wrong or did Google just change their API again?

DONSA commented 7 years ago

Works fine. I'm using stichoza/google-translate-php v3.2, make sure you use the same version. You can check it in composer.json.

thiemehennis commented 7 years ago

so it works fine with the latest version? Or only with modifications? If it works, that's new to me, I thought it did not work anymore due to changes at Google's side.

-- hennis.nl // +31651855220 // Amsterdam, Delft

On Thu, Jan 19, 2017 at 8:58 AM, Nuno notifications@github.com wrote:

Works fine. I'm using stichoza/google-translate-php v3.2, make sure you use the same version. You can check it in composer.json.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/32#issuecomment-273705733, or mute the thread https://github.com/notifications/unsubscribe-auth/ACsPM9djZqqzHpRA-nDI89wQub9BAL81ks5rTxeMgaJpZM4Ji8B- .

DONSA commented 7 years ago

Only with the modifications I did in GoogleTranslateWorkflow.php file.

olbrew commented 7 years ago

@DONSA thanks! I've found out what the problem was. The GoogleTranslateWorkflow.php you linked to in https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/32#issuecomment-263400058 points to the original one for some reason. Using the one from your Pull Request found here worked for me.

thiemehennis commented 7 years ago

for non-programmers - what is the step by step procedure to get this workflow working? Do I download the 'latest' workflow? And then?

DONSA commented 7 years ago

I will fork this project this weekend and create the workflow. I will post the link when it's finished.

thiemehennis commented 7 years ago

thanks Nuno!

-- hennis.nl // +31651855220 // Amsterdam, Delft

On Fri, Jan 20, 2017 at 9:58 AM, Nuno notifications@github.com wrote:

I will fork this project this weekend and create the workflow. I will post the link when it's finished.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/32#issuecomment-274014854, or mute the thread https://github.com/notifications/unsubscribe-auth/ACsPMwQloLspUzCsyxkC1TrHIVrW_X47ks5rUHdDgaJpZM4Ji8B- .

johnwatsondev commented 7 years ago

Finally, I found the issue. My network is broken in fu*king China Mainland. :( I must use VPN get google translate working normally. @DONSA Thank for hard work again.

DONSA commented 7 years ago

I don't know a lot about the original behaviour because I've tweaked the original version to work as I need. In my version I set the languages that I need to automatically translate whatever I type in. The version that I will upload will reflect those changes.

Example: screen shot 2017-01-20 at 11 14 38

DONSA commented 7 years ago

I've forked the project and did some minor changes. You can now use the ⇧ + ⌘ + i shortcut to open the flow. No need to type translate or gt. Get back to me if you found any bugs and feel free to make suggestions to improve it.

thiemehennis commented 7 years ago

thanks Nuno! It works again!

On Sat, Jan 21, 2017 at 10:55 AM, Nuno notifications@github.com wrote:

I've forked https://github.com/DONSA/AlfredGoogleTranslateWorkflow the project and did some minor changes. You can now use the ⇧ + ⌘ + i shortcut to open the flow. No need to type translate or gt. Get back to me if you found any bugs and feel free to make suggestions to improve it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/32#issuecomment-274251702, or mute the thread https://github.com/notifications/unsubscribe-auth/ACsPM1yf9yf3ep5xP-QEcdcdhG16w5Ueks5rUdYKgaJpZM4Ji8B- .

luxxi commented 7 years ago

@DONSA your forked version worked fine for me, except the settings editing. It shows a warning (image in attachment) and settings are not saved.

screen shot 2017-02-04 at 21 14 43
DONSA commented 7 years ago

Create a issue topic in forked project and I will take a look.

luxxi commented 7 years ago

Unfortunately is not possible to open an Issue on your forked project. I found out it is the hard coded path in workflows.php that caused the problem.

DONSA commented 7 years ago

Ups, you can create now.