LibreOffice plugin to pipe whole Writer documents through Google Translate, that ought to keep most of the page formatting.

⌈⌋ ⎇ branch:  PageTranslate


View Ticket

Ticket Hash: 34e515d90f4147103cd2041b401fbe6c85769866
Title: doesn work in LibreOffice 7.1.2.2
Status: Fixed Type: Incident
Severity: Critical Priority: Immediate
Subsystem: Resolution: Fixed
Last Modified: 2021-05-13 18:44:03
Version Found In: 1.6.39
User Comments:
anonymous added on 2021-05-06 13:03:06:

When you click on the Icon (or select the pair on the PageTranslate menu), a pop-up appears with the following message

'str' object has no attribute 'unescape'

Traceback (most recent call last):
  File "/home/malevolent/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu126545cqxk80.tmp_/PageTranslate.oxt/pagetranslate.py", line 125, in trigger
    self.rewrite_selection(selection)
  File "/home/malevolent/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu126545cqxk80.tmp_/PageTranslate.oxt/pagetranslate.py", line 218, in rewrite_selection
    trans = self.t.linebreakwise(string)
  File "/home/malevolent/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu126545cqxk80.tmp_/PageTranslate.oxt/pythonpath/translationbackends.py", line 89, in linebreakwise
    text = "\n\n".join(self.translate(text) for text in text.split("\n\n"))
  File "/home/malevolent/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu126545cqxk80.tmp_/PageTranslate.oxt/pythonpath/translationbackends.py", line 89, in <genexpr>
    text = "\n\n".join(self.translate(text) for text in text.split("\n\n"))
  File "/home/malevolent/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu126545cqxk80.tmp_/PageTranslate.oxt/pythonpath/translationbackends.py", line 83, in translate
    return self.fetch(text, lang)
  File "/home/malevolent/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu126545cqxk80.tmp_/PageTranslate.oxt/pythonpath/translationbackends.py", line 59, in fetch
    text = html.unescape(text)
AttributeError: 'str' object has no attribute 'unescape'


mario added on 2021-05-12 05:05:53:

Thanks for the report! I applied a quick patch - for what was essentially a dumb variable collision. (Was broken for all AOO/LO versions, I think.)

This is kinda still in-the-midst of two releases; and there's a few other gotchas still. So not making a new release for now.


mario added on 2021-05-13 18:44:03:

Looks good after a couple more tests. Published as 1.7