File: linguist-manual-2.html

package info (click to toggle)
qt-x11-free 3%3A3.3.8b-7
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 82,260 kB
  • ctags: 72,611
  • sloc: cpp: 456,781; ansic: 129,082; sh: 11,455; yacc: 2,947; xml: 766; makefile: 566; perl: 495; lex: 458; sql: 29; lisp: 13
file content (81 lines) | stat: -rw-r--r-- 7,747 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/tools/linguist/book/linguist-manager.leaf:3 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Release Manager</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><p align="right">[<a href="linguist-manual-1.html">Prev: Introduction</a>] [<a href="linguist-manual.html">Home</a>] [<a href="linguist-manual-3.html">Next: Translators</a>]</p>
<h2 align="center">Release Manager</h2>
<!-- index Release Manager --><p>Two tools are provided for the release manager, <a href="linguist-manual-2.html#2">lupdate</a> and <a href="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>
<p>A third tool, <tt>qm2ts</tt>, can be used for converting Qt 2.x message files to <tt>.ts</tt> files.</p>
<h3><a name="1"></a>Qt Project Files</h3>
<!-- index .pro Files --><!-- index Project Files --><!-- index qmake!Project Files --><p><a href="linguist-manual-2.html#2">lupdate</a> and <a href="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 <a href="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><a href="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 <a href="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><a name="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. <a href="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 <a href="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 <a href="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 <a href="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><a name="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 <a href="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><a name="4"></a>Missing Translations</h3>
<p>Both <a href="linguist-manual-2.html#2">lupdate</a> and <a href="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>
<!-- eof -->
<p align="right">[<a href="linguist-manual-1.html">Prev: Introduction</a>] [<a href="linguist-manual.html">Home</a>] [<a href="linguist-manual-3.html">Next: Translators</a>]</p>
<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>