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

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


Artifact [64b31f7d1f]

Artifact 64b31f7d1fe154fc72b27295a5e02f596e31e42a:

  • File OptionsDialog.xdl — part of check-in [cfa194ff57] at 2022-10-21 04:49:03 on branch trunk — test and fix systran and deepl, jettison deepl pro/api split (now decided on key suffix) (user: mario size: 9601)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="OptionsPageTranslate" dlg:left="110" dlg:top="50" dlg:width="283" dlg:height="258" dlg:help-url="HIDID" dlg:closeable="true" dlg:moveable="true" dlg:title="Title" dlg:withtitlebar="false">
 <dlg:styles>
  <dlg:style dlg:style-id="0" dlg:border="none" dlg:font-height="8"/>
 </dlg:styles>
 <dlg:bulletinboard>
  <dlg:textfield dlg:id="api_key" dlg:tab-index="4" dlg:left="169" dlg:top="20" dlg:width="75" dlg:height="10" dlg:help-text="Key required for DeepL, Microsoft Translator, or Libre, Yandex, QCRI etc." dlg:help-url="HIDID"/>
  <dlg:checkbox dlg:id="quick" dlg:tab-index="0" dlg:left="10" dlg:top="87" dlg:width="111" dlg:height="10" dlg:help-text="Temporary placeholders instead of iterating over newline breaks. (Only tested with Google Translate. Might screw up others.)" dlg:help-url="HIDID" dlg:value="quick paragraph linebreak handling" dlg:checked="false"/>
  <dlg:checkbox dlg:id="frames" dlg:tab-index="1" dlg:left="10" dlg:top="100" dlg:width="100" dlg:height="10" dlg:help-text="Traverse subdocuments (frames / floating frames) as well" dlg:help-url="HIDID" dlg:value="also iterate over TextFrames" dlg:checked="false"/>
  <dlg:checkbox dlg:id="slow" dlg:tab-index="2" dlg:left="10" dlg:top="113" dlg:width="109" dlg:height="10" dlg:help-text="Split sentences on formatting prior translation (= more roundtrips, less cohesive sentence structure / translation)" dlg:help-url="HIDID" dlg:value="slow mode (more inline formatting)" dlg:checked="false"/>
  <dlg:checkbox dlg:id="selectonly" dlg:tab-index="3" dlg:left="10" dlg:top="126" dlg:width="100" dlg:height="10" dlg:help-text="Disable full doc translation (Tradutor mode)" dlg:help-url="HIDID" dlg:value="Select-mode only" dlg:checked="false"/>
  <dlg:checkbox dlg:id="annotate" dlg:tab-index="4" dlg:left="10" dlg:top="139" dlg:width="100" dlg:height="10" dlg:help-text="Preserve untranslated text in comment before each paragraph / text section" dlg:help-url="HIDID" dlg:value="original text annotations" dlg:checked="false"/>
  <dlg:checkbox dlg:id="debug" dlg:tab-index="5" dlg:left="10" dlg:top="152" dlg:width="100" dlg:height="10" dlg:help-text="Log file in /tmp/pagetranslate-libreoffice.txt" dlg:help-url="HIDID" dlg:value="additional debugging" dlg:checked="true"/>
  <!--dlg:linklabel dlg:id="debug_log" dlg:tab-index="75" dlg:left="90" dlg:top="152" dlg:width="70" dlg:height="10" dlg:help-url="file:///web.com/tmp/pagetranslate-libreoffice.log" dlg:value="log file" dlg:url="file:///tmp/pagetranslate-libreoffice.log" dlg:multiline="false"/-->
  <dlg:textfield dlg:id="email" dlg:tab-index="6" dlg:left="169" dlg:top="42" dlg:width="75" dlg:height="10" dlg:help-text="MyMemory asks for an email addres (does not require it)" dlg:help-url="HIDID"/>
  <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="6" dlg:left="5" dlg:top="75" dlg:width="117" dlg:height="9" dlg:value="Options"/>
  <dlg:fixedline dlg:id="FixedLine3" dlg:tab-index="7" dlg:left="5" dlg:top="5" dlg:width="117" dlg:height="7" dlg:value="Service"/>
  <dlg:fixedline dlg:id="FixedLine2" dlg:tab-index="8" dlg:left="131" dlg:top="5" dlg:width="115" dlg:height="8" dlg:value="Parameters"/>
  <dlg:fixedline dlg:id="Label1" dlg:tab-index="9" dlg:left="137" dlg:top="20" dlg:width="23" dlg:height="8" dlg:value="API key "/>
  <dlg:fixedline dlg:id="Label2" dlg:tab-index="10" dlg:left="137" dlg:top="42" dlg:width="28" dlg:height="8" dlg:printable="false" dlg:value="Email adr "/>
  <dlg:fixedline dlg:id="Label3" dlg:tab-index="11" dlg:left="137" dlg:top="64" dlg:width="30" dlg:height="8" dlg:value="Command "/>
  <dlg:menulist dlg:id="backend" dlg:tab-index="12" dlg:left="10" dlg:top="20" dlg:width="105" dlg:height="14" dlg:help-text="Which translation service to use. Some might require an API key, or email address. Google Ajax, DuckDuckGo, PONS Web, or Argos Translate are recommended defaults. For sensitive documents, DeepL, SysTran, or a Microsoft subscription might be more suitable." dlg:spin="true" dlg:linecount="20">
   <dlg:menupopup>
    <dlg:menuitem dlg:value="Google Translate"/>
    <dlg:menuitem dlg:value="GoogleApis Ajax Translate"/>
    <dlg:menuitem dlg:value="MyMemory"/>
    <dlg:menuitem dlg:value="PONS Text Translation"/>
    <dlg:menuitem dlg:value="DuckDuckGo"/>
    <dlg:menuitem dlg:value="command line tool"/>
    <dlg:menuitem dlg:value="ArgosTranslate (OpenNMT)"/>
    <dlg:menuitem dlg:value="LibreTranslate"/>
    <dlg:menuitem dlg:value="LibreLocal http://localhost:5000/translate"/>
    <dlg:menuitem dlg:value="DeepL web interface"/>
    <dlg:menuitem dlg:value="DeepL Pro/Free API"/>
    <dlg:menuitem dlg:value="SYSTRAN translate Pro API"/>
    <dlg:menuitem dlg:value="DT: QCRI Machine Translation"/>
    <dlg:menuitem dlg:value="DT: Yandex Translation"/>
    <dlg:menuitem dlg:value="DT: Papago Web Translator"/>
    <dlg:menuitem dlg:value="DT: Pons Dictionary"/>
    <dlg:menuitem dlg:value="DT: Linguee Dictionary"/>
    <dlg:menuitem dlg:value="DT: Microsoft Translator"/>
    <dlg:menuitem dlg:value="DT: DeepL Free API"/>
    <dlg:menuitem dlg:value="DT: Google Translate"/>
    <dlg:menuitem dlg:value="DT: LibreTranslator"/>
    <dlg:menuitem dlg:value="DeepTransApi: Libre"/>
    <dlg:menuitem dlg:value="Google Cloud API"/>
   </dlg:menupopup>
  </dlg:menulist>
  <dlg:fixedline dlg:style-id="0" dlg:id="Label4" dlg:tab-index="13" dlg:left="170" dlg:top="32" dlg:width="65" dlg:height="6" dlg:value="for DeepL / Microsoft / QCRI       "/>
  <dlg:fixedline dlg:style-id="0" dlg:id="Label5" dlg:tab-index="14" dlg:left="170" dlg:top="54" dlg:width="32" dlg:height="6" dlg:value="for MyMemory  "/>
  <dlg:fixedline dlg:style-id="0" dlg:id="Label6" dlg:tab-index="15" dlg:left="170" dlg:top="77" dlg:width="50" dlg:height="6" dlg:value="CLI program + arguments"/>
  <dlg:fixedline dlg:style-id="0" dlg:id="Label7" dlg:tab-index="16" dlg:left="13" dlg:top="38" dlg:width="104" dlg:height="7" dlg:help-url="vnd.sun.star.help://help/vnd.include-once.pagetranslate/config.xhp?Language=en&amp;System=UNIX&amp;UseDB=no" dlg:value="See help pages on how the translation services             &#x0a;"/>
  <dlg:fixedline dlg:style-id="0" dlg:id="FixedLine4" dlg:tab-index="17" dlg:left="13" dlg:top="45" dlg:width="104" dlg:height="7" dlg:help-url="vnd.sun.star.help://help/vnd.include-once.pagetranslate/config.xhp?Language=en&amp;System=UNIX&amp;UseDB=no" dlg:value="differ in behaviour and which options may apply.         "/>
  <dlg:fixedline dlg:style-id="0" dlg:id="FixedLine5" dlg:tab-index="18" dlg:left="13" dlg:top="52" dlg:width="104" dlg:height="7" dlg:help-url="vnd.sun.star.help://help/vnd.include-once.pagetranslate/config.xhp?Language=en&amp;System=UNIX&amp;UseDB=no" dlg:value="Some do require an additional Python extension.               &#x0a;"/>
  <dlg:fixedline dlg:id="FixedLine7" dlg:tab-index="19" dlg:left="131" dlg:top="98" dlg:width="115" dlg:height="8" dlg:value="🏴  Button "/>
  <dlg:combobox dlg:id="flag" dlg:tab-index="20" dlg:left="170" dlg:top="111" dlg:width="60" dlg:height="10" dlg:help-text="Can be any XY langauge code,  or &quot;locale&quot; for System/Office lang,  &quot;paragraph&quot; to honor the language toolbar,  or &quot;select&quot; to bring up the From→To dialog" dlg:value="locale" dlg:spin="true">
   <dlg:menupopup>
    <dlg:menuitem dlg:value="locale"/>
    <dlg:menuitem dlg:value="select"/>
    <dlg:menuitem dlg:value="paragraph"/>
    <dlg:menuitem dlg:value="en"/>
   </dlg:menupopup>
  </dlg:combobox>
  <dlg:fixedline dlg:id="FixedLine8" dlg:tab-index="21" dlg:left="137" dlg:top="112" dlg:width="27" dlg:height="8" dlg:help-text="Which language the 🏴 button defaults to" dlg:value="Language"/>
  <dlg:combobox dlg:id="cmd" dlg:tab-index="22" dlg:left="169" dlg:top="63" dlg:width="77" dlg:height="10" dlg:help-text="Command line program to pipe text snippets through. Can use placeholders like {text}, or {lang} and {form}. Alternatively with shell $text or %lang% syntax." dlg:value="translate-cli -o -f auto -t {lang} {text}" dlg:spin="true">
   <dlg:menupopup>
    <dlg:menuitem dlg:value="translate-cli -o -f auto -t {lang} {text}"/>
    <dlg:menuitem dlg:value="deep_translator -trans &quot;google&quot; -src &quot;auto&quot; -tg {lang} -txt {text}"/>
    <dlg:menuitem dlg:value="argos-translate --from-lang {from} --to-lang {lang} {text}"/>
    <dlg:menuitem dlg:value="trans -sl {from} {text} {lang}"/>
    <dlg:menuitem dlg:value="dingonyms --en-fr {text}"/>
   </dlg:menupopup>
  </dlg:combobox>
  <dlg:img dlg:style-id="0" dlg:id="logo" dlg:tab-index="23" dlg:left="200" dlg:top="135" dlg:width="40" dlg:height="40" dlg:src="vnd.sun.star.extension://vnd.include-once.pagetranslate/icons/flags.png"/>
  <dlg:button dlg:id="cfg_argos" dlg:tab-index="24" dlg:left="10" dlg:top="170" dlg:width="45" dlg:height="12" dlg:value="config argos" dlg:help-text="Run ArgosTranslate config GUI" dlg:help-url="HIDID"/>
  <dlg:button dlg:id="cfg_deps" dlg:tab-index="25" dlg:left="60" dlg:top="170" dlg:width="45" dlg:height="12" dlg:value="setup deps" dlg:help-text="Install or update python dependencies (requests, translate, deep-translator, argos-translate)" dlg:help-url="HIDID"/>
  <dlg:button dlg:id="cfg_log" dlg:tab-index="26" dlg:left="110" dlg:top="170" dlg:width="20" dlg:height="12" dlg:value="log" dlg:help-text="Open log file" dlg:help-url="HIDID"/>
 </dlg:bulletinboard>
</dlg:window>