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

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

Move help pages into Extensions>Pagetranslate>โ€ฆ
mario authored 17 days ago last checkin b7f90e8be
๐Ÿ“‚ META-INF Introduce crude help file for config options.โ€นโ€บ 29 days ago
๐Ÿ“‚ help Move help pages into Extensions>Pagetranslate>โ€ฆโ€นโ€บ 17 days ago
๐Ÿ“‚ icons resized, lighter blue tonesโ€นโ€บ 61 days ago
๐Ÿ“‚ off Reenable cursor/selection mode (Tradutor trigger). Prepare binding toโ€นโ€บ 66 days ago
๐Ÿ“‚ pkg-desc move license text to pkg-desc/โ€นโ€บ 46 days ago
๐Ÿ“‚ pythonpath Prepare for TextFrame support, reinstate self.t=translationbackends.*โ€นโ€บ 41 days ago
๐Ÿ“„ Addons.xcu Add <kbd>๐Ÿด</kbd> to Draw/Impress. Submenus still missing there howeveโ€นโ€บ 39 days ago
๐Ÿ“„ Makefile Use saxonb-xslt for help pages, add short usage/intro page.โ€นโ€บ 27 days ago
๐Ÿ“„ OptionsDialog.xcu AOO compat. OptionsDialog XCU requires leaf name to equal handler ID.โ€นโ€บ 40 days ago
๐Ÿ“„ OptionsDialog.xdl Fix to dlg:help-url=โ€ฆ Now context-sensitive help pops up for F1 in seโ€นโ€บ 27 days ago
๐Ÿ“„ OptionsSchema.xcs Add default flags `-o -t {lang}` for cli backend.โ€นโ€บ 29 days ago
๐Ÿ“„ description.xml (no comment)โ€นโ€บ 37 days ago
๐Ÿ“„ pagetranslate.py Add default flags `-o -t {lang}` for cli backend.โ€นโ€บ 29 days ago

PageTranslate

OpenOffice/LibreOffice extension that translates whole documents, whilst retaining some formatting.

  • Iterates over paragraphs / text segments / and tables (only linebreaks kept)
  • Utilizes Google translate (or DeepL, Microsoft Translate, MyMemory).
  • And is therefore rather slow.
    (Writer freezes during process for long documents!)
  • Still allows for text-selection mode translation (from original extension).

Test/Install

Download the package file, and import it in LibreOffice via Tools โ†’ Extension Manager โ†’ Add.

Location Features Link
Source repository Newest package, Linux-only package, no python dependencies pagetranslate.oxt
LibreOffice Extensions Older/stable versions, bundles python requests library https://extensions.libreoffice.org/extensions/pagetranslate
OpenOffice Extensions Full releases, AOO/LO/Windows compatible (bundles translate+requests) https://extensions.openoffice.org/en/project/pagetranslate

Usage

  • Hit the Tโ†’๐Ÿ‡ฌ๐Ÿ‡ง toolbar button to get entire document translated to English. Have some trust and patience for longer documents.
  • The second button ๐Ÿด translates to the local/system language.
  • Or select a paragraph, to get a partial translation.
  • Alternatively pick a menu entry from Extras > PageTranslate.
  • The โ†’System lang entry refers to your OpenOffice/Desktop setting.
  • Whereas โ†’ Paragraph locale respects the text language as set in the Writer status bar.
  • Configure options in Toolsโ†’Optionsโ†’Language Settingsโ†’PageTranslate

Caveats

  • Does not yet support anything but Writer documents. (Structure is entirely distinct for Draw/Impress).
  • The plugin is also likely to crash (won't affect Writer) when encountering complex documents (embedded drawings, Calc sheets, OLE elements, etc). It's only been tested with flow text and text tables.
  • Generally there's a log file in /tmp.
  • Not sure if the toolbar icons work at all, or if that's a bug in the Linux version of LibreOffice.
  • OpenOffice support is somewhat preliminary still (albeit it's mostly Python 2.7 fallbacks and XCU variations).
  • For direct content.xml translations, there's an inconvenient tool in off/. (Each office document .odt/.odc is a zip file. Extract the content.xml, apply the script, then repackage the content.xml into the .odc)

ToDo

  • Finalize DeepL web translation mode (for testing really). The API mode is untested, but likely faster because longer paragraphs can be translated at once. And reportedly it yields smoother/more natural translations. (No XML block translation yet.)
  • Unfortunately not sure yet how to bundle requests.
  • Nor how to craft an options/settings page.
  • Support for TextFrames
  • Figure out if getText() provides for some XML serialization, or how to traverse Paragraphs piece by piece (super slow mode: retain more formatting).