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

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


Artifact [7be55cebb5]

Artifact 7be55cebb525a6be76d35c5e65dd0bb81f2ed6d7:

  • File help/en/vnd.include-once.pagetranslate/extending.xhp — part of check-in [805811f8ff] at 2021-02-04 18:01:50 on branch trunk — Add a few more languages. (user: mario size: 3761)

<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
   <meta>
      <topic id="topic_d1e2" indexer="include" status="PUBLISH">
         <title xml-lang="en" id="title_d1e2">Extending menu options</title>
         <filename>/help/vnd.include-once.pagetranslate/extending.xhp</filename>
      </topic>
      <history>
         <created date="2020-02-02T22:22:22"/>
         <lastedited date="2021-02-03T22:37:36.182+01:00"/>
      </history>
   </meta>
   <body>



      <paragraph id="hd_d1e10" role="heading" level="1" xml-lang="en">Extending menu options</paragraph>

      <paragraph id="sect_d1e13" role="section" xml-lang="en">
         <paragraph id="par_d1e15" role="paragraph" xml-lang="en">Adding a new target language to the PageTranslate tools menu requires
just a bit of effort, but little programming.</paragraph>
         <list id="steps_d1e18" bullet="disc" type="ordered" xml-lang="en">
            <listitem id="item_d1e20" xml-lang="en">Get a copy of the <item type="fileitem">pagetranslate.oxt</item> package.</listitem>
            <listitem id="item_d1e26" xml-lang="en">Unzip the file (<item type="fileitem">.oxt</item> is a <item type="menuitem">.zip</item>) in an empty directory.</listitem>
            <listitem id="item_d1e35" xml-lang="en">Edit the <item type="fileitem">Addons.xcu</item>
               <list id="terms_d1e40" xml-lang="en">
                  <listitem id="item_d1e42" xml-lang="en">Therein <emph>duplicate</emph> one of the following blocks:
       <paragraph id="par_d1e47" role="code" xml-lang="en" xml:space="preserve">
    
      &lt;node oor:name="M2XXXXXXXX" oor:op="replace"&gt;
        &lt;prop oor:name="Context" oor:type="xs:string"&gt;&lt;value/&gt;&lt;/prop&gt;
        &lt;prop oor:name="URL" oor:type="xs:string"&gt;&lt;value&gt;service:org.openoffice.comp.pyuno.pagetranslate?trigger&amp;amp;lang=XX&lt;/value&gt;&lt;/prop&gt;
        &lt;prop oor:name="Title" oor:type="xs:string"&gt;&lt;value/&gt;&lt;value xml:lang="en-US"&gt;β†’Lang XX&lt;/value&gt;&lt;/prop&gt;
        &lt;prop oor:name="Target" oor:type="xs:string"&gt;&lt;value&gt;_self&lt;/value&gt;&lt;/prop&gt;
      &lt;/node&gt;
       
  </paragraph>
                  </listitem>
                  <listitem id="item_d1e51" xml-lang="en">Edit the <emph>lang=XX</emph> for the URL to actually change the behaviour.
           The <emph>XX</emph> must be a two-letter language code (for instance "ru" or "dk") and all lowercase.</listitem>
                  <listitem id="item_d1e60" xml-lang="en">The title β†’Lang should be descriptive, obviously.</listitem>
                  <listitem id="item_d1e63" xml-lang="en">Also make the oor:name="M2………" identifier unique in this xml file.</listitem>
               </list>  
            </listitem>
            <listitem id="item_d1e68" xml-lang="en">And finally just repackage the <item type="fileitem">Addons.xcu</item> into the oxt:
   <paragraph id="par_d1e73" role="paragraph" xml-lang="en">
                  <paragraph id="par_d1e74" role="code" xml-lang="en" xml:space="preserve">
    zip a pagetranslate.oxt Addons.xcu
  </paragraph>
               </paragraph>
            </listitem>
            <listitem id="item_d1e78" xml-lang="en">Then reinstall the customized extension.</listitem>
         </list>

         <paragraph id="par_d1e82" role="paragraph" xml-lang="en">
There's also a contrib/dev script <item type="fileitem">addlang.py</item> 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.
</paragraph>
      </paragraph>

   </body>
</helpdocument>