Chapter 21. Miscellaneous subjects
Prev |  | Next

# Chapter 21. Miscellaneous subjects

## 1. OmegaT Console Mode

### Note

Of interest for advanced users only!

The purpose of the console (i.e. command line) mode is to permit the use of OmegaT as translation tool in a scripting environment. When launched in console mode, no GUI is loaded ( it will work therefore on any console) and the given project is automatically translated. An example would be a software project, with GUI localized in a number of languages. Using the console mode, one can make generating a localized interface a part of the build process.

### 1.1. Prerequisites

To run OmegaT, a valid OmegaT project must be available. The location is irrelevant, since it must be specified explicitly on the command-line at launch.

If you need non-standard settings, the corresponding configuration files (`filters.conf` and `segmentation.conf`) must be present. This can be achieved in two ways:

- Run OmegaT normally (with the GUI) and set the settings. If you start OmegaT in console mode, it will use the settings you configured.

- If you are unable to run OmegaT normally (no graphical environment available): copy the settings files from some other OmegaT installation on another machine to a specific folder. The location does not matter, since you can add it to the command line at launch (see below). The relevant files `filters.conf` and `segmentation.conf` can be found in the user home folder (E.g. `C:\Documents and Settings\%User%\OmegaT` under Windows, `%user%/.omegat/` under Linux)

### 1.2. Launching OmegaT in console mode

To launch OmegaT in console mode, additional parameters must be specified at launch. The most important of these is `<project-dir>`, and optionally `--config-dir=<config-dir>`. Example:

`$> java -jar OmegaT.jar /path/to/project \`

`--config-dir=/path/to/config-files/ \`

`--mode=console-translate \`

`--source-pattern={regexp} \`

`--tag-validation=[block|warn]`

Explanation:

- `<project-dir>` tells OmegaT where to find the project to be translated. If given, OmegaT launches in console mode and translates the given project.

- `--config-dir=<config-dir>` enables OmegaT to be instructed in which folder the configuration files are stored. If not specified, OmegaT reverts to default values (the OmegaT folder in the user home folder, or if not available: the current working folder).

- `--mode=console-translate` OmegaT launches in console mode and translates the given project

- `--source-pattern={regexp}` The files to be translated can be specified this way. Here is an example of the regular expression: `test\.html`

- `--tag-validation=[abort|warn]` On abort, the program is aborted when tag validation finds errors. On warn the errors are printed but the program continues. In all other cases no tag validation is done.

### 1.3. Quiet option

An extra command line parameter specific to console mode: `--quiet`. In the quiet mode, less info is logged to the screen. The messages you would usually find in the status bar are not displayed.

Usage: `java -jar OmegaT.jar /path/to/project --mode=console-translate --quiet`

### 1.4. Tag validation option

Another extra command line parameter specific to console mode: `--tag-validation=[abort|warn]`. When this parameter is added, tag validation is done prior to translation/aligning. If the value is `abort`, then on tag errors the errors are printed and the program stops. If the value is `warn` then the errors are printed but OmegaT continues.

Usage: `java -jar OmegaT.jar /path/to/project --mode=console-translate --tag-validation=abort`

## 2. Automatic Java Properties Aligner

OmegaT can align Java .properties in console mode. If you have the source and the target Properties files for one and the same contents in your language pair, this procedure will create a corresponding tmx file for these contents. Usage:

`java -jar OmegaT.jar --mode=console-align /my-project-dir --alignDir=/translatedFiles/`

`alignDir` must contain a translation in the target language of the project. E.g., if the project is EN->FR, alignDir must contain a bundle ending with _fr. The resulting tmx is stored in the `omegat` folder under the name `align.tmx`.

## 3. Font settings

In this dialog one can define the font used by OmegaT in the following windows:

- OmegaT main window (Editor, Match viewer, Glossary viewer)

- Search window

- Tag validation window

The dialog can be accessed via the Options → Font... item in the Main menu. The dialog contains:

- Font: drop-down to select one of the fonts available on your machine

- Size: edit to change font size

- Sample text: field for immediate preview of the selected font

Note: In some cases it may take quite some time for OmegaT to update the display after the font setting has been changed. This is especially the case when a large file containing many segments is open in the editor, and/or slow hardware is used. Note also that some fonts behave better for some language pairs than for others. In particular, if you are translating between two languages with different alphabets/writing systems (such as Russian and Japanese), select a font that can be used for both.

## 4. Preventing data loss

OmegaT is a robust application. However, you should take precautions against data loss when using OmegaT, just as with any other application. When you translate your files, OmegaT stores all your progress in the translation memory `project_save.tmx` that resides in the project's `/omegat` subfolder.

OmegaT also backs up the translation memory to project_save.tmx.YEARMMDDHHNN.bak in the same subfolder each time a project is opened or reloaded. YEAR is the 4-digit year, MM is the month, DD the day of the month, and HH and NN are the hours and minutes when the previous translation memory was saved.

If you believe that you have lost translation data, you can use the following procedure to restore the project to its most recently saved state, usually not older than approximately 10 minutes or so:

1. close the project

2. rename the current `project_save.tmx` file (e.g. to `project_save.tmx.temporary`)

3. select the backup translation memory that is the most likely to contain the data you are looking for

4. rename it `project_save.tmx`

5. open the project

To avoid losing important data:

- Make regular copies of the file /omegat/project_save.tmx to backup media, such as CD or DVD.

- Until you are familiar with OmegaT, create translated files at regular intervals and check that the translated file contains the latest version of your translation.

- Take particular care when making changes to the files in `/source` while in the middle of a project. If the source file is modified after you have begun translating, OmegaT may be unable to find a segment that you have already translated.

- Use these Help texts to get started. Should you run into problems, post a message in the OmegaT user group. Do not hesitate to post in the language you feel the most familiar with.

Prev |  | Next
Chapter 20. Spell checker | Home | Appendix A. Languages - ISO 639 code list