Skip to content
Permalink
8bed31719c
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
331 lines (270 sloc) 12.7 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"../../../docbook-xml-4.5/docbookx.dtd">
<chapter id="chapter.misc">
<title>Miscellaneous subjects<indexterm class="singular">
<primary>Miscellanea</primary>
</indexterm></title>
<section id="omegat.misc.console.mode">
<title><application><indexterm class="singular">
<primary>OmegaT console mode</primary>
<seealso>Miscellanea</seealso>
</indexterm>OmegaT</application> Console Mode<indexterm class="singular">
<primary>Miscellanea</primary>
<secondary>OmegaT console mode</secondary>
</indexterm></title>
<note>
<para>Of interest for advanced users only!</para>
</note>
<para>The purpose of the console (i.e. command line) mode is to permit the
use <application>of OmegaT</application> 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.</para>
<section id="misc.console.mode.prerequisites">
<title>Prerequisites</title>
<para>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.</para>
<para>If you need non-standard settings, the corresponding configuration
files (<literal>filters.conf</literal> and
<literal>segmentation.conf</literal>) must be present. This can be
achieved in two ways:</para>
<itemizedlist>
<listitem>
<para>Run <application>OmegaT</application> normally (with the GUI)
and set the settings. If you start <application>OmegaT</application>
in console mode, it will use the settings you configured.</para>
</listitem>
<listitem>
<para>If you are unable to run <application>OmegaT</application>
normally (no graphical environment available): copy the settings
files from some other <application>OmegaT</application> 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 <literal>filters.conf</literal> and
<literal>segmentation.conf</literal> can be found in the user home
folder (E.g. <literal>C:\Documents and
Settings\%User%\<application>OmegaT</application></literal> under
Windows, <literal>%user%/.omegat/</literal> under Linux)</para>
</listitem>
</itemizedlist>
</section>
<section id="starting.in.misc.console.mode">
<title>Launching OmegaT in console mode</title>
<para>To launch OmegaT in console mode, additional parameters must be
specified at launch. The most important of these is
<literal>&lt;project-dir&gt;</literal>, and
optionally <literal>--config-dir=&lt;config-dir&gt;</literal>.
Example:</para>
<para><literal>$&gt; java -jar <application>OmegaT</application>.jar
/path/to/project \</literal></para>
<para><literal> --config-dir=/path/to/config-files/ \</literal></para>
<para><literal> --mode=console-translate \</literal></para>
<para><literal> --source-pattern={regexp} \</literal></para>
<para><literal> --tag-validation=[block|warn] </literal></para>
<para><emphasis role="bold">Explanation:</emphasis></para>
<itemizedlist>
<listitem>
<para><literal>&lt;project-dir&gt;</literal> tells
<application>OmegaT</application> where to find the project to be
translated. If given, <application>OmegaT</application> launches in
console mode and translates the given project.</para>
</listitem>
</itemizedlist>
<itemizedlist>
<listitem>
<para><literal>--config-dir=&lt;config-dir&gt;</literal> 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).</para>
</listitem>
</itemizedlist>
<itemizedlist>
<listitem>
<para><literal>--mode=console-translate </literal>
<application>OmegaT</application> launches in console mode and
translates the given project</para>
</listitem>
<listitem>
<para><literal>--source-pattern={regexp} </literal>The files to be
translated can be specified this way. Here is an example of the
regular expression: <filename>test\.html</filename></para>
</listitem>
<listitem>
<para><literal>--tag-validation=[abort|warn] </literal> 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.</para>
</listitem>
</itemizedlist>
</section>
<section id="misc.console.mode.option.quiet">
<title>Quiet option</title>
<para>An extra command line parameter specific to console mode:
<literal>--quiet</literal>. In the quiet mode, less info is logged to
the screen. The messages you would usually find in the status bar are
not displayed.</para>
<para>Usage: <literal>java -jar <application>OmegaT</application>.jar
/path/to/project --mode=console-translate --quiet</literal></para>
</section>
<section id="misc.console.mode.option.validatetags">
<title>Tag validation option</title>
<para>Another extra command line parameter specific to console mode:
<literal>--tag-validation=[abort|warn]</literal>. When this parameter is
added, tag validation is done prior to translation/aligning. If the
value is <literal>abort</literal>, then on tag errors the errors are
printed and the program stops. If the value is <literal>warn</literal>
then the errors are printed but OmegaT continues.</para>
<para>Usage: <literal>java -jar <application>OmegaT</application>.jar
/path/to/project --mode=console-translate
--tag-validation=abort</literal></para>
</section>
</section>
<section>
<title>Automatic Java Properties Aligner<indexterm class="singular">
<primary>Miscellanea</primary>
<secondary>Automatic aligner for Java properties</secondary>
</indexterm></title>
<para>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:</para>
<para><literal>java -jar OmegaT.jar --mode=console-align /my-project-dir
--alignDir=/translatedFiles/ </literal></para>
<para><filename>alignDir </filename>must contain a translation in the
target language of the project. E.g., if the project is EN-&gt;FR,
alignDir must contain a bundle ending with _fr. The resulting tmx is
stored in the <literal>omegat </literal>folder under the name
<filename>align.tmx</filename>.</para>
</section>
<section id="font.settings">
<title>Font settings<indexterm class="singular">
<primary>Miscellanea</primary>
<secondary>Font settings</secondary>
</indexterm></title>
<para>In this dialog one can define the font used by
<application>OmegaT</application> in the following windows:</para>
<itemizedlist>
<listitem>
<para><application>OmegaT</application> main window (Editor, Match
viewer, Glossary viewer)</para>
</listitem>
</itemizedlist>
<itemizedlist>
<listitem>
<para>Search window</para>
</listitem>
</itemizedlist>
<itemizedlist>
<listitem>
<para>Tag validation window</para>
</listitem>
</itemizedlist>
<para>The dialog can be accessed via the <indexterm class="singular">
<primary>Menu Options</primary>
<secondary>Font...</secondary>
</indexterm><menuchoice>
<guimenu>Options</guimenu>
<guimenuitem>Font...</guimenuitem>
</menuchoice> item in the Main menu. The dialog contains:</para>
<itemizedlist>
<listitem>
<para><emphasis role="bold">Font:</emphasis> drop-down to select one
of the fonts available on your machine</para>
</listitem>
</itemizedlist>
<itemizedlist>
<listitem>
<para><emphasis role="bold">Size:</emphasis> edit to change font
size</para>
</listitem>
</itemizedlist>
<itemizedlist>
<listitem>
<para><emphasis role="bold">Sample text:</emphasis> field for
immediate preview of the selected font</para>
</listitem>
</itemizedlist>
<para><emphasis role="bold">Note: </emphasis>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.</para>
</section>
<section id="preventing.data.loss">
<title>Preventing data loss<indexterm class="singular">
<primary>Miscellanea</primary>
<secondary>Preventing data Loss</secondary>
</indexterm></title>
<para><application>OmegaT</application> is a robust application. However,
you should take precautions against data loss when using
<application>OmegaT</application>, just as with any other application.
When you translate your files, <application>OmegaT</application> stores
all your progress in the translation memory
<literal>project_save.tmx</literal> that resides in the project's
<literal>/omegat</literal> subfolder.</para>
<para>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.</para>
<para>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:</para>
<orderedlist>
<listitem>
<para>close the project</para>
</listitem>
<listitem>
<para>rename the current <filename>project_save.tmx </filename>file
(e.g. to <filename>project_save.tmx.temporary</filename>)</para>
</listitem>
<listitem>
<para>select the backup translation memory that is the most likely to
contain the data you are looking for</para>
</listitem>
<listitem>
<para>rename it <literal>project_save.tmx</literal></para>
</listitem>
<listitem>
<para>open the project</para>
</listitem>
</orderedlist>
<para>To avoid losing important data:</para>
<itemizedlist>
<listitem>
<para>Make regular copies of the file /omegat/project_save.tmx to
backup media, such as CD or DVD.</para>
</listitem>
<listitem>
<para>Until you are familiar with <application>OmegaT</application>,
create translated files at regular intervals and check that the
translated file contains the latest version of your
translation.</para>
</listitem>
<listitem>
<para>Take particular care when making changes to the files in
<literal>/source</literal> while in the middle of a project. If the
source file is modified after you have begun translating,
<application>OmegaT</application> may be unable to find a segment that
you have already translated.</para>
</listitem>
</itemizedlist>
<itemizedlist>
<listitem>
<para>Use these Help texts to get started. Should you run into
problems, post a message in the <ulink
url="http://tech.groups.yahoo.com/group/Omegat/"><application>OmegaT</application>
user group</ulink>. Do not hesitate to post in the language you feel
the most familiar with.</para>
</listitem>
</itemizedlist>
</section>
</chapter>