<!-- index Release Manager --><p>Two tools are provided for the release manager, <ahref="linguist-manual-2.html#2">lupdate</a> and <ahref="linguist-manual-2.html#3">lrelease</a>. These tools depend on <em>qmake</em> project files. You don't have to use <em>qmake</em>, though.</p>
<!-- index .pro Files --><!-- index Project Files --><!-- index qmake!Project Files --><p><ahref="linguist-manual-2.html#2">lupdate</a> and <ahref="linguist-manual-2.html#3">lrelease</a> depend on information in the application's <tt>.pro</tt> Qt project file. There must be an entry in the <tt>TRANSLATIONS</tt> section of the project file for each language that is additional to the native language. A typical entry looks like this:</p>
<!-- index TRANSLATIONS!in Project Files --><pre> TRANSLATIONS = tt2_fr.ts \
tt2_nl.ts
</pre>
<p>Using a locale within the translation file name is useful for determining which language to load at runtime. This is explained in <ahref="linguist-manual-4.html">Chapter 4: Programmers</a>.</p>
<!-- index HEADERS!in Project Files --><!-- index SOURCES!in Project Files --><!-- index FORMS!in Project Files --><!-- index TRANSLATIONS!in Project Files --><p>An example of a complete <tt>.pro</tt> file with four translation source files:</p>
<pre>
HEADERS = main-dlg.h \
options-dlg.h
SOURCES = main-dlg.cpp \
options-dlg.cpp \
main.cpp
FORMS = search-dlg.ui
TRANSLATIONS = superapp_dk.ts \
superapp_fi.ts \
superapp_no.ts \
superapp_se.ts
</pre>
<!-- index QApplication!defaultCodec() --><!-- index defaultCodec()!QApplication --><!-- index DEFAULTCODEC!in Project Files --><!-- index Chinese Language --><!-- index Japanese Language --><p><ahref="qtextcodec.html#setCodecForTr">QTextCodec::setCodecForTr</a>() makes it possible to choose a 8-bit encoding for literal strings that appear within <tt>tr()</tt> calls. This is useful for applications whose source language is, for example, Chinese or Japanese. If no encoding is set, <tt>tr()</tt> uses Latin-1.</p>
<p>If you do use the <ahref="qtextcodec.html#codecForTr">QTextCodec::codecForTr</a>() mechanism in your application, <em>Qt Linguist</em> needs you to set the <tt>DEFAULTCODEC</tt> entry in the <tt>.pro</tt> file as well. For example:</p>
<pre>
DEFAULTCODEC = ISO-8859-5
</pre>
<h3><aname="2"></a>lupdate</h3>
<!-- index lupdate --><p>Usage: <tt>lupdate myproject.pro</tt></p>
<!-- index Qt Designer --><p>This is a simple command line tool. <ahref="linguist-manual-2.html#2">lupdate</a> reads a Qt <tt>.pro</tt> project file, finds the translatable strings in the specified source, header and <em>Qt Designer</em> interface files, and produces or updates the <tt>.ts</tt> translation files listed in the project file. The translation files are given to the translator who uses <em>Qt Linguist</em> to read the files and insert the translations.</p>
<p>Companies that have their own translators in-house may find it useful to run <ahref="linguist-manual-2.html#2">lupdate</a> regularly, perhaps monthly, as the application develops. This will lead to a fairly low volume of translation work spread evenly over the life of the project and will allow the translators to support a number of projects simultaneously.</p>
<p>Companies that hire in translators as required may prefer to run <ahref="linguist-manual-2.html#2">lupdate</a> only a few times in the application's life cycle, the first time might be just before the first test phase. This will provide the translator with a substantial single block of work and any bugs that the translator detects may easily be included with those found during the initial test phase. The second and any subsequent <ahref="linguist-manual-2.html#2">lupdate</a> runs would probably take place during the final beta phase.</p>
<!-- index .ts Files --><!-- index Translation Source Files --><!-- index XML --><p>The <tt>.ts</tt> file format is a simple human-readable XML format that can be used with version control systems if required.</p>
<h3><aname="3"></a>lrelease</h3>
<!-- index lrelease --><p>Usage: <tt>lrelease myproject.pro</tt></p>
<!-- index .qm Files --><!-- index Qt Message Files --><p>This is another simple command line tool. It reads a Qt <tt>.pro</tt> project file and produces the <tt>.qm</tt> files used by the application, one for each <tt>.ts</tt> translation source file listed in the project file. The <tt>.qm</tt> file format is a compact binary format that provides extremely fast lookups for translations.</p>
<p>This tool is run whenever a release of the application is to be made, from initial test version through to final release version. If the <tt>.qm</tt> files are not created, e.g. because an alpha release is required before any translation has been undertaken, the application will run perfectly well using the text the programmers placed in the source files. Once the <tt>.qm</tt> files are available the application will detect them and use them automatically.</p>
<p>Note that <ahref="linguist-manual-2.html#3">lrelease</a> will only incorporate translations that are marked as "done". If a translation is missing, or has failed validation, the original text will be used instead.</p>
<h3><aname="4"></a>Missing Translations</h3>
<p>Both <ahref="linguist-manual-2.html#2">lupdate</a> and <ahref="linguist-manual-2.html#3">lrelease</a> may be used with <tt>.ts</tt> translation source files which are incomplete. Missing translations will be replaced with the native language phrases at runtime.</p>