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

โŒˆโŒ‹ โŽ‡ branch:  PageTranslate

Change exception names, and use `LangSelection` for dialog (makes error more understandable).
mario authored 49 days ago last checkin c62b11cb0
๐Ÿ“„ Makefile Disable ToggleDropdown, update dependenciesโ€นโ€บ 57 days ago
๐Ÿ“„ httprequests.py Fix GogoleAjax to rejoin split up ssentences (from nested list).โ€นโ€บ 57 days ago
๐Ÿ“„ pt_dialogs.py Change exception names, and use `LangSelection` for dialog (makes errโ€นโ€บ 49 days ago
๐Ÿ“„ six.py Compatibility with AOO uno and python (2.7, not 3.x), PropertyValue()โ€นโ€บ 428 days ago
๐Ÿ“„ translationbackends.py Change exception names, and use `LangSelection` for dialog (makes errโ€นโ€บ 49 days ago
๐Ÿ“„ unocompat.py Move MessageBox() to unocompat (not actually used anymore, doesn't woโ€นโ€บ 49 days ago

pythonpath

Any modules in pythonpath/ become accessible in the LibreOffice python environment.

  • Hence a good place for splitting some code into.
  • Also used to bundle requests and other modules for Windows-package (1MB .oxt).

See the Makefile on how to deploy additional packages herein. Afterwards you could simply add/copy this directory into any existing pagetranslate.oxt.

Alternatively to bundling python modules in the OXT, one could also install them system-wide, or even within the Office program/ folder.

System installation

For Linux and LibreOffice installations, it's most sensible to add dependencies for the current user or Python site-packages via:

pip3 install -U requests translate deep-translator six 
# or `sudo pip3 ...` for system-wide installation

OpenOffice python-core

OpenOffice comes with a bundled python interpreter and package library, which also allows expansion. You should do this very selectively, and keep in mind that it's unlikely permanent (e.g. when updating/reinstalling the office package itself).

You firstly need to locate the openofficeX/program/ folder. It contains both the python binary and a python-core-x.x.x/ directory. For example /opt/openoffice4/program/python-core-2.x.x/. Therein you can update packages via:

pip install -U requests translate deep-translator -t ./lib/site-packages/

Again, this isn't the most advisable approach, but sometimes the easiest workaround for ImportErrors and such.

Windows

The same procedure can be used for Windows installations of LibreOffice/OpenOffice. You should have a pip.exe in the OpenOffice4.x\program\ folder already. Else use get-pip.py from https://bootstrap.pypa.io/ with the existing python.exe.