Closed gustavosmendes closed 3 years ago
If I understood it correctly, it should be already possible with Format
set to Text
.
Format: Text
Format: HTML
Sorry. I meant in the aspect of translating the text and ignoring the image. Also, I noticed there are differences in translation of some cards when selected to keep html or ignore. Lastly, html translation has ignored the hints. Is there anything that can be done?
- translate with html
translate only text
This represents two contexts, the one with "text only" being more trustworthy in the sense. This behavior occurs with other cards. For this reason I thought of translating "text only", ignoring other sentences.
Edit: HTML translation reminds Yoda speaking.
I'm sorry but I don't quite understand. "Format: Text" will translate the text and ignore the image (and all other HTML tags).
If you want to use "Format: HTML" (to keep some HTML formatting like colors or bold text) but remove the image from the translated text, I'm not sure the add-on can do it. One possible option is to use Find and Replace with regular expressions from the card browser to replace something like <img.*?> with nothing. Or maybe keep the image in the translated field but hide it during review with some CSS in the Styling section of the card template like https://www.w3schools.com/css/tryit.asp?filename=trycss_display_none
Yes, the implementation of HTML translation is kind of naive as there no option on https://translate.google.com/ to translate as HTML and it was implemented by sending HTML to translate instead of text, it was good enough on a few tests to include it in the add-on (not this time) but it's better to translate as text.
A possible solution might be to somehow translate HTML with Chrome (#15) as it seems to work well.
Another possible option is to add support for Google Cloud Translation API - https://cloud.google.com/translate/
About translating hints, I created a new issue - https://github.com/kelciour/google-translate/issues/17
Thank you for your effort. Last question: I'm currently trying to use the opposite: delete the text and keep only the so I can use the advanced copy fields and translate into another field. I don't understand about codes or regex. Could you tell me how I would avoid it? I've searched a lot and I have failed. e.g. I want to keep only the <img.*?> and delete the rest.
I replied at https://forums.ankiweb.net/t/help-with-regex/13433
Hello!
I would like to suggest this feature: if I have a field with text and image, the option to translate only the text would be useful.
Thank you for your effort.