Target Document Preview

Situation

So, now you’re working on a fancy formatted file and would like to have a preview of what your translation looks like. To do that, you save in OmegaT (Ctrl+S), create translated document (Ctrl+D), and open it in LibreOffice or OpenOffice.org. A bit awkward, and you wish there were a preview button in OmegaT, but oh well, as long as it gets things done, you’ll bare with it.

Problem

But oops, the document was already open, and opening it again doesn’t automatically update the view in Office. Luckily, there is File → Reload functionality now both in LibreOffice and in OpenOffice.org, so you don’t have to close the document and reopen it again.

Solution

  1. You can use “Priorview” preview utility. Neat solution, one of the huge benefits of which is that you can use Abiword — a really lightweight and fast text processor. If you have used Marc’s scripts before then you have Tcl/Tk installed, otherwise you’ll have to take care of that part.
  2. You can use a macro in LibreOffice or OpenOffice.org that would reload the document every n seconds. The text of the macro is here:
    sub ReloadDocument
    dim document   as object
    dim dispatcher as object
    document   = ThisComponent.CurrentController.Frame
    dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
    Do While True
          Wait(15000 * secs)
    dispatcher.executeDispatch(document, ".uno:Reload", "", 0, Array())
    Loop
    end sub
    

    Here it’s set to reload document every 15 seconds. It’s set in line 7 in this example, which is Wait(15000 * secs). Change to whatever value you need (the value must be given in milliseconds).

To add macro you need to press My Macros → Standard → Module1 in the list on the left, and press Edit button. In the Macros Editor window go to the very end of the text, start a new line and insert the above given macro. Save and close.
Now, when you open the target document that you want to preview, you can run this macro, either by assigning a shortcut and/or creating a toolbar button for it (details in LibreOffice/OpenOffice.org help file), or by launching it from menu Tools → Macros → Run Macro and from there navigating to My Macros → Standard → Module1 → ReloadDocument macro and pressing Runstrong> button.
To terminate the macro, press Shift+Ctrl+Q


P.S. When working on a Team project, it might be wise to set the reload value to 3 minutes (180000) or higher.
But as of now,
Good luck!


Update
For now, better stick with “Priorview” preview utility, as with the above macro the document scrolls back to the beginning or last saved position (it depends on the file type and one additional setting in the office suite) on each reload. Once a workaround is found, the solution will be updated.

2 thoughts on “Target Document Preview

  1. I remember that the Folders plugin by Yu Tang implemented a preview mode that worked with MS Word (when clicking on Target Document). Now that the Folders plugin has been superseded by OmegaT’s Access Project Contents, the Current Target Document does not work in preview mode anymore.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s