Commit 95675390 authored by Urs Fleisch's avatar Urs Fleisch
Browse files

KCM_i18n1() and KCM_i18n2() macros for KDE4's i18n() variant with arguments

parent a018b7e4
......@@ -1070,8 +1070,7 @@ void FileList::renameFile()
QMessageBox::warning(
0, i18n("File Error"),
i18n("Error while renaming:\n") +
i18n("Rename %1 to %2 failed\n").
arg(filename).arg(newFileName),
KCM_i18n2("Rename %1 to %2 failed\n", filename, newFileName),
QMessageBox::Ok, QCM_NoButton);
}
}
......@@ -1107,7 +1106,7 @@ void FileList::renameFile()
QMessageBox::warning(
0, i18n("File Error"),
i18n("Error while renaming:\n") +
i18n("Rename %1 to %2 failed\n").arg(fi.fileName()).arg(newDirName),
KCM_i18n2("Rename %1 to %2 failed\n", fi.fileName(), newDirName),
QMessageBox::Ok, QCM_NoButton);
}
}
......@@ -1149,7 +1148,7 @@ void FileList::deleteFile()
KMessageBox::Dangerous) == KMessageBox::Continue)
#else
QString txt = numFiles > 1 ?
i18n("Do you really want to delete these %1 items?").arg(numFiles) :
KCM_i18n1("Do you really want to delete these %1 items?", numFiles) :
i18n("Do you really want to delete this item?");
txt += '\n';
txt += files.join("\n");
......@@ -1213,7 +1212,7 @@ void FileList::deleteFile()
i18n("File Error"));
#else
QString txt = files.size() > 1 ?
i18n("Error while deleting these %1 items:").arg(files.size()) :
KCM_i18n1("Error while deleting these %1 items:", files.size()) :
i18n("Error while deleting this item:");
txt += '\n';
txt += files.join("\n");
......
......@@ -188,7 +188,7 @@ void ImportSourceClient::slotConnectionClosed()
*/
void ImportSourceClient::slotReadyRead()
{
m_statusBar->QCM_showMessage(i18n("Data received: %1").arg(m_sock->bytesAvailable()));
m_statusBar->QCM_showMessage(KCM_i18n1("Data received: %1", m_sock->bytesAvailable()));
}
/**
......
......@@ -78,6 +78,9 @@
#define KCM_readListEntry(key) readEntry(key, QStringList())
#define KCM_readIntListEntry(key) readEntry(key, QList<int>())
#define KCM_i18n1(s, a1) i18n(s, a1)
#define KCM_i18n2(s, a1, a2) i18n(s, a1, a2)
#else
#define KCM_ICON_document_open "fileopen"
......@@ -112,11 +115,16 @@
#define KCM_readListEntry(key) readListEntry(key)
#define KCM_readIntListEntry(key) readIntListEntry(key)
#define KCM_i18n1(s, a1) i18n(s).arg(a1)
#define KCM_i18n2(s, a1, a2) i18n(s).arg(a1).arg(a2)
#endif
#define QCM_translate(s) i18n(s)
#else
#define i18n(s) tr(s)
#define I18N_NOOP(s) QT_TRANSLATE_NOOP("@default", s)
#define KCM_i18n1(s, a1) tr(s).arg(a1)
#define KCM_i18n2(s, a1, a2) tr(s).arg(a1).arg(a2)
#if QT_VERSION >= 0x040000
#include <QCoreApplication>
#define QCM_translate(s) QCoreApplication::translate("@default", s)
......
......@@ -292,7 +292,7 @@ bool RenDirDialog::createDirectory(const QString& dir,
return true;
} else {
if (errorMsg) {
errorMsg->append(i18n("Create directory %1 failed\n").arg(dir));
errorMsg->append(KCM_i18n1("Create directory %1 failed\n", dir));
}
return false;
}
......@@ -313,13 +313,13 @@ bool RenDirDialog::renameDirectory(
{
if (QFileInfo(newdir).exists()) {
if (errorMsg) {
errorMsg->append(i18n("File %1 already exists\n").arg(newdir));
errorMsg->append(KCM_i18n1("File %1 already exists\n", newdir));
}
return false;
}
if (!QFileInfo(olddir).isDir()) {
if (errorMsg) {
errorMsg->append(i18n("%1 is not a directory\n").arg(olddir));
errorMsg->append(KCM_i18n1("%1 is not a directory\n", olddir));
}
return false;
}
......@@ -327,7 +327,7 @@ bool RenDirDialog::renameDirectory(
return true;
} else {
if (errorMsg) {
errorMsg->append(i18n("Rename %1 to %2 failed\n").arg(olddir).arg(newdir));
errorMsg->append(KCM_i18n2("Rename %1 to %2 failed\n", olddir, newdir));
}
return false;
}
......@@ -351,13 +351,13 @@ bool RenDirDialog::renameFile(const QString& oldfn, const QString& newfn,
}
if (QFileInfo(newfn).exists()) {
if (errorMsg) {
errorMsg->append(i18n("%1 already exists\n").arg(newfn));
errorMsg->append(KCM_i18n1("%1 already exists\n", newfn));
}
return false;
}
if (!QFileInfo(oldfn).isFile()) {
if (errorMsg) {
errorMsg->append(i18n("%1 is not a file\n").arg(oldfn));
errorMsg->append(KCM_i18n1("%1 is not a file\n", oldfn));
}
return false;
}
......@@ -365,7 +365,7 @@ bool RenDirDialog::renameFile(const QString& oldfn, const QString& newfn,
return true;
} else {
if (errorMsg) {
errorMsg->append(i18n("Rename %1 to %2 failed\n").arg(oldfn).arg(newfn));
errorMsg->append(KCM_i18n2("Rename %1 to %2 failed\n", oldfn, newfn));
}
return false;
}
......
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