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

⌈⌋ ⎇ branch:  PageTranslate


Check-in [99cd577149]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add dialog option for python-translate (deepl_web might be too difficult after all). Add schema.xcs in manifest.xml (So, that's why it never took effect! *surprised_pikachu_face*)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 99cd57714948d6a9b1411bb12faa2cd1390b544f
User & Date: mario 2020-05-24 08:48:48
Context
2020-05-24
08:51
Extract via_* classes into pythonpath/translationbackends. As well as requests/http/urllib-fallback code into separate module. Apply new nodepath for ConfigurationUpdateAccess (but keep using .json config file for now). check-in: 9287fd7b5e user: mario tags: trunk, 1.2
08:48
Add dialog option for python-translate (deepl_web might be too difficult after all). Add schema.xcs in manifest.xml (So, that's why it never took effect! *surprised_pikachu_face*) check-in: 99cd577149 user: mario tags: trunk
08:46
v1.1 check-in: 985ee95169 user: mario tags: trunk, 1.1
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to META-INF/manifest.xml.

1
2
3
4
5

6
7
8
<?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.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
<?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>

Changes to OptionsDialog.xdl.

1
2
3
4

5
6
7
8
9
10
11
12
13
14

15
16
17
<?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="220" dlg:height="150" dlg:closeable="true" dlg:moveable="true" dlg:title="Title" dlg:withtitlebar="false">
 <dlg:bulletinboard>

  <dlg:titledbox dlg:id="FrameBox1" dlg:tab-index="0" dlg:left="25" dlg:top="55" dlg:width="145" dlg:height="32" dlg:help-text="requires an API key / else will use *SLOWER* web page requests">
   <dlg:title dlg:value="API key"/>
   <dlg:textfield dlg:id="api_key" dlg:tab-index="1" dlg:left="5" dlg:top="11" dlg:width="135" dlg:height="12" dlg:help-text="Key required for faster translation service"/>
  </dlg:titledbox>
  <dlg:checkbox dlg:id="debug" dlg:tab-index="2" dlg:left="10" dlg:top="110" dlg:width="160" dlg:height="12" dlg:help-text="Log file in /tmp/pagetranslate-libreoffice.txt" dlg:value="additonal debugging" dlg:checked="true"/>
  <dlg:checkbox dlg:id="quick" dlg:tab-index="3" dlg:left="10" dlg:top="95" dlg:width="160" dlg:height="12" dlg:help-text="Temporary placeholders instead of iterating over newline breaks" dlg:value="quick paragraph linebreak handling" dlg:checked="false"/>
  <dlg:radiogroup>
   <dlg:radio dlg:id="google" dlg:tab-index="4" dlg:left="10" dlg:top="10" dlg:width="160" dlg:height="12" dlg:value="use Google Translate web service (standard)" dlg:group-name="backend" dlg:checked="true"/>
   <dlg:radio dlg:id="deepl_web" dlg:tab-index="5" dlg:left="10" dlg:top="26" dlg:width="160" dlg:height="12" dlg:value="use DeepL web interface (slower?)" dlg:group-name="backend"/>
   <dlg:radio dlg:id="deepl_api" dlg:tab-index="6" dlg:left="10" dlg:top="40" dlg:width="160" dlg:height="12" dlg:value="use DeepL translation API (faster/better formatting?)" dlg:group-name="backend"/>

  </dlg:radiogroup>
 </dlg:bulletinboard>
</dlg:window>


|

>
|

<

|
|

|
|
|
>



1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
<?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="190" dlg:height="150" dlg:closeable="true" dlg:moveable="true" dlg:title="Title" dlg:withtitlebar="false">
 <dlg:bulletinboard>
  <dlg:textfield dlg:id="api_key" dlg:tab-index="4" dlg:disabled="true" dlg:left="35" dlg:top="63" dlg:width="125" dlg:height="12" dlg:help-text="Key required for faster translation service"/>
  <dlg:titledbox dlg:id="FrameControl1" dlg:tab-index="3" dlg:disabled="true" dlg:left="25" dlg:top="55" dlg:width="145" dlg:height="25" dlg:help-text="requires an API key / else will use *SLOWER* web page requests">
   <dlg:title dlg:value="API key"/>

  </dlg:titledbox>
  <dlg:checkbox dlg:id="debug" dlg:tab-index="6" dlg:left="10" dlg:top="125" dlg:width="160" dlg:height="12" dlg:help-text="Log file in /tmp/pagetranslate-libreoffice.txt" dlg:value="additonal debugging" dlg:checked="true"/>
  <dlg:checkbox dlg:id="quick" dlg:tab-index="7" dlg:left="10" dlg:top="110" dlg:width="160" dlg:height="12" dlg:help-text="Temporary placeholders instead of iterating over newline breaks" dlg:value="quick paragraph linebreak handling" dlg:checked="false"/>
  <dlg:radiogroup>
   <dlg:radio dlg:id="google" dlg:tab-index="0" dlg:left="10" dlg:top="10" dlg:width="160" dlg:height="12" dlg:value="use Google Translate web service (standard)" dlg:group-name="backend" dlg:checked="true"/>
   <dlg:radio dlg:id="deepl_web" dlg:tab-index="1" dlg:left="10" dlg:top="25" dlg:width="160" dlg:height="12" dlg:value="use DeepL web interface (slower?)" dlg:group-name="backend"/>
   <dlg:radio dlg:id="deepl_api" dlg:tab-index="2" dlg:disabled="true" dlg:left="10" dlg:top="40" dlg:width="160" dlg:height="12" dlg:value="use DeepL translation API (faster/better formatting?)" dlg:group-name="backend"/>
   <dlg:radio dlg:id="translate_python" dlg:tab-index="5" dlg:left="10" dlg:top="85" dlg:width="160" dlg:height="12" dlg:value="translate-python (system install)" dlg:group-name="backend" dlg:checked="false"/>
  </dlg:radiogroup>
 </dlg:bulletinboard>
</dlg:window>

Changes to OptionsSchema.xcs.

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
<?xml version="1.0" encoding="UTF-8"?>
<!-- oor:name must be identical to the filename of this xcs file //-->
<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  oor:name="PageTranslateOptionsSchema"
  oor:package="org.openoffice" xml:lang="en-US">
  
  <!-- struct for config nodes `/vnd.include-once.pagetranslate.OptionsSchema/Leaves` ?? -->
  
  <info>
    <author></author>
    <desc>Contains the options data used for the test extensions.</desc>
  </info>
  <templates>
    <group oor:name="Leaf">
      <info>
        <desc>The data for one leaf.</desc>
      </info>
      <prop oor:name="String0" oor:type="xs:string">
        <value></value>
      </prop>
      <prop oor:name="String1" oor:type="xs:string">
        <value></value>
      </prop>
      <prop oor:name="String2" oor:type="xs:string">
        <value></value>
      </prop>
      <prop oor:name="String3" oor:type="xs:string">
        <value></value>
      </prop>
      <prop oor:name="String4" oor:type="xs:string">
        <value></value>
      </prop>
    </group>
  </templates>
  <component>
    <group oor:name="Leaves">
      <group oor:name="PageTranslateOptionsSchema" oor:type="Leaf">
        <prop oor:name="google" oor:type="xs:short"><value>1</value></prop>
        <prop oor:name="deepl_web" oor:type="xs:short"><value>0</value></prop>
        <prop oor:name="deepl_api" oor:type="xs:short"><value>0</value></prop>
        <prop oor:name="api_key" oor:type="oor:string"><value></value></prop>


        <prop oor:name="debug" oor:type="oor:string"><value>0</value></prop>
      </group>
    </group>
  </component>
</oor:component-schema>





|
|

|







<
|
<
|
<
<
|
<
<
|
<
<
|
<
<
|
|
|




|



|
>
>
|




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
<?xml version="1.0" encoding="UTF-8"?>
<!-- oor:name must be identical to the filename of this xcs file //-->
<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  oor:name="OptionsSchema"
  oor:package="vnd.include-once.pagetranslate" xml:lang="en-US">
  
  <!-- struct for config nodes `/vnd.include-once.pagetranslate.OptionsSchema/Leaves/Settings` -->
  
  <info>
    <author></author>
    <desc>Contains the options data used for the test extensions.</desc>
  </info>
  <templates>
    <group oor:name="Leaf">

      <info><desc>The data for one leaf.</desc></info>

      <prop oor:name="String0" oor:type="xs:string"><value></value></prop>


      <prop oor:name="String1" oor:type="xs:string"><value></value></prop>


      <prop oor:name="String2" oor:type="xs:string"><value></value></prop>


      <prop oor:name="String3" oor:type="xs:string"><value></value></prop>


      <prop oor:name="String4" oor:type="xs:string"><value></value></prop>
      <prop oor:name="String5" oor:type="xs:string"><value></value></prop>
      <prop oor:name="String6" oor:type="xs:string"><value></value></prop>
    </group>
  </templates>
  <component>
    <group oor:name="Leaves">
      <group oor:name="Settings" oor:type="Leaf">
        <prop oor:name="google" oor:type="xs:short"><value>1</value></prop>
        <prop oor:name="deepl_web" oor:type="xs:short"><value>0</value></prop>
        <prop oor:name="deepl_api" oor:type="xs:short"><value>0</value></prop>
        <prop oor:name="api_key" oor:type="xs:string"><value></value></prop>
        <prop oor:name="translate_python" oor:type="xs:short"><value>0</value></prop>
        <prop oor:name="quick" oor:type="xs:short"><value>0</value></prop>
        <prop oor:name="debug" oor:type="xs:short"><value>1</value></prop>
      </group>
    </group>
  </component>
</oor:component-schema>