Check-in [a2bf060c6d]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Introduce crude help file for config options. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a2bf060c6d0d20b9f581c2912a012f09 |
User & Date: | mario 2020-06-10 05:09:11 |
Context
2020-06-10
| ||
05:10 | Add help-uri=vnd.sun.star.help://help/vnd.include-once.pagetranslate/config.xhp?Language=en&…; doesn't work of course. check-in: 15c0def16d user: mario tags: trunk | |
05:09 | Introduce crude help file for config options. check-in: a2bf060c6d user: mario tags: trunk | |
05:08 | Add default flags `-o -t {lang}` for cli backend. check-in: 5a0ee83349 user: mario tags: trunk | |
Changes
Changes to META-INF/manifest.xml.
1 2 3 4 5 6 7 8 9 | <?xml version="1.0" encoding="UTF-8"?> <manifest:manifest> <manifest:file-entry manifest:media-type="application/vnd.sun.star.package-bundle-description" manifest:full-path="pkg-desc/pkg-description.txt"/> <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" manifest:full-path="./Addons.xcu"/> <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" manifest:full-path="./OptionsDialog.xcu"/> <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-schema" manifest:full-path="./OptionsSchema.xcs" /> <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python" manifest:full-path="pagetranslate.py"/> <manifest:file-entry manifest:media-type="image/png" manifest:full-path="icons/flags.png"/> </manifest:manifest> | > | 1 2 3 4 5 6 7 8 9 10 | <?xml version="1.0" encoding="UTF-8"?> <manifest:manifest> <manifest:file-entry manifest:media-type="application/vnd.sun.star.package-bundle-description" manifest:full-path="pkg-desc/pkg-description.txt"/> <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" manifest:full-path="./Addons.xcu"/> <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" manifest:full-path="./OptionsDialog.xcu"/> <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-schema" manifest:full-path="./OptionsSchema.xcs" /> <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python" manifest:full-path="pagetranslate.py"/> <manifest:file-entry manifest:media-type="image/png" manifest:full-path="icons/flags.png"/> <manifest:file-entry manifest:full-path="help" manifest:media-type="application/vnd.sun.star.help"/> </manifest:manifest> |
Changes to Makefile.
1 2 3 4 5 6 7 8 | all: oxt install install: unopkg remove vnd.include-once.pagetranslate unopkg add --log-file log.txt -s pagetranslate.oxt oxt: version --read pagetranslate.py --incr --write pagetranslate.py --write description.xml | | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | all: oxt install install: unopkg remove vnd.include-once.pagetranslate unopkg add --log-file log.txt -s pagetranslate.oxt oxt: version --read pagetranslate.py --incr --write pagetranslate.py --write description.xml zip pagetranslate.oxt -r META-INF pagetranslate.py *xcu *xcs *xdl *desc* icons pythonpath/ help #pythonpath: aoo: oxt /opt/openoffice4/program/unopkg add pagetranslate.oxt /opt/openoffice4/program/soffice -writer xhp: cd help/en/vnd.include-once.pagetranslate/ && xsltproc mallard2xhp.xsl config.page.xhp > config.xhp |
Added help/en/help.tree.
> > > > > > > | 1 2 3 4 5 6 7 | <?xml version="1.0" encoding="UTF-8"?> <tree_view> <help_section application="vnd.include-once.pagetranslate" id="idm49428" title="PageTranslate"> <topic id="help/vnd.include-once.pagetranslate/config.xhp">Config options</topic> <topic id="help/vnd.include-once.pagetranslate/config.page.xhp">Config options (src)</topic> </help_section> </tree_view> |
Added help/en/vnd.include-once.pagetranslate/config.page.xhp.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | <!--?xml-stylesheet href="./mallard2xhp.xsl" type="text/xsl"?--> <!--%origin%/help/en/vnd.include-once.pagetranslate/--> <page xmlns="http://projectmallard.org/1.0/" type="guide" group="first" id="config"> <info> <link type="guide" xref="OptionsPageTranslate"/> <link type="index" xref="translation; pagetranslate; options"/> <desc>PageTranslate settings</desc> </info> <title>Translation settings</title> <p>The options page can be found under Tools → Options → Language Settings → PageTranslate.</p> <section id="service"> <title>Translation service to use</title> <terms> <item> <title>☑ Google Translate</title> <p>That's the default, and suitable to both text selection and translating whole pages. Provides pretty good machine translations. It incurs some delays for longer texts, as each 1900 characters (sentences/paragraphs) have to be transfered individually (managed automatically, no user interaction necessary).</p> </item> <item> <title>❏ DeepL web</title> <p>Only makes sense for translating a single-paragraph / text selection, because it quickly blocks with "error 429 - too many requests" otherwise.</p> </item> <item> <title>❏ DeepL per API</title> <p>Use the speedier API to translate documents. As of yet untested. Requires an API key and paid subscription. No XML mode yet, still translates each text segment/paragraph/sentence individually. </p> </item> <item> <title>❏ Microsoft Translator</title> <p>Requires an authorization key, and a `pip install translate` system package. Not tested within PageTranslate yet.</p> </item> <item> <title>❏ MyMemory</title> <p>Should have an email address in the according input box (though optional). Also requires `pip install translate`, unless the full OpenOffice plugin bundle was installed. </p> </item> <item> <title>❏ Command line tool</title> <p>Allows to send each text paragraph to a local application. To use it, set the command in the according input field again. Placeholders are `{lang}` for the target language, and `{text}` for the paragaphs or current text section. (Both get automatically escaped.) </p> </item> </terms> </section> <section id="flags"> <title>Operation flags</title> <terms> <item> <title>❏ quick linebreak handling</title> <p>Might speed up table processing with Google Translate, as it avoids sending each newline-split sentence separately.</p> </item> <item> <title>❏ also iterate over TextFrames</title> <p>handles floating textframes / subdocuments.</p> </item> <item> <title>❏ super slow mode</title> <p>iterates over paragraph segments, to keep more inline formatting - but seriously harms mid-sentence translations. Not very useful in practice.</p> </item> <item> <title>☑ debug mode</title> <p>Will fill up the /tmp/pagetranslate-libreoffice.txt log file quicker.</p> </item> </terms> </section> </page> |
Added help/en/vnd.include-once.pagetranslate/config.xhp.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | <?xml version="1.0"?> <helpdocument version="1.0"> <meta> <topic id="topic_idm1" indexer="include" status="PUBLISH"> <title xml-lang="en" id="title_idm1">Translation settings</title> <filename>/help/vnd.include-once.pagetranslate/config.xhp</filename> </topic> <history> <created date="2020-02-02T22:22:22"/> <lastedited date="2020-02-02T22:22:22"/> </history> </meta> <body> <bookmark id="bm_idm3" branch="hid/vnd.include-once.pagetranslate:OptionsPageTranslate" xml-lang="en"><bookmark_value>PageTranslate settings</bookmark_value></bookmark> <bookmark id="helpindex_idm4" branch="index" xml-lang="en"><bookmark_value>translation; pagetranslate; options</bookmark_value></bookmark> <!--xsl:skipped=<desc>--> <paragraph id="hd_idm6" role="heading" level="1" xml-lang="en">Translation settings</paragraph> <paragraph id="par_idm7" role="paragraph" xml-lang="en">The options page can be found under Tools → Options → Language Settings → PageTranslate.</paragraph> <paragraph id="sect_idm8" role="section" xml-lang="en"> <paragraph id="hd_idm9" role="heading" level="2" xml-lang="en">Translation service to use</paragraph> <list id="terms_idm10" xml-lang="en"> <listitem id="item_idm11" xml-lang="en"><paragraph id="hd_idm11" role="heading" level="6" xml-lang="en">☑ Google Translate</paragraph>That's the default, and suitable to both text selection and translating whole pages. Provides pretty good machine translations. It incurs some delays for longer texts, as each 1900 characters (sentences/paragraphs) have to be transfered individually (managed automatically, no user interaction necessary).</listitem> <listitem id="item_idm14" xml-lang="en"><paragraph id="hd_idm14" role="heading" level="6" xml-lang="en">❏ DeepL web</paragraph>Only makes sense for translating a single-paragraph / text selection, because it quickly blocks with "error 429 - too many requests" otherwise.</listitem> <listitem id="item_idm17" xml-lang="en"><paragraph id="hd_idm17" role="heading" level="6" xml-lang="en">❏ DeepL per API</paragraph>Use the speedier API to translate documents. As of yet untested. Requires an API key and paid subscription. No XML mode yet, still translates each text segment/paragraph/sentence individually. </listitem> <listitem id="item_idm20" xml-lang="en"><paragraph id="hd_idm20" role="heading" level="6" xml-lang="en">❏ Microsoft Translator</paragraph>Requires an authorization key, and a `pip install translate` system package. Not tested within PageTranslate yet.</listitem> <listitem id="item_idm23" xml-lang="en"><paragraph id="hd_idm23" role="heading" level="6" xml-lang="en">❏ MyMemory</paragraph>Should have an email address in the according input box (though optional). Also requires `pip install translate`, unless the full OpenOffice plugin bundle was installed. </listitem> <listitem id="item_idm26" xml-lang="en"><paragraph id="hd_idm26" role="heading" level="6" xml-lang="en">❏ Command line tool</paragraph>Allows to send each text paragraph to a local application. To use it, set the command in the according input field again. Placeholders are `{lang}` for the target language, and `{text}` for the paragaphs or current text section. (Both get automatically escaped.) </listitem> </list> </paragraph> <paragraph id="sect_idm29" role="section" xml-lang="en"> <paragraph id="hd_idm30" role="heading" level="2" xml-lang="en">Operation flags</paragraph> <list id="terms_idm31" xml-lang="en"> <listitem id="item_idm32" xml-lang="en"><paragraph id="hd_idm32" role="heading" level="6" xml-lang="en">❏ quick linebreak handling</paragraph>Might speed up table processing with Google Translate, as it avoids sending each newline-split sentence separately.</listitem> <listitem id="item_idm35" xml-lang="en"><paragraph id="hd_idm35" role="heading" level="6" xml-lang="en">❏ also iterate over TextFrames</paragraph>handles floating textframes / subdocuments.</listitem> <listitem id="item_idm38" xml-lang="en"><paragraph id="hd_idm38" role="heading" level="6" xml-lang="en">❏ super slow mode</paragraph>iterates over paragraph segments, to keep more inline formatting - but seriously harms mid-sentence translations. Not very useful in practice.</listitem> <listitem id="item_idm41" xml-lang="en"><paragraph id="hd_idm41" role="heading" level="6" xml-lang="en">☑ debug mode</paragraph>Will fill up the /tmp/pagetranslate-libreoffice.txt log file quicker.</listitem> </list> </paragraph> </body> </helpdocument> |
Added help/en/vnd.include-once.pagetranslate/mallard2xhp.xsl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | <?xml version="1.0" encoding="UTF-8"?><!-- /** * api: xslt * type: transform * title: mallard to xhp * description: transform help to openoffice xhp * version: 0.2 * * Crude mapping from mallard help file to OpenOffice helpdocument/xhp. * Only handles paragraphs, titles, lists, sections. No media/images. * And info <link>s are just mapped to type=index or bookmark (type=guide) * entries, but type=seealso and href= links in the body kept as is. * No help.tree generation obviously. * */--> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://projectmallard.org/1.0/" exclude-result-prefixes="m"> <!-- cfg --> <xsl:variable name="package" select="'vnd.include-once.pagetranslate'"/> <xsl:variable name="fileref" select="concat('/help/',$package,'/config.xhp')"/><!-- select="base-uri()" --> <xsl:output mode="xml" indent="yes"/> <!-- new document carcass --> <xsl:template match="/m:page"> <helpdocument version="1.0"> <meta> <topic id="topic_{generate-id()}" indexer="include" status="PUBLISH"> <title xml-lang="en" id="title_{generate-id()}"><xsl:value-of select="//m:title"/></title> <filename><xsl:value-of select="$fileref"/></filename> </topic> <history> <!--created date="{current-dateTime()}"></created> <lastedited date="{current-dateTime()}"></lastedited--> <created date="2020-02-02T22:22:22"></created> <lastedited date="2020-02-02T22:22:22"></lastedited> </history> </meta> <body> <xsl:apply-templates/> </body> </helpdocument> </xsl:template> <!-- paragraphs / sections --> <xsl:template match="m:p"> <paragraph id="par_{generate-id()}" role="paragraph" xml-lang="en"> <xsl:value-of select="."/> </paragraph> </xsl:template> <xsl:template match="m:title"> <paragraph id="hd_{generate-id()}" role="heading" level="{count(ancestor::*)}" xml-lang="en"> <xsl:value-of select="."/> </paragraph> </xsl:template> <xsl:template match="m:section|m:note"> <paragraph id="sect_{generate-id()}" role="section" xml-lang="en"> <xsl:apply-templates/> </paragraph> </xsl:template> <!-- lists --> <xsl:template match="m:terms"> <list id="terms_{generate-id()}" xml-lang="en"> <xsl:apply-templates/> </list> </xsl:template> <xsl:template match="m:item"> <listitem id="item_{generate-id()}" xml-lang="en"> <paragraph id="hd_{generate-id()}" role="heading" level="6" xml-lang="en"><xsl:value-of select="m:title"/></paragraph> <xsl:value-of select="m:p"/> </listitem> </xsl:template> <xsl:template match="m:list"> <list bullet="disc" type="ordered"> <xsl:apply-templates/> </list> </xsl:template> <!-- meta --> <xsl:template match="m:link"> <xsl:choose> <!-- meta links --> <xsl:when test="@type='guide'"> <bookmark id="bm_{generate-id()}" branch="hid/{$package}:{@xref}" xml-lang="en"> <bookmark_value><xsl:value-of select="//m:desc"/></bookmark_value> </bookmark> </xsl:when> <xsl:when test="@type='index'"> <bookmark id="helpindex_{generate-id()}" branch="index" xml-lang="en"> <bookmark_value><xsl:value-of select="@xref"/></bookmark_value> </bookmark> </xsl:when> <!-- body links --> <xsl:when test="@type='seealso'"> <link href="{@xref}"><xsl:value-of select="."/></link> </xsl:when> <xsl:when test="@href"> <link href="{@href}"><xsl:value-of select="."/></link> </xsl:when> </xsl:choose> </xsl:template> <xsl:template match="m:info"> <xsl:apply-templates match="m:link"/> </xsl:template> <!-- remove all else --> <xsl:template match="*"> <xsl:comment>xsl:skipped=<xsl:value-of select="concat('<', name(), '>')"/></xsl:comment> </xsl:template> </xsl:stylesheet> |