<?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">
<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>
</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>