atykhonov / google-translate

Emacs interface to Google Translate
369 stars 47 forks source link

Support long text for translate_tts #66

Closed OGAWAHirofumi closed 4 years ago

OGAWAHirofumi commented 7 years ago

If text length is longer than 200 (in my test, limit was 200), translate_tts returns 404 error.

To support longer than 200, this tries to split text at sentence if possible. Then pass made URLs to google-translate-listen-program as arguments at once.

Like following,

program "http://...&total=2&idx=0..." "http://...&total=2&idx=1..."

With this, the program can process long text. patch file

stardiviner commented 4 years ago

Would you like to send PR for this feature?

stardiviner commented 4 years ago

I tested on my computer, can't reproduce this issue. Can you describe the deatails about how to reproduce this issue?

OGAWAHirofumi commented 4 years ago
(google-translate-listen-translation "en" (apply #'concat
                         (make-list 60 "test ")))

For example, above test code fails to play audio without the patch in my test.

stardiviner commented 4 years ago

I don't know how to apply your patch, for this time, I manually added your code one by one. Confirmed the problem, and tested your patch works fine. Thanks

I will create an PR with set commit author to you. Hope you can use GitHub PR entry next time. Thanks for your contibution.

OGAWAHirofumi commented 4 years ago

Oh, FWIW the patch will be applied by the following command,

# git am <patch file>

stardiviner commented 4 years ago

Weird, I can't apply your patch file through Magit's command W a a. What's the difference?

OGAWAHirofumi commented 4 years ago

I see. You tried it already, then maybe the sources were changed from when I created a patch.