otsaloma / gaupol

Editor for text-based subtitle files
https://otsaloma.io/gaupol/
GNU General Public License v3.0
251 stars 34 forks source link

thanks + request for TXT import #191

Closed berteh closed 2 years ago

berteh commented 2 years ago

Thanks for the great tool, works fast and well in light Xubuntu !

To quickly translate subtitles I like to copy-paste (thus without the timing tags) the strings in an online translation service (deepl.com, a.o.). Would love a way to import the translated texts back as a translation, in batch starting from the "current" subtitle entry, matching linebreaks with the original strings.

Importing all the translated texts from a simple txt file, with the same linebreaks detection/support, would be a working alternative too.

Any idea how to do it if it's already possible in gaupol? or any pointer to where in the code I could try to add such a feature?

berteh commented 2 years ago

I thought I'd try to register another 'paste' action, with another shortcut, that would behave a bit like ClipboardAgent.pasteTexts https://github.com/berteh/gaupol/blob/cc1c5f256ed886982ded8b7cfe6f50ccf8e9e623/aeidon/agents/clipboard.py#L48 but I don't find how to easily register an alternative action, nor how to match original text newlines with copied text newlines.

Is this the right place to look at ?

otsaloma commented 2 years ago

Hi! I just tried deepl.com and it seems to me you can just copy texts from Gaupol, translate and then copy back the translated texts. Gaupol's format is to have blank lines between subtitles, deepl preserves those, so it should just work. Or do I misunderstand something?

DeepL-Translate-The-world-s-most-accurate-translator

berteh commented 2 years ago

Indeed it did work. I don't know why it seemed not to on my first try where it copied all translated lines within a single entry.

Thanks and congrats!