34lrelease is part of Qt's Linguist tool chain. It can be used as a
35stand-alone tool to convert XML-based translations files in the TS
36format into the 'compiled' QM format used by QTranslator objects.
37
38Passing .pro files to lrelease is deprecated.
39Please use the lrelease-pro tool instead, or use qmake's lrelease.prf
40feature.
41
42Options:
43 -help Display this information and exit
44 -idbased
45 Deprecated. The flag is not required anymore and will be removed
46 in a future version. It was used to enable ID based translation.
47 -compress
48 Compress the QM files
49 -nounfinished
50 Do not include unfinished translations
51 -fail-on-unfinished
52 Generate an error if unfinished translations are found
53 -fail-on-invalid
54 Fail if translations failing the following checks are found:
55 validity check of accelerators
56 validity check of surrounding whitespaces
57 validity check of ending punctuation
58 validity check of place markers
59 To get more details refer to Qt Linguist help
60 -removeidentical
61 If the translated text is the same as
62 the source text, do not include the message
63 -markuntranslated <prefix>
64 If a message has no real translation, use the source text
65 prefixed with the given string instead
66 -project <filename>
67 Name of a file containing the project's description in JSON format.
68 Such a file may be generated from a .pro file using lupdate-pro -dump-json.
69 -silent
70 Do not explain what is being done
71 -verbose
72 Explain what is being done (default)
73 -version
74 Display the version of lrelease and exit
75)"_s);
78int main(
int argc,
char **argv)
80 QCoreApplication app(argc, argv);
86 QStringList inputFiles;
88 QString projectDescriptionFile;
90 for (
int i = 1; i < argc; ++i) {
91 const char *arg = argv[i];
92 if (!strcmp(arg,
"-compress")) {
95 }
else if (!strcmp(arg,
"-idbased")) {
96 printOut(
"The flag -idbased is deprecated and not required anymore."
97 "It will be removed in a future version"_L1);
99 }
else if (!strcmp(arg,
"-nocompress")) {
102 }
else if (!strcmp(arg,
"-removeidentical")) {
105 }
else if (!strcmp(arg,
"-nounfinished")) {
108 }
else if (!strcmp(arg,
"-fail-on-unfinished")) {
111 }
else if (!strcmp(arg,
"-fail-on-invalid")) {
114 }
else if (!strcmp(arg,
"-markuntranslated")) {
119 cd.m_unTrPrefix = QString::fromLocal8Bit(argv[++i]);
120 }
else if (!strcmp(arg,
"-project")) {
122 printErr(
"The option -project requires a parameter.\n"_L1);
125 if (!projectDescriptionFile.isEmpty()) {
126 printErr(
"The option -project must appear only once.\n"_L1);
129 projectDescriptionFile = QString::fromLocal8Bit(argv[++i]);
130 }
else if (!strcmp(arg,
"-silent")) {
133 }
else if (!strcmp(arg,
"-verbose")) {
136 }
else if (!strcmp(arg,
"-version")) {
137 printOut(
"lrelease version %1\n"_L1.arg(QLatin1StringView(QT_VERSION_STR)));
139 }
else if (!strcmp(arg,
"-qm")) {
144 outputFile = QString::fromLocal8Bit(argv[++i]);
145 }
else if (!strcmp(arg,
"-help")) {
148 }
else if (arg[0] ==
'-') {
152 inputFiles << QString::fromLocal8Bit(arg);
156 if (inputFiles.isEmpty() && projectDescriptionFile.isEmpty()) {
163 const QStringList proFiles = extractProFiles(&inputFiles);
165 if (!proFiles.isEmpty()) {
166 QStringList translationsVariables = { u"TRANSLATIONS"_s, u"EXTRA_TRANSLATIONS"_s };