summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/assistant/tools/assistant/bookmarkitem.cpp5
-rw-r--r--tools/assistant/tools/assistant/cmdlineparser.cpp6
-rw-r--r--tools/assistant/tools/assistant/cmdlineparser.h1
-rw-r--r--tools/assistant/tools/assistant/mainwindow.cpp2
-rw-r--r--tools/assistant/tools/qcollectiongenerator/main.cpp55
-rw-r--r--tools/assistant/tools/qhelpconverter/filterpage.cpp2
-rw-r--r--tools/assistant/tools/qhelpconverter/finishpage.cpp3
-rw-r--r--tools/assistant/tools/qhelpconverter/helpwindow.cpp2
-rw-r--r--tools/assistant/tools/qhelpgenerator/main.cpp24
-rw-r--r--tools/assistant/tools/shared/helpgenerator.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/itemlisteditor.cpp22
-rw-r--r--tools/designer/src/lib/shared/plugindialog.cpp4
-rw-r--r--tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp4
-rw-r--r--tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp4
-rw-r--r--tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp4
-rw-r--r--tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp4
-rw-r--r--tools/designer/src/plugins/qwebview/qwebview_plugin.cpp4
-rw-r--r--tools/linguist/lconvert/main.cpp8
-rw-r--r--tools/linguist/linguist/phrase.cpp7
-rw-r--r--tools/linguist/lrelease/main.cpp44
-rw-r--r--tools/linguist/lupdate/cpp.cpp83
-rw-r--r--tools/linguist/lupdate/java.cpp29
-rw-r--r--tools/linguist/lupdate/main.cpp20
-rw-r--r--tools/linguist/lupdate/merge.cpp18
-rw-r--r--tools/linguist/lupdate/qdeclarative.cpp7
-rw-r--r--tools/linguist/lupdate/qscript.cpp52
-rw-r--r--tools/linguist/lupdate/qscript.g51
-rw-r--r--tools/linguist/lupdate/ui.cpp19
28 files changed, 269 insertions, 219 deletions
diff --git a/tools/assistant/tools/assistant/bookmarkitem.cpp b/tools/assistant/tools/assistant/bookmarkitem.cpp
index 2e81e38..2c92113 100644
--- a/tools/assistant/tools/assistant/bookmarkitem.cpp
+++ b/tools/assistant/tools/assistant/bookmarkitem.cpp
@@ -41,6 +41,7 @@
#include "bookmarkitem.h"
+#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
@@ -147,7 +148,9 @@ BookmarkItem::insertChildren(bool isFolder, int position, int count)
for (int row = 0; row < count; ++row) {
m_children.insert(position, new BookmarkItem(DataVector()
- << QObject::tr(isFolder ? "New Folder" : "Untitled")
+ << (isFolder
+ ? QCoreApplication::translate("BookmarkItem", "New Folder")
+ : QCoreApplication::translate("BookmarkItem", "Untitled"))
<< (isFolder ? "Folder" : "about:blank") << false, this));
}
diff --git a/tools/assistant/tools/assistant/cmdlineparser.cpp b/tools/assistant/tools/assistant/cmdlineparser.cpp
index b6c0beb..1cf2915 100644
--- a/tools/assistant/tools/assistant/cmdlineparser.cpp
+++ b/tools/assistant/tools/assistant/cmdlineparser.cpp
@@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE
-const QString CmdLineParser::m_helpMessage = QLatin1String(
+static const char helpMessage[] = QT_TRANSLATE_NOOP("CmdLineParser",
"Usage: assistant [Options]\n\n"
"-collectionFile file Uses the specified collection\n"
" file instead of the default one\n"
@@ -138,10 +138,10 @@ CmdLineParser::Result CmdLineParser::parse()
}
if (!m_error.isEmpty()) {
- showMessage(m_error + QLatin1String("\n\n\n") + m_helpMessage, true);
+ showMessage(m_error + QLatin1String("\n\n\n") + tr(helpMessage), true);
return Error;
} else if (showHelp) {
- showMessage(m_helpMessage, false);
+ showMessage(tr(helpMessage), false);
return Help;
}
return Ok;
diff --git a/tools/assistant/tools/assistant/cmdlineparser.h b/tools/assistant/tools/assistant/cmdlineparser.h
index 5573081..db66494 100644
--- a/tools/assistant/tools/assistant/cmdlineparser.h
+++ b/tools/assistant/tools/assistant/cmdlineparser.h
@@ -93,7 +93,6 @@ private:
QStringList m_arguments;
int m_pos;
- static const QString m_helpMessage;
QString m_collectionFile;
QString m_cloneFile;
QString m_helpFile;
diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp
index 913e342..65a58c0 100644
--- a/tools/assistant/tools/assistant/mainwindow.cpp
+++ b/tools/assistant/tools/assistant/mainwindow.cpp
@@ -831,7 +831,7 @@ void MainWindow::showAboutDialog()
aboutDia.setWindowTitle(aboutDia.documentTitle());
} else {
QByteArray resources;
- aboutDia.setText(QString::fromLatin1("<center>"
+ aboutDia.setText(tr("<center>"
"<h3>%1</h3>"
"<p>Version %2</p></center>"
"<p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p>")
diff --git a/tools/assistant/tools/qcollectiongenerator/main.cpp b/tools/assistant/tools/qcollectiongenerator/main.cpp
index 41bf281..46e301c 100644
--- a/tools/assistant/tools/qcollectiongenerator/main.cpp
+++ b/tools/assistant/tools/qcollectiongenerator/main.cpp
@@ -60,6 +60,10 @@
QT_USE_NAMESPACE
+class QCG {
+ Q_DECLARE_TR_FUNCTIONS(QCollectionGenerator)
+};
+
class CollectionConfigReader : public QXmlStreamReader
{
public:
@@ -125,9 +129,7 @@ private:
void CollectionConfigReader::raiseErrorWithLine()
{
- raiseError(QCoreApplication::translate("QCollectionGenerator",
- "Unknown token at line %1.")
- .arg(lineNumber()));
+ raiseError(QCG::tr("Unknown token at line %1.").arg(lineNumber()));
}
void CollectionConfigReader::readData(const QByteArray &contents)
@@ -146,9 +148,8 @@ void CollectionConfigReader::readData(const QByteArray &contents)
&& attributes().value(QLatin1String("version")) == QLatin1String("1.0"))
readConfig();
else
- raiseError(QCoreApplication::translate("QCollectionGenerator",
- "Unknown token at line %1. "
- "Expected \"QtHelpCollectionProject\"!")
+ raiseError(QCG::tr("Unknown token at line %1. "
+ "Expected \"QtHelpCollectionProject\".")
.arg(lineNumber()));
}
}
@@ -171,7 +172,7 @@ void CollectionConfigReader::readConfig()
}
}
if (!ok && !hasError())
- raiseError(QLatin1String("Missing end tags."));
+ raiseError(QCG::tr("Missing end tags."));
}
void CollectionConfigReader::readAssistantSettings()
@@ -313,7 +314,7 @@ void CollectionConfigReader::readFiles()
}
}
if (input.isEmpty() || output.isEmpty()) {
- raiseError(QLatin1String("Missing input or output file for help file generation!"));
+ raiseError(QCG::tr("Missing input or output file for help file generation."));
return;
}
m_filesToGenerate.insert(input, output);
@@ -373,8 +374,7 @@ int main(int argc, char *argv[])
QFileInfo fi(QString::fromLocal8Bit(argv[i]));
collectionFile = fi.absoluteFilePath();
} else {
- error = QCoreApplication::translate("QCollectionGenerator",
- "Missing output file name!");
+ error = QCG::tr("Missing output file name.");
}
} else if (arg == QLatin1String("-h")) {
showHelp = true;
@@ -388,16 +388,15 @@ int main(int argc, char *argv[])
}
if (showVersion) {
- fprintf(stdout, "Qt Collection Generator version 1.0 (Qt %s)\n",
- QT_VERSION_STR);
+ fputs(qPrintable(QCG::tr("Qt Collection Generator version 1.0 (Qt %1)\n")
+ .arg(QT_VERSION_STR)), stdout);
return 0;
}
if (configFile.isEmpty() && !showHelp)
- error = QCoreApplication::translate("QCollectionGenerator",
- "Missing collection config file!");
+ error = QCG::tr("Missing collection config file.");
- QString help = QCoreApplication::translate("QCollectionGenerator", "\nUsage:\n\n"
+ QString help = QCG::tr("\nUsage:\n\n"
"qcollectiongenerator <collection-config-file> [options]\n\n"
" -o <collection-file> Generates a collection file\n"
" called <collection-file>. If\n"
@@ -407,7 +406,7 @@ int main(int argc, char *argv[])
" qcollectiongenerator.\n\n");
if (showHelp) {
- fprintf(stdout, "%s", qPrintable(help));
+ fputs(qPrintable(help), stdout);
return 0;
}else if (!error.isEmpty()) {
fprintf(stderr, "%s\n\n%s", qPrintable(error), qPrintable(help));
@@ -416,7 +415,7 @@ int main(int argc, char *argv[])
QFile file(configFile);
if (!file.open(QIODevice::ReadOnly)) {
- fprintf(stderr, "Could not open %s!\n", qPrintable(configFile));
+ fputs(qPrintable(QCG::tr("Could not open %1.\n").arg(configFile)), stderr);
return -1;
}
@@ -426,17 +425,18 @@ int main(int argc, char *argv[])
+ fi.baseName() + QLatin1String(".qhc");
}
- fprintf(stdout, "Reading collection config file...\n");
+ fputs(qPrintable(QCG::tr("Reading collection config file...\n")), stdout);
CollectionConfigReader config;
config.readData(file.readAll());
if (config.hasError()) {
- fprintf(stderr, "Collection config file error: %s\n", qPrintable(config.errorString()));
+ fputs(qPrintable(QCG::tr("Collection config file error: %1\n")
+ .arg(config.errorString())), stderr);
return -1;
}
QMap<QString, QString>::const_iterator it = config.filesToGenerate().constBegin();
while (it != config.filesToGenerate().constEnd()) {
- fprintf(stdout, "Generating help for %s...\n", qPrintable(it.key()));
+ fputs(qPrintable(QCG::tr("Generating help for %1...\n").arg(it.key())), stdout);
QHelpProjectData helpData;
if (!helpData.readData(absoluteFileName(basePath, it.key()))) {
fprintf(stderr, "%s\n", qPrintable(helpData.errorMessage()));
@@ -451,12 +451,13 @@ int main(int argc, char *argv[])
++it;
}
- fprintf(stdout, "Creating collection file...\n");
+ fputs(qPrintable(QCG::tr("Creating collection file...\n")), stdout);
QFileInfo colFi(collectionFile);
if (colFi.exists()) {
if (!colFi.dir().remove(colFi.fileName())) {
- fprintf(stderr, "The file %s cannot be overwritten!\n", qPrintable(collectionFile));
+ fputs(qPrintable(QCG::tr("The file %1 cannot be overwritten.\n")
+ .arg(collectionFile)), stderr);
return -1;
}
}
@@ -514,7 +515,7 @@ int main(int argc, char *argv[])
if (!config.applicationIcon().isEmpty()) {
QFile icon(absoluteFileName(basePath, config.applicationIcon()));
if (!icon.open(QIODevice::ReadOnly)) {
- fprintf(stderr, "Cannot open %s!\n", qPrintable(icon.fileName()));
+ fputs(qPrintable(QCG::tr("Cannot open %1.\n").arg(icon.fileName())), stderr);
return -1;
}
CollectionConfiguration::setApplicationIcon(helpEngine, icon.readAll());
@@ -535,7 +536,7 @@ int main(int argc, char *argv[])
if (!config.aboutIcon().isEmpty()) {
QFile icon(absoluteFileName(basePath, config.aboutIcon()));
if (!icon.open(QIODevice::ReadOnly)) {
- fprintf(stderr, "Cannot open %s!\n", qPrintable(icon.fileName()));
+ fputs(qPrintable(QCG::tr("Cannot open %1.\n").arg(icon.fileName())), stderr);
return -1;
}
CollectionConfiguration::setAboutIcon(helpEngine, icon.readAll());
@@ -557,7 +558,7 @@ int main(int argc, char *argv[])
QFileInfo fi(absoluteFileName(basePath, it.value()));
QFile f(fi.absoluteFilePath());
if (!f.open(QIODevice::ReadOnly)) {
- fprintf(stderr, "Cannot open %s!\n", qPrintable(f.fileName()));
+ fputs(qPrintable(QCG::tr("Cannot open %1.\n").arg(f.fileName())), stderr);
return -1;
}
QByteArray data = f.readAll();
@@ -579,8 +580,8 @@ int main(int argc, char *argv[])
if (!imgData.contains(src))
imgData.insert(src, img.readAll());
} else {
- fprintf(stderr, "Cannot open referenced image file %s!\n",
- qPrintable(img.fileName()));
+ fputs(qPrintable(QCG::tr("Cannot open referenced image file %1.\n")
+ .arg(img.fileName())), stderr);
}
}
}
diff --git a/tools/assistant/tools/qhelpconverter/filterpage.cpp b/tools/assistant/tools/qhelpconverter/filterpage.cpp
index 7f86980..c782943 100644
--- a/tools/assistant/tools/qhelpconverter/filterpage.cpp
+++ b/tools/assistant/tools/qhelpconverter/filterpage.cpp
@@ -127,7 +127,7 @@ void FilterPage::addFilter()
{
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.customFilterWidget);
item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsSelectable);
- item->setText(0, QLatin1String("unfiltered"));
+ item->setText(0, tr("unfiltered", "list of available documentation"));
item->setText(1, QLatin1String(""));
m_ui.customFilterWidget->editItem(item, 0);
m_ui.removeButton->setDisabled(false);
diff --git a/tools/assistant/tools/qhelpconverter/finishpage.cpp b/tools/assistant/tools/qhelpconverter/finishpage.cpp
index 0be3a1b..f0228e3 100644
--- a/tools/assistant/tools/qhelpconverter/finishpage.cpp
+++ b/tools/assistant/tools/qhelpconverter/finishpage.cpp
@@ -52,8 +52,7 @@ FinishPage::FinishPage(QWidget *parent)
: QWizardPage(parent)
{
setTitle(tr("Converting File"));
- setSubTitle(QLatin1String("Creating the new Qt help files from the "
- "old .adp file."));
+ setSubTitle(tr("Creating the new Qt help files from the old ADP file."));
setFinalPage(true);
QVBoxLayout *layout = new QVBoxLayout(this);
diff --git a/tools/assistant/tools/qhelpconverter/helpwindow.cpp b/tools/assistant/tools/qhelpconverter/helpwindow.cpp
index 9cc1a85..2c7e030 100644
--- a/tools/assistant/tools/qhelpconverter/helpwindow.cpp
+++ b/tools/assistant/tools/qhelpconverter/helpwindow.cpp
@@ -64,7 +64,7 @@ HelpWindow::HelpWindow(QWidget *parent)
layout = new QVBoxLayout(frame);
layout->setMargin(2);
- QLabel *l = new QLabel(QLatin1String("<center><b>Wizard Assistant</b></center>"));
+ QLabel *l = new QLabel(tr("<center><b>Wizard Assistant</b></center>"));
layout->addWidget(l);
m_textEdit = new QTextEdit();
m_textEdit->setFrameStyle(QFrame::NoFrame);
diff --git a/tools/assistant/tools/qhelpgenerator/main.cpp b/tools/assistant/tools/qhelpgenerator/main.cpp
index 7ea7154..637786c 100644
--- a/tools/assistant/tools/qhelpgenerator/main.cpp
+++ b/tools/assistant/tools/qhelpgenerator/main.cpp
@@ -52,6 +52,10 @@
QT_USE_NAMESPACE
+class QHG {
+ Q_DECLARE_TR_FUNCTIONS(QHelpGenerator)
+};
+
int main(int argc, char *argv[])
{
QString error;
@@ -84,8 +88,7 @@ int main(int argc, char *argv[])
QFileInfo fi(QString::fromLocal8Bit(argv[i]));
compressedFile = fi.absoluteFilePath();
} else {
- error = QCoreApplication::translate("QHelpGenerator",
- "Missing output file name!");
+ error = QHG::tr("Missing output file name.");
}
} else if (arg == QLatin1String("-v")) {
showVersion = true;
@@ -101,16 +104,15 @@ int main(int argc, char *argv[])
}
if (showVersion) {
- fprintf(stdout, "Qt Help Generator version 1.0 (Qt %s)\n",
- QT_VERSION_STR);
+ fputs(qPrintable(QHG::tr("Qt Help Generator version 1.0 (Qt %1)\n")
+ .arg(QT_VERSION_STR)), stdout);
return 0;
}
if (projectFile.isEmpty() && !showHelp)
- error = QCoreApplication::translate("QHelpGenerator",
- "Missing Qt help project file!");
+ error = QHG::tr("Missing Qt help project file.");
- QString help = QCoreApplication::translate("QHelpGenerator", "\nUsage:\n\n"
+ QString help = QHG::tr("\nUsage:\n\n"
"qhelpgenerator <help-project-file> [options]\n\n"
" -o <compressed-file> Generates a Qt compressed help\n"
" file called <compressed-file>.\n"
@@ -122,7 +124,7 @@ int main(int argc, char *argv[])
" qhelpgenerator.\n\n");
if (showHelp) {
- fprintf(stdout, "%s", qPrintable(help));
+ fputs(qPrintable(help), stdout);
return 0;
}else if (!error.isEmpty()) {
fprintf(stderr, "%s\n\n%s", qPrintable(error), qPrintable(help));
@@ -131,7 +133,7 @@ int main(int argc, char *argv[])
QFile file(projectFile);
if (!file.open(QIODevice::ReadOnly)) {
- fprintf(stderr, "Could not open %s!\n", qPrintable(projectFile));
+ fputs(qPrintable(QHG::tr("Could not open %1.\n").arg(projectFile)), stderr);
return -1;
}
@@ -147,8 +149,8 @@ int main(int argc, char *argv[])
QDir parentDir = fi.dir();
if (!parentDir.exists()) {
if (!parentDir.mkpath(QLatin1String("."))) {
- fprintf(stderr, "Could not create output directory: %s\n",
- qPrintable(parentDir.path()));
+ fputs(qPrintable(QHG::tr("Could not create output directory: %1\n")
+ .arg(parentDir.path())), stderr);
}
}
}
diff --git a/tools/assistant/tools/shared/helpgenerator.cpp b/tools/assistant/tools/shared/helpgenerator.cpp
index 12008e6..4812bc5 100644
--- a/tools/assistant/tools/shared/helpgenerator.cpp
+++ b/tools/assistant/tools/shared/helpgenerator.cpp
@@ -73,12 +73,12 @@ QString HelpGenerator::error() const
void HelpGenerator::printStatus(const QString &msg)
{
- fprintf(stdout, "%s\n", qPrintable(msg));
+ puts(qPrintable(msg));
}
void HelpGenerator::printWarning(const QString &msg)
{
- fprintf(stdout, "Warning: %s\n", qPrintable(msg));
+ puts(qPrintable(tr("Warning: %1").arg(msg)));
}
QT_END_NAMESPACE
diff --git a/tools/designer/src/components/taskmenu/itemlisteditor.cpp b/tools/designer/src/components/taskmenu/itemlisteditor.cpp
index 94959fd..9f8e9c8 100644
--- a/tools/designer/src/components/taskmenu/itemlisteditor.cpp
+++ b/tools/designer/src/components/taskmenu/itemlisteditor.cpp
@@ -114,20 +114,20 @@ void AbstractItemEditor::keyPressEvent(QKeyEvent *e)
}
static const char * const itemFlagNames[] = {
- "Selectable",
- "Editable",
- "DragEnabled",
- "DropEnabled",
- "UserCheckable",
- "Enabled",
- "Tristate",
+ QT_TRANSLATE_NOOP("AbstractItemEditor", "Selectable"),
+ QT_TRANSLATE_NOOP("AbstractItemEditor", "Editable"),
+ QT_TRANSLATE_NOOP("AbstractItemEditor", "DragEnabled"),
+ QT_TRANSLATE_NOOP("AbstractItemEditor", "DropEnabled"),
+ QT_TRANSLATE_NOOP("AbstractItemEditor", "UserCheckable"),
+ QT_TRANSLATE_NOOP("AbstractItemEditor", "Enabled"),
+ QT_TRANSLATE_NOOP("AbstractItemEditor", "Tristate"),
0
};
static const char * const checkStateNames[] = {
- "Unchecked",
- "PartiallyChecked",
- "Checked",
+ QT_TRANSLATE_NOOP("AbstractItemEditor", "Unchecked"),
+ QT_TRANSLATE_NOOP("AbstractItemEditor", "PartiallyChecked"),
+ QT_TRANSLATE_NOOP("AbstractItemEditor", "Checked"),
0
};
@@ -135,7 +135,7 @@ static QStringList c2qStringList(const char * const in[])
{
QStringList out;
for (int i = 0; in[i]; i++)
- out << QLatin1String(in[i]);
+ out << AbstractItemEditor::tr(in[i]);
return out;
}
diff --git a/tools/designer/src/lib/shared/plugindialog.cpp b/tools/designer/src/lib/shared/plugindialog.cpp
index 3e88043..63ba81c 100644
--- a/tools/designer/src/lib/shared/plugindialog.cpp
+++ b/tools/designer/src/lib/shared/plugindialog.cpp
@@ -102,7 +102,7 @@ void PluginDialog::populateTreeWidget()
const QStringList fileNames = pluginManager->registeredPlugins();
if (!fileNames.isEmpty()) {
- QTreeWidgetItem *topLevelItem = setTopLevelItem(QLatin1String("Loaded Plugins"));
+ QTreeWidgetItem *topLevelItem = setTopLevelItem(tr("Loaded Plugins"));
QFont boldFont = topLevelItem->font(0);
foreach (const QString &fileName, fileNames) {
@@ -125,7 +125,7 @@ void PluginDialog::populateTreeWidget()
const QStringList notLoadedPlugins = pluginManager->failedPlugins();
if (!notLoadedPlugins.isEmpty()) {
- QTreeWidgetItem *topLevelItem = setTopLevelItem(QLatin1String("Failed Plugins"));
+ QTreeWidgetItem *topLevelItem = setTopLevelItem(tr("Failed Plugins"));
const QFont boldFont = topLevelItem->font(0);
foreach (const QString &plugin, notLoadedPlugins) {
const QString failureReason = pluginManager->failureReason(plugin);
diff --git a/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp b/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp
index c508fa2..7f597ff 100644
--- a/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp
+++ b/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp
@@ -66,12 +66,12 @@ QString SeekSliderPlugin::group() const
QString SeekSliderPlugin::toolTip() const
{
- return QString(QLatin1String(toolTipC));
+ return tr(toolTipC);
}
QString SeekSliderPlugin::whatsThis() const
{
- return QString(QLatin1String(toolTipC));
+ return tr(toolTipC);
}
QString SeekSliderPlugin::includeFile() const
diff --git a/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp b/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp
index d4af121..489a08c 100644
--- a/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp
+++ b/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp
@@ -72,12 +72,12 @@ QString VideoPlayerPlugin::group() const
QString VideoPlayerPlugin::toolTip() const
{
- return QString(QLatin1String(toolTipC));
+ return tr(toolTipC);
}
QString VideoPlayerPlugin::whatsThis() const
{
- return QString(QLatin1String(toolTipC));
+ return tr(toolTipC);
}
QString VideoPlayerPlugin::includeFile() const
diff --git a/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp b/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp
index becd5d9..24eb829 100644
--- a/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp
+++ b/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp
@@ -66,12 +66,12 @@ QString VolumeSliderPlugin::group() const
QString VolumeSliderPlugin::toolTip() const
{
- return QString(QLatin1String(toolTipC));
+ return tr(toolTipC);
}
QString VolumeSliderPlugin::whatsThis() const
{
- return QString(QLatin1String(toolTipC));
+ return tr(toolTipC);
}
QString VolumeSliderPlugin::includeFile() const
diff --git a/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp b/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp
index b352a9b..7148ad0 100644
--- a/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp
+++ b/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp
@@ -69,12 +69,12 @@ QString QDeclarativeViewPlugin::group() const
QString QDeclarativeViewPlugin::toolTip() const
{
- return QString(QLatin1String(toolTipC));
+ return tr(toolTipC);
}
QString QDeclarativeViewPlugin::whatsThis() const
{
- return QString(QLatin1String(toolTipC));
+ return tr(toolTipC);
}
QString QDeclarativeViewPlugin::includeFile() const
diff --git a/tools/designer/src/plugins/qwebview/qwebview_plugin.cpp b/tools/designer/src/plugins/qwebview/qwebview_plugin.cpp
index 61f7e66..c90e191 100644
--- a/tools/designer/src/plugins/qwebview/qwebview_plugin.cpp
+++ b/tools/designer/src/plugins/qwebview/qwebview_plugin.cpp
@@ -69,12 +69,12 @@ QString QWebViewPlugin::group() const
QString QWebViewPlugin::toolTip() const
{
- return QString(QLatin1String(toolTipC));
+ return tr(toolTipC);
}
QString QWebViewPlugin::whatsThis() const
{
- return QString(QLatin1String(toolTipC));
+ return tr(toolTipC);
}
QString QWebViewPlugin::includeFile() const
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp
index e7c1d9a..d691548 100644
--- a/tools/linguist/lconvert/main.cpp
+++ b/tools/linguist/lconvert/main.cpp
@@ -52,6 +52,10 @@
QT_USE_NAMESPACE
+class LC {
+ Q_DECLARE_TR_FUNCTIONS(LConvert)
+};
+
static int usage(const QStringList &args)
{
Q_UNUSED(args);
@@ -61,7 +65,7 @@ static int usage(const QStringList &args)
foreach (Translator::FileFormat format, Translator::registeredFileFormats())
loaders += line.arg(format.extension, -5).arg(format.description);
- std::cerr << qPrintable(QString(QLatin1String("\nUsage:\n"
+ std::cerr << qPrintable(LC::tr("\nUsage:\n"
" lconvert [options] <infile> [<infile>...]\n\n"
"lconvert is part of Qt's Linguist tool chain. It can be used as a\n"
"stand-alone tool to convert and filter translation data files.\n"
@@ -123,7 +127,7 @@ static int usage(const QStringList &args)
" 0 on success\n"
" 1 on command line parse failures\n"
" 2 on read failures\n"
- " 3 on write failures\n")).arg(loaders));
+ " 3 on write failures\n").arg(loaders));
return 1;
}
diff --git a/tools/linguist/linguist/phrase.cpp b/tools/linguist/linguist/phrase.cpp
index 254daf4..709ec35 100644
--- a/tools/linguist/linguist/phrase.cpp
+++ b/tools/linguist/linguist/phrase.cpp
@@ -188,10 +188,9 @@ bool QphHandler::characters(const QString &ch)
bool QphHandler::fatalError(const QXmlParseException &exception)
{
if (ferrorCount++ == 0) {
- QString msg;
- msg.sprintf("Parse error at line %d, column %d (%s).",
- exception.lineNumber(), exception.columnNumber(),
- exception.message().toLatin1().constData());
+ QString msg = PhraseBook::tr("Parse error at line %1, column %2 (%3).")
+ .arg(exception.lineNumber()).arg(exception.columnNumber())
+ .arg(exception.message());
QMessageBox::information(0,
QObject::tr("Qt Linguist"), msg);
}
diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp
index 003d379..19377ef 100644
--- a/tools/linguist/lrelease/main.cpp
+++ b/tools/linguist/lrelease/main.cpp
@@ -65,6 +65,17 @@ static void initBinaryDir(
const char *argv0
#endif
);
+
+struct LR {
+ static inline QString tr(const char *sourceText, const char *comment = 0)
+ {
+ return QCoreApplication::translate("LRelease", sourceText, comment);
+ }
+};
+#else
+class LR {
+ Q_DECLARE_TR_FUNCTIONS(LRelease)
+};
#endif
static void printOut(const QString & out)
@@ -75,7 +86,7 @@ static void printOut(const QString & out)
static void printUsage()
{
- printOut(QCoreApplication::tr(
+ printOut(LR::tr(
"Usage:\n"
" lrelease [options] project-file\n"
" lrelease [options] ts-files [-qm qm-file]\n\n"
@@ -108,7 +119,7 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo
ConversionData cd;
bool ok = tor.load(tsFileName, cd, QLatin1String("auto"));
if (!ok) {
- std::cerr << "lrelease error: " << qPrintable(cd.error());
+ std::cerr << qPrintable(LR::tr("lrelease error: %1").arg(cd.error()));
} else {
if (!cd.errors().isEmpty())
printOut(cd.error());
@@ -123,17 +134,17 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName,
tor.reportDuplicates(tor.resolveDuplicates(), qmFileName, cd.isVerbose());
if (cd.isVerbose())
- printOut(QCoreApplication::tr( "Updating '%1'...\n").arg(qmFileName));
+ printOut(LR::tr("Updating '%1'...\n").arg(qmFileName));
if (removeIdentical) {
if (cd.isVerbose())
- printOut(QCoreApplication::tr( "Removing translations equal to source text in '%1'...\n").arg(qmFileName));
+ printOut(LR::tr("Removing translations equal to source text in '%1'...\n").arg(qmFileName));
tor.stripIdenticalSourceTranslations();
}
QFile file(qmFileName);
if (!file.open(QIODevice::WriteOnly)) {
- std::cerr << "lrelease error: cannot create '" << qPrintable(qmFileName)
- << "': " << qPrintable(file.errorString()) << std::endl;
+ std::cerr << qPrintable(LR::tr("lrelease error: cannot create '%1': %2\n")
+ .arg(qmFileName, file.errorString()));
return false;
}
@@ -142,8 +153,8 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName,
file.close();
if (!ok) {
- std::cerr << "lrelease error: cannot save '" << qPrintable(qmFileName)
- << "': " << qPrintable(cd.error());
+ std::cerr << qPrintable(LR::tr("lrelease error: cannot save '%1': %2")
+ .arg(qmFileName, cd.error()));
} else if (!cd.errors().isEmpty()) {
printOut(cd.error());
}
@@ -227,7 +238,7 @@ int main(int argc, char **argv)
cd.m_verbose = true;
continue;
} else if (!strcmp(argv[i], "-version")) {
- printOut(QCoreApplication::tr( "lrelease version %1\n").arg(QLatin1String(QT_VERSION_STR)) );
+ printOut(LR::tr("lrelease version %1\n").arg(QLatin1String(QT_VERSION_STR)));
return 0;
} else if (!strcmp(argv[i], "-qm")) {
if (i == argc - 1) {
@@ -261,20 +272,23 @@ int main(int argc, char **argv)
visitor.setVerbose(cd.isVerbose());
if (!visitor.queryProFile(&pro)) {
- std::cerr << "lrelease error: cannot read project file '"
- << qPrintable(inputFile) << "'.\n";
+ std::cerr << qPrintable(LR::tr(
+ "lrelease error: cannot read project file '%1'.\n")
+ .arg(inputFile));
continue;
}
if (!visitor.accept(&pro)) {
- std::cerr << "lrelease error: cannot process project file '"
- << qPrintable(inputFile) << "'.\n";
+ std::cerr << qPrintable(LR::tr(
+ "lrelease error: cannot process project file '%1'.\n")
+ .arg(inputFile));
continue;
}
QStringList translations = visitor.values(QLatin1String("TRANSLATIONS"));
if (translations.isEmpty()) {
- std::cerr << "lrelease warning: Met no 'TRANSLATIONS' entry in project file '"
- << qPrintable(inputFile) << "'\n";
+ std::cerr << qPrintable(LR::tr(
+ "lrelease warning: Met no 'TRANSLATIONS' entry in project file '%1'\n")
+ .arg(inputFile));
} else {
QDir proDir(fi.absolutePath());
foreach (const QString &trans, translations)
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index bc9bb26..970d44b 100644
--- a/tools/linguist/lupdate/cpp.cpp
+++ b/tools/linguist/lupdate/cpp.cpp
@@ -50,6 +50,7 @@
#include <QtCore/QString>
#include <QtCore/QTextCodec>
#include <QtCore/QTextStream>
+#include <QtCore/QCoreApplication>
#include <iostream>
@@ -57,6 +58,10 @@
QT_BEGIN_NAMESPACE
+class LU {
+ Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
+
/* qmake ignore Q_OBJECT */
static QString MagicComment(QLatin1String("TRANSLATOR"));
@@ -624,8 +629,8 @@ uint CppParser::getToken()
|| yyBraceDepth != is.braceDepth1st
|| yyParenDepth != is.parenDepth1st)
yyMsg(is.elseLine)
- << "Parenthesis/bracket/brace mismatch between "
- "#if and #else branches; using #if branch\n";
+ << qPrintable(LU::tr("Parenthesis/bracket/brace mismatch between "
+ "#if and #else branches; using #if branch\n"));
} else {
is.bracketDepth1st = yyBracketDepth;
is.braceDepth1st = yyBraceDepth;
@@ -647,8 +652,8 @@ uint CppParser::getToken()
|| yyBraceDepth != is.braceDepth1st
|| yyParenDepth != is.parenDepth1st)
yyMsg(is.elseLine)
- << "Parenthesis/brace mismatch between "
- "#if and #else branches; using #if branch\n";
+ << qPrintable(LU::tr("Parenthesis/brace mismatch between "
+ "#if and #else branches; using #if branch\n"));
yyBracketDepth = is.bracketDepth1st;
yyBraceDepth = is.braceDepth1st;
yyParenDepth = is.parenDepth1st;
@@ -674,7 +679,7 @@ uint CppParser::getToken()
forever {
yyCh = getChar();
if (yyCh == EOF) {
- yyMsg() << "Unterminated C++ comment\n";
+ yyMsg() << qPrintable(LU::tr("Unterminated C++ comment\n"));
break;
}
@@ -804,7 +809,7 @@ uint CppParser::getToken()
forever {
yyCh = getChar();
if (yyCh == EOF) {
- yyMsg() << "Unterminated C++ comment\n";
+ yyMsg() << qPrintable(LU::tr("Unterminated C++ comment\n"));
break;
}
*ptr++ = yyCh;
@@ -837,7 +842,7 @@ uint CppParser::getToken()
yyWord.resize(ptr - (ushort *)yyWord.unicode());
if (yyCh != '"')
- yyMsg() << "Unterminated C++ string\n";
+ yyMsg() << qPrintable(LU::tr("Unterminated C++ string\n"));
else
yyCh = getChar();
return Tok_String;
@@ -894,8 +899,8 @@ uint CppParser::getToken()
if (yyBraceDepth == yyMinBraceDepth) {
if (!inDefine)
yyMsg(yyCurLineNo)
- << "Excess closing brace in C++ code"
- " (or abuse of the C++ preprocessor)\n";
+ << qPrintable(LU::tr("Excess closing brace in C++ code"
+ " (or abuse of the C++ preprocessor)\n"));
// Avoid things getting messed up even more
yyCh = getChar();
return Tok_Semicolon;
@@ -912,8 +917,8 @@ uint CppParser::getToken()
case ')':
if (yyParenDepth == 0)
yyMsg(yyCurLineNo)
- << "Excess closing parenthesis in C++ code"
- " (or abuse of the C++ preprocessor)\n";
+ << qPrintable(LU::tr("Excess closing parenthesis in C++ code"
+ " (or abuse of the C++ preprocessor)\n"));
else
yyParenDepth--;
yyCh = getChar();
@@ -927,8 +932,8 @@ uint CppParser::getToken()
case ']':
if (yyBracketDepth == 0)
yyMsg(yyCurLineNo)
- << "Excess closing bracket in C++ code"
- " (or abuse of the C++ preprocessor)\n";
+ << qPrintable(LU::tr("Excess closing bracket in C++ code"
+ " (or abuse of the C++ preprocessor)\n"));
else
yyBracketDepth--;
yyCh = getChar();
@@ -1296,7 +1301,7 @@ void CppParser::processInclude(const QString &file, ConversionData &cd,
QString cleanFile = QDir::cleanPath(file);
if (inclusions.contains(cleanFile)) {
- yyMsg() << "circular inclusion of " << qPrintable(cleanFile) << std::endl;
+ yyMsg() << qPrintable(LU::tr("circular inclusion of %1\n").arg(cleanFile));
return;
}
@@ -1320,9 +1325,7 @@ void CppParser::processInclude(const QString &file, ConversionData &cd,
QFile f(cleanFile);
if (!f.open(QIODevice::ReadOnly)) {
- yyMsg()
- << "Cannot open " << qPrintable(cleanFile) << ": "
- << qPrintable(f.errorString()) << std::endl;
+ yyMsg() << qPrintable(LU::tr("Cannot open %1: %2\n").arg(cleanFile, f.errorString()));
return;
}
@@ -1766,7 +1769,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
if (!tor)
goto case_default;
if (!sourcetext.isEmpty())
- yyMsg() << "//% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n";
+ yyMsg() << qPrintable(LU::tr("//% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n"));
utf8 = (yyTok == Tok_trUtf8);
line = yyLineNo;
yyTok = getToken();
@@ -1787,9 +1790,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
QStringList unresolved;
if (!fullyQualify(namespaces, pendingContext, true, &functionContext, &unresolved)) {
functionContextUnresolved = unresolved.join(strColons);
- yyMsg() << "Qualifying with unknown namespace/class "
- << qPrintable(stringifyNamespace(functionContext)) << "::"
- << qPrintable(unresolved.first()) << std::endl;
+ yyMsg() << qPrintable(LU::tr("Qualifying with unknown namespace/class %1::%2\n")
+ .arg(stringifyNamespace(functionContext)).arg(unresolved.first()));
}
pendingContext.clear();
}
@@ -1797,7 +1799,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
if (functionContextUnresolved.isEmpty()) {
int idx = functionContext.length();
if (idx < 2) {
- yyMsg() << "tr() cannot be called without context\n";
+ yyMsg() << qPrintable(LU::tr("tr() cannot be called without context\n"));
break;
}
Namespace *fctx;
@@ -1806,8 +1808,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
context = stringifyNamespace(functionContext);
fctx = findNamespace(functionContext)->classDef;
if (!fctx->complained) {
- yyMsg() << "Class '" << qPrintable(context)
- << "' lacks Q_OBJECT macro\n";
+ yyMsg() << qPrintable(LU::tr("Class '%1' lacks Q_OBJECT macro\n")
+ .arg(context));
fctx->complained = true;
}
goto gotctx;
@@ -1835,8 +1837,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
int last = prefix.lastIndexOf(strColons);
QString className = prefix.mid(last == -1 ? 0 : last + 2);
if (!className.isEmpty() && className == functionName) {
- yyMsg() << "It is not recommended to call tr() from within a constructor '"
- << qPrintable(className) << "::" << qPrintable(functionName) << "'\n";
+ yyMsg() << qPrintable(LU::tr("It is not recommended to call tr() from within a constructor '%1::%2'\n")
+ .arg(className).arg(functionName));
}
#endif
prefix.chop(2);
@@ -1851,7 +1853,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
context = fctx->trQualification;
}
if (!fctx->hasTrFunctions && !fctx->complained) {
- yyMsg() << "Class '" << qPrintable(context) << "' lacks Q_OBJECT macro\n";
+ yyMsg() << qPrintable(LU::tr("Class '%1' lacks Q_OBJECT macro\n").arg(context));
fctx->complained = true;
}
} else {
@@ -1873,7 +1875,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
if (!tor)
goto case_default;
if (!sourcetext.isEmpty())
- yyMsg() << "//% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n";
+ yyMsg() << qPrintable(LU::tr("//% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n"));
utf8 = (yyTok == Tok_translateUtf8);
line = yyLineNo;
yyTok = getToken();
@@ -1928,7 +1930,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
if (!tor)
goto case_default;
if (!msgid.isEmpty())
- yyMsg() << "//= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n";
+ yyMsg() << qPrintable(LU::tr("//= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n"));
//utf8 = false; // Maybe use //%% or something like that
line = yyLineNo;
yyTok = getToken();
@@ -1995,13 +1997,13 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
if (isspace(c))
continue;
if (c != '"') {
- yyMsg() << "Unexpected character in meta string\n";
+ yyMsg() << qPrintable(LU::tr("Unexpected character in meta string\n"));
break;
}
forever {
if (p >= yyWord.length()) {
whoops:
- yyMsg() << "Unterminated meta string\n";
+ yyMsg() << qPrintable(LU::tr("Unterminated meta string\n"));
break;
}
c = yyWord.unicode()[p++].unicode();
@@ -2054,7 +2056,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
case Tok_Arrow:
yyTok = getToken();
if (yyTok == Tok_tr || yyTok == Tok_trUtf8)
- yyMsg() << "Cannot invoke tr() like this\n";
+ yyMsg() << qPrintable(LU::tr("Cannot invoke tr() like this\n"));
break;
case Tok_ColonColon:
if (yyBraceDepth == namespaceDepths.count() && yyParenDepth == 0 && !yyTokColonSeen)
@@ -2087,7 +2089,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
prospectiveContext.clear();
prefix.clear();
if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) {
- yyMsg() << "Discarding unconsumed meta data\n";
+ yyMsg() << qPrintable(LU::tr("Discarding unconsumed meta data\n"));
sourcetext.clear();
extracomment.clear();
msgid.clear();
@@ -2127,16 +2129,16 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
if (yyBraceDepth != 0)
yyMsg(yyBraceLineNo)
- << "Unbalanced opening brace in C++ code"
- " (or abuse of the C++ preprocessor)\n";
+ << qPrintable(LU::tr("Unbalanced opening brace in C++ code"
+ " (or abuse of the C++ preprocessor)\n"));
else if (yyParenDepth != 0)
yyMsg(yyParenLineNo)
- << "Unbalanced opening parenthesis in C++ code"
- " (or abuse of the C++ preprocessor)\n";
+ << qPrintable(LU::tr("Unbalanced opening parenthesis in C++ code"
+ " (or abuse of the C++ preprocessor)\n"));
else if (yyBracketDepth != 0)
yyMsg(yyBracketLineNo)
- << "Unbalanced opening bracket in C++ code"
- " (or abuse of the C++ preprocessor)\n";
+ << qPrintable(LU::tr("Unbalanced opening bracket in C++ code"
+ " (or abuse of the C++ preprocessor)\n"));
}
const ParseResults *CppParser::recordResults(bool isHeader)
@@ -2197,8 +2199,7 @@ void loadCPP(Translator &translator, const QStringList &filenames, ConversionDat
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
- cd.appendError(QString::fromLatin1("Cannot open %1: %2")
- .arg(filename, file.errorString()));
+ cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
continue;
}
diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp
index dc66e2b..165b6a3 100644
--- a/tools/linguist/lupdate/java.cpp
+++ b/tools/linguist/lupdate/java.cpp
@@ -50,6 +50,7 @@
#include <QtCore/QStack>
#include <QtCore/QString>
#include <QtCore/QTextCodec>
+#include <QtCore/QCoreApplication>
#include <iostream>
@@ -57,6 +58,10 @@
QT_BEGIN_NAMESPACE
+class LU {
+ Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
+
enum { Tok_Eof, Tok_class, Tok_return, Tok_tr,
Tok_translate, Tok_Ident, Tok_Package,
Tok_Comment, Tok_String, Tok_Colon, Tok_Dot,
@@ -196,7 +201,7 @@ static int getToken()
while ( !metAsterSlash ) {
yyCh = getChar();
if ( yyCh == EOF ) {
- yyMsg() << "Unterminated Java comment.\n";
+ yyMsg() << qPrintable(LU::tr("Unterminated Java comment.\n"));
return Tok_Comment;
}
@@ -232,7 +237,7 @@ static int getToken()
else {
int sub(yyCh.toLower().toAscii() - 87);
if( sub > 15 || sub < 10) {
- yyMsg() << "Invalid Unicode value.\n";
+ yyMsg() << qPrintable(LU::tr("Invalid Unicode value.\n"));
break;
}
unicode += sub;
@@ -255,7 +260,7 @@ static int getToken()
}
if ( yyCh != QLatin1Char('"') )
- yyMsg() << "Unterminated string.\n";
+ yyMsg() << qPrintable(LU::tr("Unterminated string.\n"));
yyCh = getChar();
@@ -368,8 +373,9 @@ static bool matchString( QString &s )
if (yyTok == Tok_String)
s += yyString;
else {
- yyMsg() << "String used in translation can contain only literals"
- " concatenated with other literals, not expressions or numbers.\n";
+ yyMsg() << qPrintable(LU::tr(
+ "String used in translation can contain only literals"
+ " concatenated with other literals, not expressions or numbers.\n"));
return false;
}
yyTok = getToken();
@@ -477,7 +483,7 @@ static void parse( Translator *tor )
yyScope.push(new Scope(yyIdent, Scope::Clazz, yyLineNo));
}
else {
- yyMsg() << "'class' must be followed by a class name.\n";
+ yyMsg() << qPrintable(LU::tr("'class' must be followed by a class name.\n"));
break;
}
while (!match(Tok_LeftBrace)) {
@@ -549,7 +555,7 @@ static void parse( Translator *tor )
case Tok_RightBrace:
if ( yyScope.isEmpty() ) {
- yyMsg() << "Excess closing brace.\n";
+ yyMsg() << qPrintable(LU::tr("Excess closing brace.\n"));
}
else
delete (yyScope.pop());
@@ -578,7 +584,7 @@ static void parse( Translator *tor )
yyPackage.append(QLatin1String("."));
break;
default:
- yyMsg() << "'package' must be followed by package name.\n";
+ yyMsg() << qPrintable(LU::tr("'package' must be followed by package name.\n"));
break;
}
yyTok = getToken();
@@ -591,9 +597,9 @@ static void parse( Translator *tor )
}
if ( !yyScope.isEmpty() )
- yyMsg(yyScope.top()->line) << "Unbalanced opening brace.\n";
+ yyMsg(yyScope.top()->line) << qPrintable(LU::tr("Unbalanced opening brace.\n"));
else if ( yyParenDepth != 0 )
- yyMsg(yyParenLineNo) << "Unbalanced opening parenthesis.\n";
+ yyMsg(yyParenLineNo) << qPrintable(LU::tr("Unbalanced opening parenthesis.\n"));
}
@@ -601,8 +607,7 @@ bool loadJava(Translator &translator, const QString &filename, ConversionData &c
{
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
- cd.appendError(QString::fromLatin1("Cannot open %1: %2")
- .arg(filename, file.errorString()));
+ cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
return false;
}
diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp
index 0ff5288..d96e205 100644
--- a/tools/linguist/lupdate/main.cpp
+++ b/tools/linguist/lupdate/main.cpp
@@ -81,7 +81,7 @@ static void recursiveFileInfoList(const QDir &dir,
static void printUsage()
{
- printOut(QObject::tr(
+ printOut(LU::tr(
"Usage:\n"
" lupdate [options] [project-file]...\n"
" lupdate [options] [source-file|path|@lst-file]... -ts ts-files|@lst-file\n\n"
@@ -188,7 +188,7 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil
else if (options & AbsoluteLocations)
tor.setLocationsType(Translator::AbsoluteLocations);
if (options & Verbose)
- printOut(QObject::tr("Updating '%1'...\n").arg(fn));
+ printOut(LU::tr("Updating '%1'...\n").arg(fn));
UpdateOptions theseOptions = options;
if (tor.locationsType() == Translator::NoLocations) // Could be set from file
@@ -203,7 +203,7 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil
}
if (options & PluralOnly) {
if (options & Verbose)
- printOut(QObject::tr("Stripping non plural forms in '%1'...\n").arg(fn));
+ printOut(LU::tr("Stripping non plural forms in '%1'...\n").arg(fn));
out.stripNonPluralForms();
}
if (options & NoObsolete)
@@ -361,12 +361,12 @@ static void processProjects(
if (visitor.contains(QLatin1String("TRANSLATIONS"))) {
if (parentTor) {
if (topLevel) {
- std::cerr << "lupdate warning: TS files from command line "
- "will override TRANSLATIONS in " << qPrintable(proFile) << ".\n";
+ std::cerr << qPrintable(LU::tr("lupdate warning: TS files from command line "
+ "will override TRANSLATIONS in %1.\n").arg(proFile));
goto noTrans;
} else if (nestComplain) {
- std::cerr << "lupdate warning: TS files from command line "
- "prevent recursing into " << qPrintable(proFile) << ".\n";
+ std::cerr << qPrintable(LU::tr("lupdate warning: TS files from command line "
+ "prevent recursing into %1.\n").arg(proFile));
continue;
}
}
@@ -397,8 +397,8 @@ static void processProjects(
noTrans:
if (!parentTor) {
if (topLevel)
- std::cerr << "lupdate warning: no TS files specified. Only diagnostics "
- "will be produced for '" << qPrintable(proFile) << "'.\n";
+ std::cerr << qPrintable(LU::tr("lupdate warning: no TS files specified. Only diagnostics "
+ "will be produced for '%1'.\n").arg(proFile));
Translator tor;
processProject(nestComplain, pfi, visitor, options, codecForSource,
targetLanguage, sourceLanguage, &tor, fail);
@@ -625,7 +625,7 @@ int main(int argc, char **argv)
proFiles << file;
} else if (fi.isDir()) {
if (options & Verbose)
- printOut(QObject::tr("Scanning directory '%1'...\n").arg(file));
+ printOut(LU::tr("Scanning directory '%1'...\n").arg(file));
QDir dir = QDir(fi.filePath());
projectRoots.insert(dir.absolutePath() + QLatin1Char('/'));
if (extensionsNameFilters.isEmpty()) {
diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp
index fffdf9b..87c150c 100644
--- a/tools/linguist/lupdate/merge.cpp
+++ b/tools/linguist/lupdate/merge.cpp
@@ -44,15 +44,19 @@
#include "simtexth.h"
#include "translator.h"
+#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtCore/QMap>
#include <QtCore/QStringList>
#include <QtCore/QTextCodec>
#include <QtCore/QVector>
-
QT_BEGIN_NAMESPACE
+class LU {
+ Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
+
static bool isDigitFriendly(QChar c)
{
return c.isPunct() || c.isSpace();
@@ -485,24 +489,24 @@ Translator merge(const Translator &tor, const Translator &virginTor,
if (options & Verbose) {
int totalFound = neww + known;
- err += QObject::tr(" Found %n source text(s) (%1 new and %2 already existing)\n", 0, totalFound).arg(neww).arg(known);
+ err += LU::tr(" Found %n source text(s) (%1 new and %2 already existing)\n", 0, totalFound).arg(neww).arg(known);
if (obsoleted) {
if (options & NoObsolete) {
- err += QObject::tr(" Removed %n obsolete entries\n", 0, obsoleted);
+ err += LU::tr(" Removed %n obsolete entries\n", 0, obsoleted);
} else {
- err += QObject::tr(" Kept %n obsolete entries\n", 0, obsoleted);
+ err += LU::tr(" Kept %n obsolete entries\n", 0, obsoleted);
}
}
if (sameNumberHeuristicCount)
- err += QObject::tr(" Number heuristic provided %n translation(s)\n",
+ err += LU::tr(" Number heuristic provided %n translation(s)\n",
0, sameNumberHeuristicCount);
if (sameTextHeuristicCount)
- err += QObject::tr(" Same-text heuristic provided %n translation(s)\n",
+ err += LU::tr(" Same-text heuristic provided %n translation(s)\n",
0, sameTextHeuristicCount);
if (similarTextHeuristicCount)
- err += QObject::tr(" Similar-text heuristic provided %n translation(s)\n",
+ err += LU::tr(" Similar-text heuristic provided %n translation(s)\n",
0, similarTextHeuristicCount);
}
return outTor;
diff --git a/tools/linguist/lupdate/qdeclarative.cpp b/tools/linguist/lupdate/qdeclarative.cpp
index 2377416..ffcbf20 100644
--- a/tools/linguist/lupdate/qdeclarative.cpp
+++ b/tools/linguist/lupdate/qdeclarative.cpp
@@ -65,6 +65,10 @@
QT_BEGIN_NAMESPACE
+class LU {
+ Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
+
using namespace QDeclarativeJS;
class FindTrCalls: protected AST::Visitor
@@ -241,8 +245,7 @@ bool loadQml(Translator &translator, const QString &filename, ConversionData &cd
cd.m_sourceFileName = filename;
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
- cd.appendError(QString::fromLatin1("Cannot open %1: %2")
- .arg(filename, file.errorString()));
+ cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
return false;
}
diff --git a/tools/linguist/lupdate/qscript.cpp b/tools/linguist/lupdate/qscript.cpp
index 7ca0987..5323022 100644
--- a/tools/linguist/lupdate/qscript.cpp
+++ b/tools/linguist/lupdate/qscript.cpp
@@ -47,6 +47,7 @@
#include <translator.h>
+#include <QtCore/QCoreApplication>
#include <QtCore/qdebug.h>
#include <QtCore/qnumeric.h>
#include <QtCore/qstring.h>
@@ -62,6 +63,10 @@
QT_BEGIN_NAMESPACE
+class LU {
+ Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
+
class QScriptGrammar
{
public:
@@ -1486,7 +1491,7 @@ int QScript::Lexer::lex()
else {
setDone(Bad);
err = IllegalCharacter;
- errmsg = QLatin1String("Illegal character");
+ errmsg = LU::tr("Illegal character");
}
}
break;
@@ -1497,7 +1502,7 @@ int QScript::Lexer::lex()
} else if (current == 0 || isLineTerminator()) {
setDone(Bad);
err = UnclosedStringLiteral;
- errmsg = QLatin1String("Unclosed string at end of line");
+ errmsg = LU::tr("Unclosed string at end of line");
} else if (current == '\\') {
state = InEscapeSequence;
} else {
@@ -1523,7 +1528,7 @@ int QScript::Lexer::lex()
} else {
setDone(Bad);
err = IllegalEscapeSequence;
- errmsg = QLatin1String("Illegal escape squence");
+ errmsg = LU::tr("Illegal escape squence");
}
} else if (current == 'x')
state = InHexEscape;
@@ -1562,7 +1567,7 @@ int QScript::Lexer::lex()
} else {
setDone(Bad);
err = IllegalUnicodeEscapeSequence;
- errmsg = QLatin1String("Illegal unicode escape sequence");
+ errmsg = LU::tr("Illegal unicode escape sequence");
}
break;
case InSingleLineComment:
@@ -1590,7 +1595,7 @@ int QScript::Lexer::lex()
if (current == 0) {
setDone(Bad);
err = UnclosedComment;
- errmsg = QLatin1String("Unclosed comment at end of file");
+ errmsg = LU::tr("Unclosed comment at end of file");
} else if (isLineTerminator()) {
shiftWindowsLineBreak();
yylineno++;
@@ -1678,7 +1683,7 @@ int QScript::Lexer::lex()
} else {
setDone(Bad);
err = IllegalExponentIndicator;
- errmsg = QLatin1String("Illegal syntax for exponential number");
+ errmsg = LU::tr("Illegal syntax for exponential number");
}
break;
case InExponent:
@@ -1704,7 +1709,7 @@ int QScript::Lexer::lex()
&& isIdentLetter(current)) {
state = Bad;
err = IllegalIdentifier;
- errmsg = QLatin1String("Identifier cannot start with numeric literal");
+ errmsg = LU::tr("Identifier cannot start with numeric literal");
}
// terminate string
@@ -2023,7 +2028,7 @@ bool QScript::Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (1) {
if (isLineTerminator() || current == 0) {
- errmsg = QLatin1String("Unterminated regular expression literal");
+ errmsg = LU::tr("Unterminated regular expression literal");
return false;
}
else if (current != '/' || lastWasEscape == true)
@@ -2267,14 +2272,14 @@ case 66: {
QString name = sym(1).toString();
if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) {
if (!sourcetext.isEmpty())
- yyMsg(identLineNo) << "//% cannot be used with " << qPrintable(name) << "(). Ignoring\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name));
QVariantList args = sym(2).toList();
if (args.size() < 2) {
- yyMsg(identLineNo) << qPrintable(name) << "() requires at least two arguments.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least two arguments.\n").arg(name));
} else {
if ((args.at(0).type() != QVariant::String)
|| (args.at(1).type() != QVariant::String)) {
- yyMsg(identLineNo) << qPrintable(name) << "(): both arguments must be literal strings.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1(): both arguments must be literal strings.\n").arg(name));
} else {
QString context = args.at(0).toString();
QString text = args.at(1).toString();
@@ -2290,13 +2295,13 @@ case 66: {
extra.clear();
} else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) {
if (!sourcetext.isEmpty())
- yyMsg(identLineNo) << "//% cannot be used with " << qPrintable(name) << "(). Ignoring\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name));
QVariantList args = sym(2).toList();
if (args.size() < 1) {
- yyMsg(identLineNo) << qPrintable(name) << "() requires at least one argument.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name));
} else {
if (args.at(0).type() != QVariant::String) {
- yyMsg(identLineNo) << qPrintable(name) << "(): text to translate must be a literal string.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1(): text to translate must be a literal string.\n").arg(name));
} else {
QString context = QFileInfo(fileName()).baseName();
QString text = args.at(0).toString();
@@ -2312,13 +2317,13 @@ case 66: {
extra.clear();
} else if ((name == QLatin1String("qsTrId")) || (name == QLatin1String("QT_TRID_NOOP"))) {
if (!msgid.isEmpty())
- yyMsg(identLineNo) << "//= cannot be used with " << qPrintable(name) << "(). Ignoring\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("//= cannot be used with %1(). Ignoring\n").arg(name));
QVariantList args = sym(2).toList();
if (args.size() < 1) {
- yyMsg(identLineNo) << qPrintable(name) << "() requires at least one argument.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name));
} else {
if (args.at(0).type() != QVariant::String) {
- yyMsg(identLineNo) << qPrintable(name) << "(): identifier must be a literal string.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1(): identifier must be a literal string.\n").arg(name));
} else {
msgid = args.at(0).toString();
bool plural = (args.size() > 1);
@@ -2386,7 +2391,7 @@ case 94: {
case 185:
if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) {
- yyMsg() << "Discarding unconsumed meta data\n";
+ yyMsg() << qPrintable(LU::tr("Discarding unconsumed meta data\n"));
sourcetext.clear();
extracomment.clear();
msgid.clear();
@@ -2448,7 +2453,9 @@ case 94: {
for (int s = 0; s < shifts; ++s)
{
if (first)
- error_message += QLatin1String ("Expected ");
+ //: Beginning of the string that contains
+ //: comma-separated list of expected tokens
+ error_message += LU::tr("Expected ");
else
error_message += QLatin1String (", ");
@@ -2502,13 +2509,13 @@ void QScriptParser::processComment(const QChar *chars, int length)
if (isspace(c))
continue;
if (c != '"') {
- yyMsg() << "Unexpected character in meta string\n";
+ yyMsg() << qPrintable(LU::tr("Unexpected character in meta string\n"));
break;
}
forever {
if (p >= length) {
whoops:
- yyMsg() << "Unterminated meta string\n";
+ yyMsg() << qPrintable(LU::tr("Unterminated meta string\n"));
break;
}
c = chars[p++].unicode();
@@ -2534,8 +2541,7 @@ bool loadQScript(Translator &translator, const QString &filename, ConversionData
{
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
- cd.appendError(QString::fromLatin1("Cannot open %1: %2")
- .arg(filename, file.errorString()));
+ cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
return false;
}
QTextStream ts(&file);
diff --git a/tools/linguist/lupdate/qscript.g b/tools/linguist/lupdate/qscript.g
index e4c2d22..3655f2e 100644
--- a/tools/linguist/lupdate/qscript.g
+++ b/tools/linguist/lupdate/qscript.g
@@ -84,6 +84,7 @@
/.
#include <translator.h>
+#include <QtCore/QCoreApplication>
#include <QtCore/qdebug.h>
#include <QtCore/qnumeric.h>
#include <QtCore/qstring.h>
@@ -99,6 +100,10 @@
QT_BEGIN_NAMESPACE
+class LU {
+ Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
+
static void recordMessage(
Translator *tor, const QString &context, const QString &text, const QString &comment,
const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra,
@@ -817,7 +822,7 @@ int QScript::Lexer::lex()
else {
setDone(Bad);
err = IllegalCharacter;
- errmsg = QLatin1String("Illegal character");
+ errmsg = LU::tr("Illegal character");
}
}
break;
@@ -828,7 +833,7 @@ int QScript::Lexer::lex()
} else if (current == 0 || isLineTerminator()) {
setDone(Bad);
err = UnclosedStringLiteral;
- errmsg = QLatin1String("Unclosed string at end of line");
+ errmsg = LU::tr("Unclosed string at end of line");
} else if (current == '\\') {
state = InEscapeSequence;
} else {
@@ -854,7 +859,7 @@ int QScript::Lexer::lex()
} else {
setDone(Bad);
err = IllegalEscapeSequence;
- errmsg = QLatin1String("Illegal escape squence");
+ errmsg = LU::tr("Illegal escape squence");
}
} else if (current == 'x')
state = InHexEscape;
@@ -893,7 +898,7 @@ int QScript::Lexer::lex()
} else {
setDone(Bad);
err = IllegalUnicodeEscapeSequence;
- errmsg = QLatin1String("Illegal unicode escape sequence");
+ errmsg = LU::tr("Illegal unicode escape sequence");
}
break;
case InSingleLineComment:
@@ -921,7 +926,7 @@ int QScript::Lexer::lex()
if (current == 0) {
setDone(Bad);
err = UnclosedComment;
- errmsg = QLatin1String("Unclosed comment at end of file");
+ errmsg = LU::tr("Unclosed comment at end of file");
} else if (isLineTerminator()) {
shiftWindowsLineBreak();
yylineno++;
@@ -1009,7 +1014,7 @@ int QScript::Lexer::lex()
} else {
setDone(Bad);
err = IllegalExponentIndicator;
- errmsg = QLatin1String("Illegal syntax for exponential number");
+ errmsg = LU::tr("Illegal syntax for exponential number");
}
break;
case InExponent:
@@ -1035,7 +1040,7 @@ int QScript::Lexer::lex()
&& isIdentLetter(current)) {
state = Bad;
err = IllegalIdentifier;
- errmsg = QLatin1String("Identifier cannot start with numeric literal");
+ errmsg = LU::tr("Identifier cannot start with numeric literal");
}
// terminate string
@@ -1354,7 +1359,7 @@ bool QScript::Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (1) {
if (isLineTerminator() || current == 0) {
- errmsg = QLatin1String("Unterminated regular expression literal");
+ errmsg = LU::tr("Unterminated regular expression literal");
return false;
}
else if (current != '/' || lastWasEscape == true)
@@ -1683,14 +1688,14 @@ case $rule_number: {
QString name = sym(1).toString();
if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) {
if (!sourcetext.isEmpty())
- yyMsg(identLineNo) << "//% cannot be used with " << qPrintable(name) << "(). Ignoring\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name));
QVariantList args = sym(2).toList();
if (args.size() < 2) {
- yyMsg(identLineNo) << qPrintable(name) << "() requires at least two arguments.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least two arguments.\n").arg(name));
} else {
if ((args.at(0).type() != QVariant::String)
|| (args.at(1).type() != QVariant::String)) {
- yyMsg(identLineNo) << qPrintable(name) << "(): both arguments must be literal strings.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1(): both arguments must be literal strings.\n").arg(name));
} else {
QString context = args.at(0).toString();
QString text = args.at(1).toString();
@@ -1706,13 +1711,13 @@ case $rule_number: {
extra.clear();
} else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) {
if (!sourcetext.isEmpty())
- yyMsg(identLineNo) << "//% cannot be used with " << qPrintable(name) << "(). Ignoring\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name));
QVariantList args = sym(2).toList();
if (args.size() < 1) {
- yyMsg(identLineNo) << qPrintable(name) << "() requires at least one argument.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name));
} else {
if (args.at(0).type() != QVariant::String) {
- yyMsg(identLineNo) << qPrintable(name) << "(): text to translate must be a literal string.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1(): text to translate must be a literal string.\n").arg(name));
} else {
QString context = QFileInfo(fileName()).baseName();
QString text = args.at(0).toString();
@@ -1728,13 +1733,13 @@ case $rule_number: {
extra.clear();
} else if ((name == QLatin1String("qsTrId")) || (name == QLatin1String("QT_TRID_NOOP"))) {
if (!msgid.isEmpty())
- yyMsg(identLineNo) << "//= cannot be used with " << qPrintable(name) << "(). Ignoring\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("//= cannot be used with %1(). Ignoring\n").arg(name));
QVariantList args = sym(2).toList();
if (args.size() < 1) {
- yyMsg(identLineNo) << qPrintable(name) << "() requires at least one argument.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name));
} else {
if (args.at(0).type() != QVariant::String) {
- yyMsg(identLineNo) << qPrintable(name) << "(): identifier must be a literal string.\n";
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1(): identifier must be a literal string.\n").arg(name));
} else {
msgid = args.at(0).toString();
bool plural = (args.size() > 1);
@@ -1950,7 +1955,7 @@ Statement: DebuggerStatement ;
/.
case $rule_number:
if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) {
- yyMsg() << "Discarding unconsumed meta data\n";
+ yyMsg() << qPrintable(LU::tr("Discarding unconsumed meta data\n"));
sourcetext.clear();
extracomment.clear();
msgid.clear();
@@ -2096,6 +2101,9 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
{
if (first)
error_message += QLatin1String ("Expected ");
+ //: Beginning of the string that contains
+ //: comma-separated list of expected tokens
+ error_message += LU::tr("Expected ");
else
error_message += QLatin1String (", ");
@@ -2149,13 +2157,13 @@ void QScriptParser::processComment(const QChar *chars, int length)
if (isspace(c))
continue;
if (c != '"') {
- yyMsg() << "Unexpected character in meta string\n";
+ yyMsg() << qPrintable(LU::tr("Unexpected character in meta string\n"));
break;
}
forever {
if (p >= length) {
whoops:
- yyMsg() << "Unterminated meta string\n";
+ yyMsg() << qPrintable(LU::tr("Unterminated meta string\n"));
break;
}
c = chars[p++].unicode();
@@ -2181,8 +2189,7 @@ bool loadQScript(Translator &translator, const QString &filename, ConversionData
{
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
- cd.appendError(QString::fromLatin1("Cannot open %1: %2")
- .arg(filename, file.errorString()));
+ cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
return false;
}
QTextStream ts(&file);
diff --git a/tools/linguist/lupdate/ui.cpp b/tools/linguist/lupdate/ui.cpp
index 9e22922..797ab1f 100644
--- a/tools/linguist/lupdate/ui.cpp
+++ b/tools/linguist/lupdate/ui.cpp
@@ -43,6 +43,7 @@
#include <translator.h>
+#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtCore/QFile>
#include <QtCore/QString>
@@ -55,6 +56,10 @@
QT_BEGIN_NAMESPACE
+class LU {
+ Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
+
class UiReader : public QXmlDefaultHandler
{
public:
@@ -152,11 +157,10 @@ bool UiReader::characters(const QString &ch)
bool UiReader::fatalError(const QXmlParseException &exception)
{
- QString msg;
- msg.sprintf("XML error: Parse error at line %d, column %d (%s).",
- exception.lineNumber(), exception.columnNumber(),
- exception.message().toLatin1().data());
- m_cd.appendError(msg);
+ QString msg = LU::tr("XML error: Parse error at line %1, column %2 (%3).")
+ .arg(exception.lineNumber()).arg(exception.columnNumber())
+ .arg(exception.message());
+ m_cd.appendError(msg);
return false;
}
@@ -181,8 +185,7 @@ bool loadUI(Translator &translator, const QString &filename, ConversionData &cd)
cd.m_sourceFileName = filename;
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
- cd.appendError(QString::fromLatin1("Cannot open %1: %2")
- .arg(filename, file.errorString()));
+ cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
return false;
}
QXmlInputSource in(&file);
@@ -196,7 +199,7 @@ bool loadUI(Translator &translator, const QString &filename, ConversionData &cd)
reader.setErrorHandler(&handler);
bool result = reader.parse(in);
if (!result)
- cd.appendError(QLatin1String("Parse error in UI file"));
+ cd.appendError(LU::tr("Parse error in UI file"));
reader.setContentHandler(0);
reader.setErrorHandler(0);
return result;