Commit 948c7af9 authored by Friedemann Kleint's avatar Friedemann Kleint

tr()-Fixes.

- Capitalization
- Fix lupdate warnings about tr() Usage in ZeroConf
- Fix some messages.

Change-Id: I95e4095ce54040e30d9a7968407bfc99b76643ff
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
parent 0d08db21
......@@ -70,6 +70,11 @@ public:
QHash<Type, PrototypeMessageData> messages;
};
static inline QString msgInvalidConstructor(const char *what)
{
return StaticAnalysisMessages::tr("do not use '%1' as a constructor").arg(QLatin1String(what));
}
StaticAnalysisMessages::StaticAnalysisMessages()
{
// When changing a message or severity, update the documentation, currently
......@@ -133,15 +138,15 @@ StaticAnalysisMessages::StaticAnalysisMessages()
newMsg(WarnFunctionUsedBeforeDeclaration, Warning,
tr("function '%1' is used before its declaration"), 1);
newMsg(WarnBooleanConstructor, Warning,
tr("do not use 'Boolean' as a constructor"));
msgInvalidConstructor("Boolean"));
newMsg(WarnStringConstructor, Warning,
tr("do not use 'String' as a constructor"));
msgInvalidConstructor("String"));
newMsg(WarnObjectConstructor, Warning,
tr("do not use 'Object' as a constructor"));
msgInvalidConstructor("Object"));
newMsg(WarnArrayConstructor, Warning,
tr("do not use 'Array' as a constructor"));
msgInvalidConstructor("Array"));
newMsg(WarnFunctionConstructor, Warning,
tr("do not use 'Function' as a constructor"));
msgInvalidConstructor("Function"));
newMsg(HintAnonymousFunctionSpacing, Hint,
tr("the 'function' keyword and the opening parenthesis should be separated by a single space"));
newMsg(WarnBlock, Warning,
......@@ -181,7 +186,7 @@ StaticAnalysisMessages::StaticAnalysisMessages()
newMsg(WarnNewWithLowercaseFunction, Warning,
tr("'new' should only be used with functions that start with an uppercase letter"));
newMsg(WarnNumberConstructor, Warning,
tr("do not use 'Number' as a constructor"));
msgInvalidConstructor("Function"));
newMsg(HintBinaryOperatorSpacing, Hint,
tr("use spaces around binary operators"));
newMsg(WarnUnintentinalEmptyBlock, Warning,
......
......@@ -129,7 +129,8 @@ public:
#ifndef ZCONF_AVAHI_STATIC_LINKING
// dynamic linking
if (!nativeLib.load()) {
setError(true, tr("AvahiZConfLib could not load native library"));
setError(true,
ZConfLib::tr("AvahiZConfLib could not load the native library '%1': %2").arg(libName, nativeLib.errorString()));
}
m_simplePollGet = reinterpret_cast<AvahiSimplePollGet>(nativeLib.resolve("avahi_simple_poll_get"));
m_simplePollNew = reinterpret_cast<AvahiSimplePollNewPtr>(nativeLib.resolve("avahi_simple_poll_new"));
......@@ -316,7 +317,7 @@ public:
if (m_simplePollFree)
m_simplePollFree(connection->simple_poll);
delete connection;
setError(true, tr("%1 could not create a client (probably the daemon is not running)"));
setError(true, ZConfLib::tr("%1 could not create a client (probably the daemon is not running)").arg(name()));
return kDNSServiceErr_Unknown;
}
*sdRef = reinterpret_cast<ConnectionRef>(connection);
......@@ -440,16 +441,16 @@ extern "C" void cAvahiClientReply (AvahiClient * /*s*/, AvahiClientState state,
break;
case (AVAHI_CLIENT_S_COLLISION):
/* Server state: COLLISION */
lib->setError(true, lib->tr("cAvahiClient, server collision"));
lib->setError(true, ZConfLib::tr("cAvahiClient, server collision"));
break;
case (AVAHI_CLIENT_FAILURE):
lib->setError(true, lib->tr("cAvahiClient, some kind of error happened on the client side"));
lib->setError(true, ZConfLib::tr("cAvahiClient, some kind of error happened on the client side"));
break;
case (AVAHI_CLIENT_CONNECTING):
lib->setError(false, lib->tr("cAvahiClient, still connecting, no server available"));
lib->setError(false, ZConfLib::tr("cAvahiClient, still connecting, no server available"));
break;
default:
lib->setError(true, lib->tr("Error: unexpected state %1 in cAvahiClientReply, ignoring it")
lib->setError(true, ZConfLib::tr("Error: unexpected state %1 in cAvahiClientReply, ignoring it")
.arg(state));
}
}
......@@ -484,7 +485,7 @@ extern "C" void cAvahiBrowseReply(
browser->updateFlowStatusForFlags(0);
break;
default:
browser->mainConnection->lib->setError(true, browser->mainConnection->lib->tr(
browser->mainConnection->lib->setError(true, ZConfLib::tr(
"Error: unexpected state %1 in cAvahiBrowseReply, ignoring it")
.arg(event));
}
......
......@@ -85,7 +85,7 @@ public:
qDebug() << name() << " started " << daemonPath;
return true;
} else {
this->setError(true, tr("%1 failed starting embedded daemon at %2")
this->setError(true, ZConfLib::tr("%1 failed starting embedded daemon at %2")
.arg(name()).arg(daemonPath));
}
}
......
......@@ -56,7 +56,7 @@ class ServiceBrowserPrivate;
// represents a zero conf library exposing the dns-sd interface
class ZConfLib {
Q_DECLARE_TR_FUNCTIONS(ZeroConf)
Q_DECLARE_TR_FUNCTIONS(ZeroConf::Internal::ZConfLib)
public:
typedef QSharedPointer<ZConfLib> Ptr;
typedef void *ConnectionRef;
......
......@@ -1008,7 +1008,7 @@ public:
m_layout->addWidget(new QLabel(type), row, column++);
for (int i = -1; i != typeFormats.size(); ++i) {
QRadioButton *choice = new QRadioButton(this);
choice->setText(i == -1 ? tr("Reset") : typeFormats.at(i));
choice->setText(i == -1 ? TypeFormatsDialog::tr("Reset") : typeFormats.at(i));
m_layout->addWidget(choice, row, column++);
if (i == current)
choice->setChecked(true);
......
......@@ -1727,7 +1727,7 @@ void DebuggerPluginPrivate::gdbServerStarted(const QString &channel,
QList<Abi> abis = Abi::abisOfBinary(localExecutable);
if (abis.isEmpty()) {
QMessageBox::warning(mainWindow(), tr("Warning"),
tr("Cannot find abi for remote process \"%1\".")
tr("Cannot find ABI for remote process \"%1\".")
.arg(remoteCommandLine));
return;
}
......
......@@ -109,7 +109,7 @@ void ExecuteFilter::accept(FilterEntry selection) const
if (m_process->state() != QProcess::NotRunning) {
const QString info(tr("Previous command is still running ('%1').\nDo you want to kill it?")
.arg(p->headCommand()));
int r = QMessageBox::question(0, tr("Kill previous process?"), info,
int r = QMessageBox::question(0, tr("Kill Previous Process?"), info,
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
QMessageBox::Yes);
if (r == QMessageBox::Yes)
......
......@@ -138,6 +138,7 @@ private:
*/
class AddAnalysisMessageSuppressionComment: public QmlJSQuickFixFactory
{
Q_DECLARE_TR_FUNCTIONS(QmlJSEditor::AddAnalysisMessageSuppressionComment)
public:
virtual QList<QmlJSQuickFixOperation::Ptr> match(
const QSharedPointer<const QmlJSQuickFixAssistInterface> &interface)
......
......@@ -43,6 +43,7 @@
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QCoreApplication>
using namespace QmlJS;
using namespace QmlJS::AST;
......@@ -79,6 +80,8 @@ protected:
class Operation: public QmlJSQuickFixOperation
{
Q_DECLARE_TR_FUNCTIONS(QmlJSEditor::Internal::Operation)
UiObjectDefinition *m_objDef;
public:
......@@ -89,7 +92,7 @@ public:
{
Q_ASSERT(m_objDef != 0);
setDescription(WrapInLoader::tr("Wrap Component in Loader"));
setDescription(tr("Wrap Component in Loader"));
}
QString findFreeName(const QString &base)
......@@ -129,12 +132,10 @@ public:
FindIds::Result innerIds = FindIds()(m_objDef);
innerIds.remove(id);
QString comment = WrapInLoader::tr(
"// TODO: Move position bindings from the component to the Loader.\n"
"// Check all uses of 'parent' inside the root element of the component.\n");
QString comment = tr("// TODO: Move position bindings from the component to the Loader.\n"
"// Check all uses of 'parent' inside the root element of the component.\n");
if (idBinding) {
comment += WrapInLoader::tr(
"// Rename all outer uses of the id '%1' to '%2.item'.\n").arg(
comment += tr("// Rename all outer uses of the id '%1' to '%2.item'.\n").arg(
id, loaderId);
}
......@@ -144,8 +145,7 @@ public:
while (it.hasNext()) {
it.next();
const QString innerId = it.key();
comment += WrapInLoader::tr(
"// Rename all outer uses of the id '%1' to '%2.item.%1'.\n").arg(
comment += tr("// Rename all outer uses of the id '%1' to '%2.item.%1'.\n").arg(
innerId, loaderId);
changes.replace(it.value().begin(), it.value().end(), QString("inner_%1").arg(innerId));
innerIdForwarders += QString("\nproperty alias %1: inner_%1").arg(innerId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment