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

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


Check-in [148f8a2956]

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

Overview
Comment:note new option and potential exception
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 148f8a295665a7eff29143e424c5405ae5c22bf9
User & Date: mario 2022-10-13 08:59:56
Context
2022-10-13
11:14
get eventListener buttons in options page working check-in: 5bf569cb63 user: mario tags: trunk
08:59
note new option and potential exception check-in: 148f8a2956 user: mario tags: trunk
08:35
doc --setup flag check-in: ca7d968d49 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to help/en/vnd.include-once.pagetranslate/config.page.

218
219
220
221
222
223
224






225
226
227
228
229
230
231
      And currently the formatting still bleeds into adjoining paragraph segments, so not very useful in practice yet.</p>
    </item>
    <item>
      <title>❏ selection-only mode</title>
      <p>Disables the whole document translation mode. This turns PageTranslate into the original Tradutor plugin,
      which might be useful to prevent long waiting times for big documents when only a partial translation was wanted.
      Will simply trigger a warning if no paragraph selection is active.</p>






    </item>
    <item>
      <title>β˜‘ debug mode</title>
      <p>Will fill up the <file>/tmp/pagetranslate-libreoffice.txt</file> log file quicker.
      Currently the debug mode is enabled by default anyway.</p>
    </item>
  </terms>







>
>
>
>
>
>







218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
      And currently the formatting still bleeds into adjoining paragraph segments, so not very useful in practice yet.</p>
    </item>
    <item>
      <title>❏ selection-only mode</title>
      <p>Disables the whole document translation mode. This turns PageTranslate into the original Tradutor plugin,
      which might be useful to prevent long waiting times for big documents when only a partial translation was wanted.
      Will simply trigger a warning if no paragraph selection is active.</p>
    </item>
    <item>
      <title>❏ original text annotations</title>
      <p>This option will inject lots of comments for translated text sections. It'll usually be present per paragraph,
      or table cell; but may intersperse comment markers for long lines (1900 characters, if API breakup requires it).
      </p>
    </item>
    <item>
      <title>β˜‘ debug mode</title>
      <p>Will fill up the <file>/tmp/pagetranslate-libreoffice.txt</file> log file quicker.
      Currently the debug mode is enabled by default anyway.</p>
    </item>
  </terms>

Changes to 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
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
   <meta>
      <topic id="topic_d1e3" indexer="include" status="PUBLISH">
         <title xml-lang="en" id="title_d1e3">Translation settings</title>
         <filename>/help/vnd.include-once.pagetranslate/config.xhp</filename>
      </topic>
      <history>
         <created date="2020-02-02T22:22:22"/>
         <lastedited date="2021-12-30T03:18:08.194+01:00"/>
      </history>
   </meta>
   <body>

      <bookmark id="bm_d1e7" branch="hid/vnd.include-once.pagetranslate:OptionsPageTranslate"
                xml-lang="en">
         <bookmark_value>PageTranslate settings</bookmark_value>









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
   <meta>
      <topic id="topic_d1e3" indexer="include" status="PUBLISH">
         <title xml-lang="en" id="title_d1e3">Translation settings</title>
         <filename>/help/vnd.include-once.pagetranslate/config.xhp</filename>
      </topic>
      <history>
         <created date="2020-02-02T22:22:22"/>
         <lastedited date="2022-10-13T10:52:07.293+02:00"/>
      </history>
   </meta>
   <body>

      <bookmark id="bm_d1e7" branch="hid/vnd.include-once.pagetranslate:OptionsPageTranslate"
                xml-lang="en">
         <bookmark_value>PageTranslate settings</bookmark_value>
253
254
255
256
257
258
259







260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
               <emph>❏ selection-only mode</emph>
               <br/>
               <paragraph id="par_d1e367" role="paragraph" xml-lang="en">Disables the whole document translation mode. This turns PageTranslate into the original Tradutor plugin,
      which might be useful to prevent long waiting times for big documents when only a partial translation was wanted.
      Will simply trigger a warning if no paragraph selection is active.</paragraph>
            </listitem>
            <listitem id="item_d1e371" xml-lang="en">







               <emph>β˜‘ debug mode</emph>
               <br/>
               <paragraph id="par_d1e376" role="paragraph" xml-lang="en">Will fill up the <item type="fileitem">/tmp/pagetranslate-libreoffice.txt</item> log file quicker.
      Currently the debug mode is enabled by default anyway.</paragraph>
            </listitem>
         </list>
      </paragraph>

      <paragraph id="sect_d1e385" role="section" xml-lang="en">
         <paragraph id="hd_d1e387" role="heading" level="2" xml-lang="en">🏴 button default behaviour/target language</paragraph>
         <list id="terms_d1e390" xml-lang="en">
            <listitem id="item_d1e392" xml-lang="en">
               <emph>locale</emph>
               <br/>
               <paragraph id="par_d1e397" role="paragraph" xml-lang="en"> Per default uses the Office/system language as target. </paragraph>
            </listitem>
            <listitem id="item_d1e401" xml-lang="en">
               <emph>paragraph</emph>
               <br/>
               <paragraph id="par_d1e406" role="paragraph" xml-lang="en"> Uses the "paragraph" locale as set in the Writer/language status bar. </paragraph>
            </listitem>
            <listitem id="item_d1e410" xml-lang="en">
               <emph>select</emph>
               <br/>
               <paragraph id="par_d1e415" role="paragraph" xml-lang="en"> Always brings up the explicit Fromβ†’ToπŸ—Ί  language selection popup (useful for MyMemory or Pons backends).</paragraph>
            </listitem>
            <listitem id="item_d1e419" xml-lang="en">
               <emph>en, de, it, fr, ...</emph>
               <br/>
               <paragraph id="par_d1e424" role="paragraph" xml-lang="en"> You can set this field to any two-letter language code - to be used as default target. </paragraph>
            </listitem>
            <listitem id="item_d1e428" xml-lang="en">
               <emph>mri-debug</emph>
               <br/>
               <paragraph id="par_d1e433" role="paragraph" xml-lang="en"> Requires the MRI extension, and brings up an introspection dialog on the document when invoked. </paragraph>
            </listitem>
         </list>
      </paragraph>

   </body>
</helpdocument>







>
>
>
>
>
>
>


|





|
|
|
|


|

|


|

|


|

|


|

|


|






253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
               <emph>❏ selection-only mode</emph>
               <br/>
               <paragraph id="par_d1e367" role="paragraph" xml-lang="en">Disables the whole document translation mode. This turns PageTranslate into the original Tradutor plugin,
      which might be useful to prevent long waiting times for big documents when only a partial translation was wanted.
      Will simply trigger a warning if no paragraph selection is active.</paragraph>
            </listitem>
            <listitem id="item_d1e371" xml-lang="en">
               <emph>❏ original text annotations</emph>
               <br/>
               <paragraph id="par_d1e376" role="paragraph" xml-lang="en">This option will inject lots of comments for translated text sections. It'll usually be present per paragraph,
      or table cell; but may intersperse comment markers for long lines (1900 characters, if API breakup requires it).
      </paragraph>
            </listitem>
            <listitem id="item_d1e381" xml-lang="en">
               <emph>β˜‘ debug mode</emph>
               <br/>
               <paragraph id="par_d1e386" role="paragraph" xml-lang="en">Will fill up the <item type="fileitem">/tmp/pagetranslate-libreoffice.txt</item> log file quicker.
      Currently the debug mode is enabled by default anyway.</paragraph>
            </listitem>
         </list>
      </paragraph>

      <paragraph id="sect_d1e395" role="section" xml-lang="en">
         <paragraph id="hd_d1e397" role="heading" level="2" xml-lang="en">🏴 button default behaviour/target language</paragraph>
         <list id="terms_d1e400" xml-lang="en">
            <listitem id="item_d1e402" xml-lang="en">
               <emph>locale</emph>
               <br/>
               <paragraph id="par_d1e407" role="paragraph" xml-lang="en"> Per default uses the Office/system language as target. </paragraph>
            </listitem>
            <listitem id="item_d1e411" xml-lang="en">
               <emph>paragraph</emph>
               <br/>
               <paragraph id="par_d1e416" role="paragraph" xml-lang="en"> Uses the "paragraph" locale as set in the Writer/language status bar. </paragraph>
            </listitem>
            <listitem id="item_d1e420" xml-lang="en">
               <emph>select</emph>
               <br/>
               <paragraph id="par_d1e425" role="paragraph" xml-lang="en"> Always brings up the explicit Fromβ†’ToπŸ—Ί  language selection popup (useful for MyMemory or Pons backends).</paragraph>
            </listitem>
            <listitem id="item_d1e429" xml-lang="en">
               <emph>en, de, it, fr, ...</emph>
               <br/>
               <paragraph id="par_d1e434" role="paragraph" xml-lang="en"> You can set this field to any two-letter language code - to be used as default target. </paragraph>
            </listitem>
            <listitem id="item_d1e438" xml-lang="en">
               <emph>mri-debug</emph>
               <br/>
               <paragraph id="par_d1e443" role="paragraph" xml-lang="en"> Requires the MRI extension, and brings up an introspection dialog on the document when invoked. </paragraph>
            </listitem>
         </list>
      </paragraph>

   </body>
</helpdocument>

Changes to help/en/vnd.include-once.pagetranslate/errors.duck.

113
114
115
116
117
118
119







120
121
122
123
124
125
126
== IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! / Original error was: No module named 'numpy.core._multiarray_umath'

This is a problem of the OpenNMT backend. It can't be used with the
LibreOffice-bundled Python. It's not compatible with the numpy binary
extension. This backend only works with a distro-supplied Office, which
ties to the system-installed Python. // Alternatively use the CLI tool
with "command line tool" as backend.








== How to report a bug

[--
@link[seealso >>https://fossil.include-once.org/pagetranslate/] repository
--]
The project repository https://fossil.include-once.org/pagetranslate/







>
>
>
>
>
>
>







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
== IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! / Original error was: No module named 'numpy.core._multiarray_umath'

This is a problem of the OpenNMT backend. It can't be used with the
LibreOffice-bundled Python. It's not compatible with the numpy binary
extension. This backend only works with a distro-supplied Office, which
ties to the system-installed Python. // Alternatively use the CLI tool
with "command line tool" as backend.

== CannotConvertException: value does not implement com.sun.star.text.XTextContent

That error came up for the annotation/comment option (preserving
untranslated text). Should not occur with the current implementation.
But if, it might be a symptom of complex documents. And disabling
the annotate option might suffice to get rid of it.

== How to report a bug

[--
@link[seealso >>https://fossil.include-once.org/pagetranslate/] repository
--]
The project repository https://fossil.include-once.org/pagetranslate/

Changes to help/en/vnd.include-once.pagetranslate/errors.xhp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
   <meta>
      <topic id="topic_d1e1" indexer="include" status="PUBLISH">
         <title xml-lang="en" id="title_d1e1">Errors</title>
         <filename>/help/vnd.include-once.pagetranslate/errors.xhp</filename>
      </topic>
      <history>
         <created date="2020-02-02T22:22:22"/>
         <lastedited date="2021-12-30T03:18:09.451+01:00"/>
      </history>
   </meta>
   <body>
      <link href="vnd.include-once.pagetranslate/index.xhp"/>
      <paragraph id="hd_d1e8" role="heading" level="1" xml-lang="en">Errors</paragraph>
      <paragraph id="par_d1e11" role="paragraph" xml-lang="en">Error messages will largely show up as long-winded popups with Python
 exceptions. Where the text usually starts with "Traceback" and then









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
   <meta>
      <topic id="topic_d1e1" indexer="include" status="PUBLISH">
         <title xml-lang="en" id="title_d1e1">Errors</title>
         <filename>/help/vnd.include-once.pagetranslate/errors.xhp</filename>
      </topic>
      <history>
         <created date="2020-02-02T22:22:22"/>
         <lastedited date="2022-10-13T10:58:38.264+02:00"/>
      </history>
   </meta>
   <body>
      <link href="vnd.include-once.pagetranslate/index.xhp"/>
      <paragraph id="hd_d1e8" role="heading" level="1" xml-lang="en">Errors</paragraph>
      <paragraph id="par_d1e11" role="paragraph" xml-lang="en">Error messages will largely show up as long-winded popups with Python
 exceptions. Where the text usually starts with "Traceback" and then
120
121
122
123
124
125
126
127







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
         <paragraph id="par_d1e172" role="paragraph" xml-lang="en">This is a problem of the OpenNMT backend. It can't be used with the
  LibreOffice-bundled Python. It's not compatible with the numpy binary
  extension. This backend only works with a distro-supplied Office, which
  ties to the system-installed Python. // Alternatively use the CLI tool
  with "command line tool" as backend.</paragraph>
      </paragraph>
      <paragraph id="sect_d1e176" role="section" xml-lang="en">
         <paragraph id="hd_d1e178" role="heading" level="2" xml-lang="en">How to report a bug</paragraph>







         <paragraph id="par_d1e181" role="paragraph" xml-lang="en">The project repository https://fossil.include-once.org/pagetranslate/
  allows to file a bug report (no registration necessary).</paragraph>
         <list id="list_d1e184" xml-lang="en">
            <listitem id="item_d1e186" xml-lang="en">
               <paragraph id="par_d1e188" role="paragraph" xml-lang="en">The log file MUST be included,</paragraph>
            </listitem>
            <listitem id="item_d1e192" xml-lang="en">
               <paragraph id="par_d1e194" role="paragraph" xml-lang="en">together with a sample document (as link),</paragraph>
            </listitem>
            <listitem id="item_d1e198" xml-lang="en">
               <paragraph id="par_d1e200" role="paragraph" xml-lang="en">as well as the OpenOffice version (Help β†’ About β†’ Copy)</paragraph>
            </listitem>
            <listitem id="item_d1e204" xml-lang="en">
               <paragraph id="par_d1e206" role="paragraph" xml-lang="en">latest or development version has been tested.</paragraph>
            </listitem>
         </list>
         <paragraph id="par_d1e211" role="paragraph" xml-lang="en">Insufficient submissions are unlikely to spark developer interest.</paragraph>
      </paragraph>
   </body>
</helpdocument>







|
>
>
>
>
>
>
>
|

|
|
|

|
|

|
|

|
|


|



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
         <paragraph id="par_d1e172" role="paragraph" xml-lang="en">This is a problem of the OpenNMT backend. It can't be used with the
  LibreOffice-bundled Python. It's not compatible with the numpy binary
  extension. This backend only works with a distro-supplied Office, which
  ties to the system-installed Python. // Alternatively use the CLI tool
  with "command line tool" as backend.</paragraph>
      </paragraph>
      <paragraph id="sect_d1e176" role="section" xml-lang="en">
         <paragraph id="hd_d1e178" role="heading" level="2" xml-lang="en">CannotConvertException: value does not implement com.sun.star.text.XTextContent</paragraph>
         <paragraph id="par_d1e181" role="paragraph" xml-lang="en">That error came up for the annotation/comment option (preserving
  untranslated text). Should not occur with the current implementation.
  But if, it might be a symptom of complex documents. And disabling
  the annotate option might suffice to get rid of it.</paragraph>
      </paragraph>
      <paragraph id="sect_d1e185" role="section" xml-lang="en">
         <paragraph id="hd_d1e187" role="heading" level="2" xml-lang="en">How to report a bug</paragraph>
         <paragraph id="par_d1e190" role="paragraph" xml-lang="en">The project repository https://fossil.include-once.org/pagetranslate/
  allows to file a bug report (no registration necessary).</paragraph>
         <list id="list_d1e193" xml-lang="en">
            <listitem id="item_d1e195" xml-lang="en">
               <paragraph id="par_d1e197" role="paragraph" xml-lang="en">The log file MUST be included,</paragraph>
            </listitem>
            <listitem id="item_d1e201" xml-lang="en">
               <paragraph id="par_d1e203" role="paragraph" xml-lang="en">together with a sample document (as link),</paragraph>
            </listitem>
            <listitem id="item_d1e207" xml-lang="en">
               <paragraph id="par_d1e209" role="paragraph" xml-lang="en">as well as the OpenOffice version (Help β†’ About β†’ Copy)</paragraph>
            </listitem>
            <listitem id="item_d1e213" xml-lang="en">
               <paragraph id="par_d1e215" role="paragraph" xml-lang="en">latest or development version has been tested.</paragraph>
            </listitem>
         </list>
         <paragraph id="par_d1e220" role="paragraph" xml-lang="en">Insufficient submissions are unlikely to spark developer interest.</paragraph>
      </paragraph>
   </body>
</helpdocument>