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

⌈⌋ branch:  PageTranslate


Artifact [2e6c8fd17c]

Artifact 2e6c8fd17c78924875b15024694ae7718e86359a:

  • Executable file off/addlang.py — part of check-in [bc8c7befa0] at 2021-02-03 20:25:50 on branch trunk — Add more languages ('le continental submenus) (user: mario size: 728)

#!/usr/bin/env python3


import sys

(bin, ln, title) = sys.argv

symbol = u"".join(([chr(ord("🇦")+ord(c)-ord("a")) for c in ln]))


xml = f"""
                    <node oor:name="M2{ln.upper()}" oor:op="replace">
                      <prop oor:name="Context" oor:type="xs:string"><value/></prop>
                      <prop oor:name="URL" oor:type="xs:string"><value>service:org.openoffice.comp.pyuno.pagetranslate?trigger&amp;lang={ln}</value></prop>
                      <prop oor:name="Title" oor:type="xs:string"><value/><value xml:lang="en-US">→{title} {symbol}</value></prop>
                      <prop oor:name="Target" oor:type="xs:string"><value>_self</value></prop>
                    </node>
"""
print(xml)