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

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


extending.page

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


<?xml version="1.0"?>
<?xml-stylesheet href="./mallard2xhp.xsl" type="text/xsl"?>
<page
    xmlns="http://projectmallard.org/1.0/"
    type="topic"
    id="extending">

<info>
    <desc>Extending</desc>
</info>

<title>Extending menu options</title>

<section id="addons">
<p>Adding a new target language to the PageTranslate tools menu requires
just a bit of effort, but little programming.</p>
<steps>
 <item>Get a copy of the <file>pagetranslate.oxt</file> package.</item>
 <item>Unzip the file (<file>.oxt</file> is a <app>.zip</app>) in an empty directory.</item>
 <item>Edit the <file>Addons.xcu</file>
   <terms>
     <item>Therein <em>duplicate</em> one of the following blocks:
       <code><![CDATA[
      <node oor:name="M2XXXXXXXX" 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=XX</value></prop>
        <prop oor:name="Title" oor:type="xs:string"><value/><value xml:lang="en-US">β†’Lang XX</value></prop>
        <prop oor:name="Target" oor:type="xs:string"><value>_self</value></prop>
      </node>
       ]]></code>
     </item>
     <item>Edit the <em>lang=XX</em> for the URL to actually change the behaviour.
           The <em>XX</em> must be a two-letter language code (for instance "ru" or "dk") and all lowercase.</item>
     <item>The title β†’Lang should be descriptive, obviously.</item>
     <item>Also make the oor:name="M2………" identifier unique in this xml file.</item>
   </terms>  
 </item>
 <item>And finally just repackage the <file>Addons.xcu</file> into the oxt:
   <p><input>zip a pagetranslate.oxt Addons.xcu</input></p>
 </item>
 <item>Then reinstall the customized extension.</item>
</steps>

<p>
There's also a contrib/dev script <file>addlang.py</file> to generate such a language block,
which crafts the Unicode flag emoji as well. If you want to contribute/correct some of the
existing menu entries, please just register a repository account and send a mail to have it
elevated for commit permissions.
</p>
</section>

</page>