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

⌈⌋ branch:  PageTranslate

File help/en/vnd.include-once.pagetranslate/ from the latest check-in

= Errors
@link[topic xref=index]

Error messages will largely show up as long-winded popups with Python
exceptions. Where the text usually starts with "Traceback" and then
quite a few iterations of code locations, but the most relevant details
near the end.

Known errors:

== ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED]

This indicates a broken Python 3.x installation in LibreOffice development

You can't easily fix this other than installing a full or older release from
the // site.  (Respectively the OpenOffice one.)

== Placeholder text/error messages instead of translated text

The translate-python (MyMemory or Microsoft Translator) services or the CLI
option are bound to yield some error messages in place of translated text.
Hard to predict what those might be, and you'll have to look at configuring
these extensions separately (e.g. via  ~/.python-translate.cfg)

== No error / Nothing happens

Take a look into the log file in /tmp/pagetranslate-libreoffice.txt (or
C:\TEMP\ probably on Windows).  Be sure to have the ☑ debug mode option
enabled beforehand.

This will contain some indicators as to what went wrong.  That's bound to be
a programming problem in the extension/python script.  So would require you
to contact the author (with as much detail as feasible; including the log
and a sample document perhaps.)

== Only first sentence/paragraph translated

Might be caused by invisible objects, or some other text object traversal
error. Again, needs debugging output.

If using the "paragraph locale" mode, then the langauge might simply
mismatch between text snippets.

== AttributeError: 'NoneType' object has no attribute 'getElementNames' / DEBUG:root:callHandlerMethod

Might be an entry in the log file, and settings won't get saved/applied
in the options dialog. If so, the LO options registry couldn't be found.
You might have luck with reinstalling the extension (which reapplies the
XCS). Otherwise it's a programming error.

== AttributeError: 'SxSWhatever' object has no attribute 'getString'

Or something alike might indicate that the document has complex/unknown
elements embedded, which the traversion method trips over. (Some such
objects might identify themselves as TextContent-capable, but aren't.)

Somewhat speculative error. And anyway, you would have to send in a
sample document and the log to the extension author to get this fixed.
Else, use selection/paragraph-wise translation for the time being.

== uno.RuntimeException/AttributeError: ... object has no attribute 'getTypes'

Such errors are often resulting from one of the translation backends
not returning a proper text string / translation. Please fill a bug report
with your log, and use a different service for the time being.

== AttributeError: 'LangSelection' object has no attribute 'to'

That's the shallow error message when the From→To language selection
was canceled by closing the dialog.

== Options dialog is empty

This might be a development bug only. If the log shows nothing but the __init__
call, the extension usually requires removal and reinstall (per CLI *and*
GUI extension manager perhaps). Presumably there's some old schema version
in the OO registry, which prevents updated versions from taking effect.


If this messsage shows up in the log, the google translate backend
(`pythonpath/`) requires updating. Specifically the
regex in `rx_gtrans` for extracting the target string.


The langauge detection failed. You'll probably have to use the
Tools→PageTranslate→From➜To dialog to specify both input and target


Add an email address (Tools→Options→Language→PageTranslate) for MyMemory.


This error shouldn't really happen anymore, as the default fallback
for MyMemory is 'en' and not 'auto'.

== ImportError: No module named deep_translator

You'll have to install this Python package first, before using
some of the translation backends: `pip install deep-translator`.
Or use a larger OXT with bundled extensions.

== ImportError: No module named argostranslate

The ArgosTranslate backend requires installing the according Python

== IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! / Original error was: No module named 'numpy.core._multiarray_umath'

This is a problem of the OpenNMT backend. It can't be used with the
LibreOffice-bundled Python. It's not compatible with the numpy binary
extension. This backend only works with a distro-supplied Office, which
ties to the system-installed Python. // Alternatively use the CLI tool
with "command line tool" as backend.

== CannotConvertException: value does not implement

That error came up for the annotation/comment option (preserving
untranslated text). Should not occur with the current implementation.
But if, it might be a symptom of complex documents. And disabling
the annotate option might suffice to get rid of it.

== How to report a bug

@link[seealso >>] repository
The project repository
allows to file a bug report (no registration necessary).

 * The log file MUST be included,
 * together with a sample document (as link),
 * as well as the OpenOffice version (Help → About → Copy)
 * latest or development version has been tested.

Insufficient submissions are unlikely to spark developer interest.