source: trunk/doc/src/snippets/code/doc_src_linguist-manual.qdoc@ 788

Last change on this file since 788 was 651, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.2 sources.

File size: 5.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the documentation of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42//! [0]
43HEADERS = main-dlg.h \
44 options-dlg.h
45SOURCES = main-dlg.cpp \
46 options-dlg.cpp \
47 main.cpp
48FORMS = search-dlg.ui
49TRANSLATIONS = superapp_dk.ts \
50 superapp_fi.ts \
51 superapp_no.ts \
52 superapp_se.ts
53//! [0]
54
55
56//! [1]
57CODECFORTR = ISO-8859-5
58//! [1]
59
60
61//! [2]
62CODECFORSRC = UTF-8
63//! [2]
64
65
66//! [3]
67label->setText(tr("F\374r \310lise"));
68//! [3]
69
70
71//! [4]
72Usage:
73 lupdate [options] [project-file]
74 lupdate [options] [source-file|path]... -ts ts-files
75Options:
76 -help Display this information and exit.
77 -noobsolete
78 Drop all obsolete strings.
79 -extensions <ext>[,<ext>]...
80 Process files with the given extensions only.
81 The extension list must be separated with commas, not with whitespace.
82 Default: 'ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx'.
83 -pluralonly
84 Only include plural form messages.
85 -silent
86 Do not explain what is being done.
87 -version
88 Display the version of lupdate and exit.
89//! [4]
90
91
92//! [5]
93Usage:
94 lrelease [options] project-file
95 lrelease [options] ts-files [-qm qm-file]
96Options:
97 -help Display this information and exit
98 -compress
99 Compress the QM files
100 -nounfinished
101 Do not include unfinished translations
102 -removeidentical
103 If the translated text is the same as
104 the source text, do not include the message
105 -silent
106 Do not explain what is being done
107 -version
108 Display the version of lrelease and exit
109//! [5]
110
111
112void wrapInFunction()
113{
114//! [6]
115button = new QPushButton("&Quit", this);
116//! [6]
117
118
119//! [7]
120button = new QPushButton(tr("&Quit"), this);
121//! [7]
122
123
124//! [8]
125QPushButton::tr("&Quit")
126//! [8]
127
128
129//! [9]
130QObject::tr("&Quit")
131//! [9]
132
133
134//! [10]
135rbc = new QRadioButton(tr("Enabled", "Color frame"), this);
136//! [10]
137
138
139//! [11]
140rbh = new QRadioButton(tr("Enabled", "Hue frame"), this);
141//! [11]
142}
143
144
145//! [12]
146/*
147 TRANSLATOR FindDialog
148
149 Choose Edit|Find from the menu bar or press Ctrl+F to pop up the
150 Find dialog.
151
152 ...
153*/
154//! [12]
155
156//! [13]
157/*
158 TRANSLATOR MyNamespace::MyClass
159
160 Necessary for lupdate.
161
162 ...
163*/
164//! [13]
165
166//! [14]
167void some_global_function(LoginWidget *logwid)
168{
169 QLabel *label = new QLabel(
170 LoginWidget::tr("Password:"), logwid);
171}
172
173void same_global_function(LoginWidget *logwid)
174{
175 QLabel *label = new QLabel(
176 qApp->translate("LoginWidget", "Password:"),
177 logwid);
178}
179//! [14]
180
181
182//! [15]
183QString FriendlyConversation::greeting(int greet_type)
184{
185 static const char* greeting_strings[] = {
186 QT_TR_NOOP("Hello"),
187 QT_TR_NOOP("Goodbye")
188 };
189 return tr(greeting_strings[greet_type]);
190}
191//! [15]
192
193
194//! [16]
195static const char* greeting_strings[] = {
196 QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"),
197 QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye")
198};
199
200QString FriendlyConversation::greeting(int greet_type)
201{
202 return tr(greeting_strings[greet_type]);
203}
204
205QString global_greeting(int greet_type)
206{
207 return qApp->translate("FriendlyConversation",
208 greeting_strings[greet_type]);
209}
210//! [16]
211
212void wrapInFunction()
213{
214
215//! [17]
216QString tr(const char *text, const char *comment, int n);
217//! [17]
218
219//! [18]
220tr("%n item(s) replaced", "", count);
221//! [18]
222
223}
224
Note: See TracBrowser for help on using the repository browser.