File: linguist-manager.html

package info (click to toggle)
qt4-x11 4%3A4.8.2%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 701,696 kB
  • sloc: cpp: 2,686,179; ansic: 375,485; python: 25,859; sh: 19,349; xml: 17,091; perl: 14,765; yacc: 5,383; asm: 5,038; makefile: 1,259; lex: 555; ruby: 526; objc: 347; cs: 112; pascal: 112; php: 54; sed: 34
file content (163 lines) | stat: -rw-r--r-- 11,054 bytes parent folder | download
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- linguist-manual.qdoc -->
  <title>Qt 4.8: Qt Linguist Manual: Release Manager</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="content"> 
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
  </div>
  <div class="breadcrumb toolblock">
    <ul>
      <li class="first"><a href="index.html">Home</a></li>
      <!--  Breadcrumbs go here -->
<li>Qt Linguist Manual: Release Manager</li>
    </ul>
  </div>
</div>
<div class="content mainContent">
  <link rel="prev" href="linguist-manual.html" />
  <link rel="next" href="linguist-translators.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="linguist-manual.html">Qt Linguist Manual</a>
<a class="nextPage" href="linguist-translators.html">Qt Linguist Manual: Translators</a>
</p><p/>
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#qt-project-files">Qt Project Files</a></li>
<li class="level1"><a href="#lupdate">lupdate</a></li>
<li class="level1"><a href="#lrelease">lrelease</a></li>
<li class="level1"><a href="#missing-translations">Missing Translations</a></li>
</ul>
</div>
<h1 class="title">Qt Linguist Manual: Release Manager</h1>
<span class="subtitle"></span>
<!-- $$$linguist-manager.html-description -->
<div class="descr"> <a name="details"></a>
<p>Two tools are provided for the release manager, <a href="#lupdate">lupdate</a> and <a href="#lrelease">lrelease</a>. These tools can process <a href="qmake-manual.html#qmake">qmake</a> project files, or operate directly on the file system.</p>
<a name="qt-project-files"></a>
<h2>Qt Project Files</h2>
<p>The easiest method to use <a href="#lupdate">lupdate</a> and <a href="#lrelease">lrelease</a> is by specifying a <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>
<pre class="cpp"> TRANSLATIONS = arrowpad_fr.ts \
                arrowpad_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 the <a href="linguist-programmers.html">Programmers</a> chapter.</p>
<p>An example of a complete <tt>.pro</tt> file with four translation source files:</p>
<pre class="cpp"> 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
 CODECFORTR      = ISO-8859-5</pre>
<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 Latin1.</p>
<p>If you do use the <a href="qtextcodec.html#codecForTr">QTextCodec::codecForTr</a>() mechanism in your application, <i>Qt Linguist</i> needs you to set the <tt>CODECFORTR</tt> entry in the <tt>.pro</tt> file as well. For example:</p>
<pre class="cpp"> CODECFORTR      = ISO-8859-5</pre>
<p>Also, if your compiler uses a different encoding for its runtime system as for its source code and you want to use non-ASCII characters in string literals, you will need to set the <tt>CODECFORSRC</tt>. For example:</p>
<pre class="cpp"> CODECFORSRC     = UTF-8</pre>
<p>Microsoft Visual Studio 2005 .NET appears to be the only compiler for which this is necessary. However, if you want to write portable code, we recommend that you avoid non-ASCII characters in your source files. You can still specify non-ASCII characters portably using escape sequences, for example:</p>
<pre class="cpp"> label<span class="operator">-</span><span class="operator">&gt;</span>setText(tr(<span class="string">&quot;F\374r \310lise&quot;</span>));</pre>
<a name="lupdate"></a>
<h2>lupdate</h2>
<p>Usage: <tt>lupdate myproject.pro</tt></p>
<p><a href="#lupdate">lupdate</a> is a command line tool that finds the translatable strings in the specified source, header and <i>Qt Designer</i> interface files, and produces or updates <tt>.ts</tt> translation files. The files to process and the files to update can be set at the command line, or provided in a <tt>.pro</tt> file specified as an command line argument. The produced translation files are given to the translator who uses <i>Qt Linguist</i> 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="#lupdate">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="#lupdate">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="#lupdate">lupdate</a> runs would probably take place during the final beta phase.</p>
<p>The TS file format is a simple human-readable XML format that can be used with version control systems if required. <tt>lupdate</tt> can also process Localization Interchange File Format (XLIFF) format files; files in this format typically have file names that end with the <tt>.xlf</tt> suffix.</p>
<p><b>Note:</b> The minimum supported version for XLIFF format files is 1.1&#x2e; XLIFF 1.0 version files are not supported.</p>
<p>Pass the <tt>-help</tt> option to <tt>lupdate</tt> to obtain the list of supported options:</p>
<pre class="cpp"> Usage:
     lupdate [options] [project-file]
     lupdate [options] [source-file|path]... -ts ts-files
 Options:
     -help  Display this information and exit.
     -noobsolete
            Drop all obsolete strings.
     -extensions &lt;ext&gt;[,&lt;ext&gt;]...
            Process files with the given extensions only.
            The extension list must be separated with commas, not with whitespace.
            Default: 'ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx'.
     -pluralonly
            Only include plural form messages.
     -silent
            Do not explain what is being done.
     -version
            Display the version of lupdate and exit.</pre>
<p><i>Qt Linguist</i> is also able to import and export XLIFF files. See the <a href="linguist-translators.html">Translators</a> section for more information.</p>
<a name="lrelease"></a>
<h2>lrelease</h2>
<p>Usage: <tt>lrelease myproject.pro</tt></p>
<p><a href="#lrelease">lrelease</a> is a command line tool that produces QM files out of TS files. The QM file format is a compact binary format that is used by the localized application. It provides extremely fast lookups for translations. The TS files <a href="#lrelease">lrelease</a> processes can be specified at the command line, or given indirectly by a Qt <tt>.pro</tt> project file.</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 QM files are not created, e.g&#x2e; 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 QM files are available the application will detect them and use them automatically.</p>
<p>Note that <a href="#lrelease">lrelease</a> will only incorporate translations that are marked as &quot;finished&quot;. Otherwise the original text will be used instead.</p>
<p>Pass the <tt>-help</tt> option to <tt>lrelease</tt> to obtain the list of supported options:</p>
<pre class="cpp"> Usage:
     lrelease [options] project-file
     lrelease [options] ts-files [-qm qm-file]

 lrelease is part of Qt's Linguist tool chain. It can be used as a
 stand-alone tool to convert XML-based translations files in the TS
 format into the 'compiled' QM format used by QTranslator objects.

 Options:
     -help  Display this information and exit
     -idbased
            Use IDs instead of source strings for message keying
     -compress
            Compress the QM files
     -nounfinished
            Do not include unfinished translations
     -removeidentical
            If the translated text is the same as
            the source text, do not include the message
     -markuntranslated &lt;prefix&gt;
            If a message has no real translation, use the source text
            prefixed with the given string instead
     -silent
            Do not explain what is being done
     -version
            Display the version of lrelease and exit</pre>
<a name="missing-translations"></a>
<h2>Missing Translations</h2>
<p>Both <a href="#lupdate">lupdate</a> and <a href="#lrelease">lrelease</a> may be used with TS translation source files which are incomplete. Missing translations will be replaced with the native language phrases at runtime.</p>
</div>
<!-- @@@linguist-manager.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="linguist-manual.html">Qt Linguist Manual</a>
<a class="nextPage" href="linguist-translators.html">Qt Linguist Manual: Translators</a>
</p>
  <div class="ft">
    <span></span>
  </div>
</div> 
<div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2012 Nokia Corporation and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Nokia, Qt and their respective logos are trademarks of Nokia Corporation 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>