Skip to content

Commit 3f885d0

Browse files
committed
The Qt fixture reads Qt's own string through variables, so lupdate keeps it out of the program's .ts
1 parent e4a58ae commit 3f885d0

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

‎tests/qt-consumer/qt_consumer_de.ts‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!DOCTYPE TS>
33
<TS version="2.1" language="de_DE">
4-
<context>
5-
<name>QProgressDialog</name>
6-
<message>
7-
<location filename="src/main.cpp" line="52"/>
8-
<source>Cancel</source>
9-
<translation type="unfinished"></translation>
10-
</message>
11-
</context>
124
<context>
135
<name>main</name>
146
<message>

‎tests/qt-consumer/src/main.cpp‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ int main(int argc, char** argv) {
4949
}
5050
QCoreApplication::installTranslator(&qtTranslator);
5151
const QString hello = QCoreApplication::translate("main", "hello");
52-
const QString cancel = QCoreApplication::translate("QProgressDialog", "Cancel");
52+
// Through variables, so lupdate does not take Qt's own string into this
53+
// program's .ts: it extracts literals only.
54+
const char* qtContext = "QProgressDialog";
55+
const char* qtSource = "Cancel";
56+
const QString cancel = QCoreApplication::translate(qtContext, qtSource);
5357

5458
std::printf("qt-consumer: signal %d, resource '%s', translation '%s', Qt %s, Qt's own '%s'\n",
5559
relay.seen, text.constData(), hello.toUtf8().constData(), qVersion(),

0 commit comments

Comments
 (0)