L10n: tr()-Fixes.

This commit is contained in:
Friedemann Kleint
2011-03-07 17:20:10 +01:00
parent 0da97d73ec
commit 5c3596e935
8 changed files with 88 additions and 60 deletions

View File

@@ -42,13 +42,13 @@
#include "suppression.h"
#include <utils/qtcassert.h>
#include <QAbstractSocket>
#include <QCoreApplication>
#include <QHash>
#include <QIODevice>
#include <QPair>
#include <QThread>
#include <QXmlStreamReader>
#include <QtNetwork/QAbstractSocket>
#include <QtCore/QCoreApplication>
#include <QtCore/QHash>
#include <QtCore/QIODevice>
#include <QtCore/QPair>
#include <QtCore/QThread>
#include <QtCore/QXmlStreamReader>
using namespace Valgrind;
using namespace Valgrind::XmlProtocol;
@@ -194,7 +194,8 @@ static quint64 parseHex(const QString &str, const QString &context)
bool ok;
const quint64 v = str.toULongLong(&ok, 16);
if (!ok)
throw ParserException(QObject::tr("Could not parse hex number from \"%1\" (%2)").arg(str, context));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Could not parse hex number from \"%1\" (%2)").arg(str, context));
return v;
}
@@ -203,7 +204,8 @@ static qint64 parseInt64(const QString &str, const QString &context)
bool ok;
const quint64 v = str.toLongLong(&ok);
if (!ok)
throw ParserException(QObject::tr("Could not parse hex number from \"%1\" (%2)").arg(str, context));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Could not parse hex number from \"%1\" (%2)").arg(str, context));
return v;
}
@@ -262,7 +264,8 @@ QString Parser::Private::blockingReadElementText()
//affects at least Qt <= 4.7.1. Reported as QTBUG-14661.
if (!reader.isStartElement())
throw ParserException(QObject::tr("trying to read element text although current position is not start of element"));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"trying to read element text although current position is not start of element"));
QString result;
@@ -279,10 +282,12 @@ QString Parser::Private::blockingReadElementText()
case QXmlStreamReader::Comment:
break;
case QXmlStreamReader::StartElement:
throw ParserException(QObject::tr("Unexpected child element while reading element text"));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unexpected child element while reading element text"));
default:
//TODO handle
throw ParserException(QObject::tr("Unexpected token type %1").arg(type));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unexpected token type %1").arg(type));
break;
}
}
@@ -294,9 +299,11 @@ void Parser::Private::checkProtocolVersion(const QString &versionStr)
bool ok;
const int version = versionStr.toInt(&ok);
if (!ok)
throw ParserException(QObject::tr("Could not parse protocol version from \"%1\"").arg(versionStr));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Could not parse protocol version from \"%1\"").arg(versionStr));
if (version != 4)
throw ParserException(QObject::tr("XmlProtocol version %1 not supported (supported version: 4)").arg(version));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"XmlProtocol version %1 not supported (supported version: 4)").arg(version));
}
void Parser::Private::checkTool(const QString &reportedStr)
@@ -304,7 +311,8 @@ void Parser::Private::checkTool(const QString &reportedStr)
const QHash<QString,Parser::Tool>::ConstIterator reported = toolsByName.find(reportedStr);
if (reported == toolsByName.constEnd())
throw ParserException(QObject::tr("Valgrind tool \"%1\" not supported").arg(reportedStr));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Valgrind tool \"%1\" not supported").arg(reportedStr));
tool = reported.value();
}
@@ -361,7 +369,8 @@ MemcheckErrorKind Parser::Private::parseMemcheckErrorKind(const QString &kind)
if (it != errorKindsByName_memcheck.constEnd())
return *it;
else
throw ParserException(QObject::tr("Unknown memcheck error kind \"%1\"").arg(kind));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unknown memcheck error kind \"%1\"").arg(kind));
}
HelgrindErrorKind Parser::Private::parseHelgrindErrorKind(const QString &kind)
@@ -370,7 +379,8 @@ HelgrindErrorKind Parser::Private::parseHelgrindErrorKind(const QString &kind)
if (it != errorKindsByName_helgrind.constEnd())
return *it;
else
throw ParserException(QObject::tr("Unknown helgrind error kind \"%1\"").arg(kind));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unknown helgrind error kind \"%1\"").arg(kind));
}
PtrcheckErrorKind Parser::Private::parsePtrcheckErrorKind(const QString &kind)
@@ -379,7 +389,8 @@ PtrcheckErrorKind Parser::Private::parsePtrcheckErrorKind(const QString &kind)
if (it != errorKindsByName_ptrcheck.constEnd())
return *it;
else
throw ParserException(QObject::tr("Unknown ptrcheck error kind \"%1\"").arg(kind));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unknown ptrcheck error kind \"%1\"").arg(kind));
}
int Parser::Private::parseErrorKind(const QString &kind)
@@ -395,7 +406,8 @@ int Parser::Private::parseErrorKind(const QString &kind)
default:
break;
}
throw ParserException(QObject::tr("Could not parse error kind, tool not yet set."));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Could not parse error kind, tool not yet set."));
}
static Status::State parseState(const QString &state)
@@ -404,7 +416,8 @@ static Status::State parseState(const QString &state)
return Status::Running;
if (state == QLatin1String("FINISHED"))
return Status::Finished;
throw ParserException(QObject::tr("Unknown state \"%1\"").arg(state));
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unknown state \"%1\"").arg(state));
}
void Parser::Private::reportInternalError(const QString &e)
@@ -722,7 +735,8 @@ void Parser::Private::parse(QIODevice *device)
} catch (const ParserException &e) {
reportInternalError(e.message());
} catch (...) {
reportInternalError(QObject::tr("Unexpected exception caught during parsing."));
reportInternalError(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unexpected exception caught during parsing."));
}
emit q->finished();
}