Command line options for OmegaT on macOS

If you need to run OmegaT on macOS with a set of custom options, it’s possible to do so by running
java -jar --your_options /Applications/OmegaT.app/Contents/MacOS/Java/OmegaT.jar
in Terminal. This is all great, but if your project is located in a folder that macOS considers restricted and asks you for permissions, such permissions will be granted to Java, not to OmegaT. It means that other Java programs will have those permissions too, even if you didn’t intend it to be so.

You can also add those options by editing the Configuration.properties (OmegaT configuration) as well as the Info.plist (Java configuration) files located inside the OmegaT.app package. But it means that OmegaT will run with them each time you start it, which might not be what you wanted (for instance, if you add a custom config folder or start OmegaT with --no-team option, you probably don’t want it be the new default).

A much better way is to start it using open:
open /Applications/OmegaT.app -n --args --your_options

If you have OmegaT.app located elsewhere, just change the path. -n means that it will start a new instance, so you may have more than one projects open at a time. Anything that comes after --args will be interpreted as arguments (options) passed to OmegaT.

Merge and split segments in OmegaT (update)

OmegaT script for merging and splitting segments has gotten a few improvements:

  • It can show the text to be split or merged with or without tags
  • If tags are to be shown, they can be formatted with a different font color and size to make the actual text more readable
  • If a split is attempted while text cursor is inside a tag, the script won’t add a rule and will inform the user about it
  • The preview of the split or merge to be performed now has horizontal borders to make it easier to see the possible result

So, these are the options that can be configured by the user:

enforceProjectSRX   = true   //if true, the script will make sure project-specific segmentation is enabled
separateMappingRule = true   //if true, the script will add a separate group for its rules
showTags            = true   //if false, tags won't be shown in the confirmation message
paintTags           = true   //if true, tags will be shown in different font size and color
tagColor            = "gray" //tag color
tagSize             = 1      //tag size

Comments in those lines should make it pretty clear what option does what. To change an option, go to Tools → Scripting…, then in the list of scripts, select Merge or split segments. In the text area on the right part of the screen, scroll down a bit (to about line 30), find the option you want to change, edit it, press Ctrl+S to save, and run the script.

The script is available on GitHub and FS.net

If you need more info about installing and using OmegaT scripts, see this quick guide.

If you find this script useful, leave a comment.

There’s also a very easy way to say thank you.
Your support will make more scripts like this possible.

Happy merging and splitting!

Scripts in OmegaT (quick guide)

A quick and easy intro to OmegaT scripts:

  1. OmegaT comes bundled with several scripts. Some of them are of little practical use as they are included as examples for users willing to write their own scripts.
  2. The bundled scripts are located in scripts subfolder of the folder where OmegaT is installed. Often the installation is done in a location where a regular user doesn’t have write permissions, which means adding and removing scripts can be complicated.
  3. Luckily, OmegaT permits setting an arbitrary location for scripts. Do that! It can be any location where you can write to. It doesn’t matter if it contains no scripts at the moment: you can add only the ones you need, and only as you need them.
    It makes sense to place the scripts folder into the OmegaT config folder (the folder where OmegaT stores its settings) just for convenience.

    But it can, of course, be any other folder.
  4. Copy the scripts you need to the folder that was set for scripts.
    If you’re downloading from GitHub, you might need to show the desired script in raw format, and then save the page. If it saves as filename.groovy.txt, just remove the .txt part. If the file got saved in your Downloads folder, just move it into the folder set for your scripts.
  5. In OmegaT, open Tools → Scripting, in the newly open Scripting window select the script you need (left part of the window) and hit Run (lower left corner).
  6. If you need to run a script quite often, there is a way to assign shortcuts to up to 12 scripts:
    Select the script you want to run with a shortcut
    Right-click on one of the 12 buttons in the lower part of the Scripting window
    Select “Add Script”
  7. The script thus installed is available under Tools, or can be run by pressing Control+Shift+Fn (Fn is a function key at the top of the keyboard, n is a number between 1 and 12, and the number on the button in the Scripting window corresponds to the number on the function key)

A [slightly more] sane initial OmegaT setup. Part I

Over the years of my daily use of OmegaT (I started using it back in 2009), I helped quite a few translators to make their first steps with the program. The funny thing is that almost every time a new person tries to learn the program, we change some of the same defaults to make it more usable and comfortable. So I thought it might be a good idea to collect those few initial setup changes here as a small series of posts so that anyone could refer to them at any point.

The first thing I always have new users change is the Editor behavior.

Continue reading

OmegaT Live preview (based on LibreOffice)

Below you’ll find a quick and dirty live preview solution for OmegaT on GNU/Linux.

In order for it to work, you’ll need any command line converter to convert your target files to PDF, and any PDF viewer to view the converted file. In the solution provided here Zathura PDF viewer is used. It is a very lightweight, keyboard-driven (albeit with vi-like keybindings) application that can invert document colors using a custom color scheme, and, most importantly, it reloads documents as they are changed, but keeps the previously open position, which makes it ideal for live previewing. Target files are converted using LibreOffice since I had it installed anyway; but any other command line tool that converts to PDF would do.

Continue reading

Unlock Text Caret on #OmegaT Startup

As many have probably noticed, in OmegaT it’s now possible to unlock cursor. This means that one can select and copy text anywhere in the Editor pane without using the mouse. With the unlocked cursor you simply press up or down, and the text caret will move beyond the target segment. The lock is triggered with F2. Cool! But there’s no way to make this behavior default — every time OmegaT is started, cursor is locked.

Since I prefer it to be unlocked most of the time, here’s a little workaround. Below is a little script that needs to go into scripts_folder/application_startup/:

def gui() {
    editor.editor.lockCursorToInputArea = false
    editor.editor.updateLockInsertMessage()
}
return

This little snippet should be saved as a plaintext file with extension groovy, for instance, unlock.groovy. Next time OmegaT 4.2 or newer is started, the cursor is going to be unlocked from the get-go!