Fixed some translation errors.

This commit is contained in:
Friedemann Kleint
2009-04-30 16:09:57 +02:00
parent afe68f0d13
commit 2f129dfad3
10 changed files with 66 additions and 52 deletions

View File

@@ -71,7 +71,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
QString err = stubServerListen(); QString err = stubServerListen();
if (!err.isEmpty()) { if (!err.isEmpty()) {
emit processError(tr("Cannot set up comm channel: %1").arg(err)); emit processError(tr("Cannot set up communication channel: %1").arg(err));
return false; return false;
} }
@@ -79,7 +79,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_tempFile = new QTemporaryFile(); m_tempFile = new QTemporaryFile();
if (!m_tempFile->open()) { if (!m_tempFile->open()) {
stubServerShutdown(); stubServerShutdown();
emit processError(tr("Cannot create temp file: %1").arg(m_tempFile->errorString())); emit processError(tr("Cannot create temporary file: %1").arg(m_tempFile->errorString()));
delete m_tempFile; delete m_tempFile;
m_tempFile = 0; m_tempFile = 0;
return false; return false;
@@ -109,7 +109,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_process.start(xterm, xtermArgs); m_process.start(xterm, xtermArgs);
if (!m_process.waitForStarted()) { if (!m_process.waitForStarted()) {
stubServerShutdown(); stubServerShutdown();
emit processError(tr("Cannot start terminal emulator %1.").arg(xterm)); emit processError(tr("Cannot start the terminal emulator '%1'.").arg(xterm));
delete m_tempFile; delete m_tempFile;
m_tempFile = 0; m_tempFile = 0;
return false; return false;
@@ -145,7 +145,7 @@ QString ConsoleProcess::stubServerListen()
{ {
QTemporaryFile tf; QTemporaryFile tf;
if (!tf.open()) if (!tf.open())
return tr("Cannot create temporary file: %2").arg(tf.errorString()); return tr("Cannot create temporary file: %1").arg(tf.errorString());
stubFifoDir = QFile::encodeName(tf.fileName()); stubFifoDir = QFile::encodeName(tf.fileName());
} }
// By now the temp file was deleted again // By now the temp file was deleted again
@@ -153,12 +153,12 @@ QString ConsoleProcess::stubServerListen()
if (!::mkdir(m_stubServerDir.constData(), 0700)) if (!::mkdir(m_stubServerDir.constData(), 0700))
break; break;
if (errno != EEXIST) if (errno != EEXIST)
return tr("Cannot create temporary directory %1: %2").arg(stubFifoDir, strerror(errno)); return tr("Cannot create temporary directory '%1': %2").arg(stubFifoDir, strerror(errno));
} }
QString stubServer = stubFifoDir + "/stub-socket"; QString stubServer = stubFifoDir + "/stub-socket";
if (!m_stubServer.listen(stubServer)) { if (!m_stubServer.listen(stubServer)) {
::rmdir(m_stubServerDir.constData()); ::rmdir(m_stubServerDir.constData());
return tr("Cannot create socket %1: %2").arg(stubServer, m_stubServer.errorString()); return tr("Cannot create socket '%1': %2").arg(stubServer, m_stubServer.errorString());
} }
return QString(); return QString();
} }
@@ -190,10 +190,10 @@ void ConsoleProcess::readStubOutput()
QByteArray out = m_stubSocket->readLine(); QByteArray out = m_stubSocket->readLine();
out.chop(1); // \n out.chop(1); // \n
if (out.startsWith("err:chdir ")) { if (out.startsWith("err:chdir ")) {
emit processError(tr("Cannot change to working directory %1: %2") emit processError(tr("Cannot change to working directory '%1': %2")
.arg(workingDirectory(), errorMsg(out.mid(10).toInt()))); .arg(workingDirectory(), errorMsg(out.mid(10).toInt())));
} else if (out.startsWith("err:exec ")) { } else if (out.startsWith("err:exec ")) {
emit processError(tr("Cannot execute %1: %2") emit processError(tr("Cannot execute '%1': %2")
.arg(m_executable, errorMsg(out.mid(9).toInt()))); .arg(m_executable, errorMsg(out.mid(9).toInt())));
} else if (out.startsWith("pid ")) { } else if (out.startsWith("pid ")) {
// Will not need it any more // Will not need it any more

View File

@@ -69,7 +69,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
QString err = stubServerListen(); QString err = stubServerListen();
if (!err.isEmpty()) { if (!err.isEmpty()) {
emit processError(tr("Cannot set up comm channel: %1").arg(err)); emit processError(tr("Cannot set up communication channel: %1").arg(err));
return false; return false;
} }
@@ -77,7 +77,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_tempFile = new QTemporaryFile(); m_tempFile = new QTemporaryFile();
if (!m_tempFile->open()) { if (!m_tempFile->open()) {
stubServerShutdown(); stubServerShutdown();
emit processError(tr("Cannot create temp file: %1").arg(m_tempFile->errorString())); emit processError(tr("Cannot create temporary file: %1").arg(m_tempFile->errorString()));
delete m_tempFile; delete m_tempFile;
m_tempFile = 0; m_tempFile = 0;
return false; return false;
@@ -180,10 +180,10 @@ void ConsoleProcess::readStubOutput()
QByteArray out = m_stubSocket->readLine(); QByteArray out = m_stubSocket->readLine();
out.chop(2); // \r\n out.chop(2); // \r\n
if (out.startsWith("err:chdir ")) { if (out.startsWith("err:chdir ")) {
emit processError(tr("Cannot change to working directory %1: %2") emit processError(tr("Cannot change to working directory '%1': %2")
.arg(workingDirectory(), winErrorMessage(out.mid(10).toInt()))); .arg(workingDirectory(), winErrorMessage(out.mid(10).toInt())));
} else if (out.startsWith("err:exec ")) { } else if (out.startsWith("err:exec ")) {
emit processError(tr("Cannot execute %1: %2") emit processError(tr("Cannot execute '%1': %2")
.arg(m_executable, winErrorMessage(out.mid(9).toInt()))); .arg(m_executable, winErrorMessage(out.mid(9).toInt())));
} else if (out.startsWith("pid ")) { } else if (out.startsWith("pid ")) {
// Will not need it any more // Will not need it any more

View File

@@ -35,12 +35,36 @@
#include <QtCore/QFutureInterface> #include <QtCore/QFutureInterface>
#include <QtCore/QtConcurrentRun> #include <QtCore/QtConcurrentRun>
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
#include <QtGui/QApplication> #include <QtCore/QCoreApplication>
#include <qtconcurrent/runextensions.h> #include <qtconcurrent/runextensions.h>
using namespace Core::Utils; using namespace Core::Utils;
static inline QString msgCanceled(const QString &searchTerm, int numMatches, int numFilesSearched)
{
return QCoreApplication::translate("Core::Utils::FileSearch",
"%1: canceled. %n occurrences found in %2 files.",
0, QCoreApplication::CodecForTr, numMatches).
arg(searchTerm).arg(numFilesSearched);
}
static inline QString msgFound(const QString &searchTerm, int numMatches, int numFilesSearched)
{
return QCoreApplication::translate("Core::Utils::FileSearch",
"%1: %n occurrences found in %2 files.",
0, QCoreApplication::CodecForTr, numMatches).
arg(searchTerm).arg(numFilesSearched);
}
static inline QString msgFound(const QString &searchTerm, int numMatches, int numFilesSearched, int filesSize)
{
return QCoreApplication::translate("Core::Utils::FileSearch",
"%1: %n occurrences found in %2 of %3 files.",
0, QCoreApplication::CodecForTr, numMatches).
arg(searchTerm).arg(numFilesSearched).arg(filesSize);
}
namespace { namespace {
void runFileSearch(QFutureInterface<FileSearchResult> &future, void runFileSearch(QFutureInterface<FileSearchResult> &future,
@@ -71,9 +95,7 @@ void runFileSearch(QFutureInterface<FileSearchResult> &future,
if (future.isPaused()) if (future.isPaused())
future.waitForResume(); future.waitForResume();
if (future.isCanceled()) { if (future.isCanceled()) {
future.setProgressValueAndText(numFilesSearched, future.setProgressValueAndText(numFilesSearched, msgCanceled(searchTerm, numMatches, numFilesSearched));
QApplication::translate("FileSearch", "%1: canceled. %2 occurrences found in %3 files.").
arg(searchTerm).arg(numMatches).arg(numFilesSearched));
break; break;
} }
QFile file(s); QFile file(s);
@@ -146,14 +168,10 @@ void runFileSearch(QFutureInterface<FileSearchResult> &future,
firstChunk = false; firstChunk = false;
} }
++numFilesSearched; ++numFilesSearched;
future.setProgressValueAndText(numFilesSearched, future.setProgressValueAndText(numFilesSearched, msgFound(searchTerm, numMatches, numFilesSearched, files.size()));
QApplication::translate("FileSearch", "%1: %2 occurrences found in %3 of %4 files.").
arg(searchTerm).arg(numMatches).arg(numFilesSearched).arg(files.size()));
} }
if (!future.isCanceled()) if (!future.isCanceled())
future.setProgressValueAndText(numFilesSearched, future.setProgressValueAndText(numFilesSearched, msgFound(searchTerm, numMatches, numFilesSearched));
QApplication::translate("FileSearch", "%1: %2 occurrences found in %3 files.").
arg(searchTerm).arg(numMatches).arg(numFilesSearched));
} }
void runFileSearchRegExp(QFutureInterface<FileSearchResult> &future, void runFileSearchRegExp(QFutureInterface<FileSearchResult> &future,
@@ -165,17 +183,15 @@ void runFileSearchRegExp(QFutureInterface<FileSearchResult> &future,
int numFilesSearched = 0; int numFilesSearched = 0;
int numMatches = 0; int numMatches = 0;
if (flags & QTextDocument::FindWholeWords) if (flags & QTextDocument::FindWholeWords)
searchTerm = QString("\\b%1\\b").arg(searchTerm); searchTerm = QString::fromLatin1("\\b%1\\b").arg(searchTerm);
Qt::CaseSensitivity caseSensitivity = (flags & QTextDocument::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive; const Qt::CaseSensitivity caseSensitivity = (flags & QTextDocument::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive;
QRegExp expression(searchTerm, caseSensitivity); const QRegExp expression(searchTerm, caseSensitivity);
foreach (QString s, files) { foreach (const QString &s, files) {
if (future.isPaused()) if (future.isPaused())
future.waitForResume(); future.waitForResume();
if (future.isCanceled()) { if (future.isCanceled()) {
future.setProgressValueAndText(numFilesSearched, future.setProgressValueAndText(numFilesSearched, msgCanceled(searchTerm, numMatches, numFilesSearched));
QApplication::translate("FileSearch", "%1: canceled. %2 occurrences found in %3 files.").
arg(searchTerm).arg(numMatches).arg(numFilesSearched));
break; break;
} }
QFile file(s); QFile file(s);
@@ -195,14 +211,10 @@ void runFileSearchRegExp(QFutureInterface<FileSearchResult> &future,
++lineNr; ++lineNr;
} }
++numFilesSearched; ++numFilesSearched;
future.setProgressValueAndText(numFilesSearched, future.setProgressValueAndText(numFilesSearched, msgFound(searchTerm, numMatches, numFilesSearched, files.size()));
QApplication::translate("FileSearch", "%1: %2 occurrences found in %3 of %4 files.").
arg(searchTerm).arg(numMatches).arg(numFilesSearched).arg(files.size()));
} }
if (!future.isCanceled()) if (!future.isCanceled())
future.setProgressValueAndText(numFilesSearched, future.setProgressValueAndText(numFilesSearched, msgFound(searchTerm, numMatches, numFilesSearched));
QApplication::translate("FileSearch", "%1: %2 occurrences found in %3 files.").
arg(searchTerm).arg(numMatches).arg(numFilesSearched));
} }
} // namespace } // namespace

View File

@@ -68,7 +68,7 @@ QString GeneralSettings::trCategory() const
QWidget *GeneralSettings::createPage(QWidget *parent) QWidget *GeneralSettings::createPage(QWidget *parent)
{ {
m_page = new Ui_GeneralSettings(); m_page = new Ui::GeneralSettings();
QWidget *w = new QWidget(parent); QWidget *w = new QWidget(parent);
m_page->setupUi(w); m_page->setupUi(w);

View File

@@ -33,13 +33,13 @@
#include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/dialogs/ioptionspage.h>
#include <QtGui/QWidget> #include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class Ui_GeneralSettings;
QT_END_NAMESPACE
namespace Core { namespace Core {
namespace Internal { namespace Internal {
namespace Ui {
class GeneralSettings;
}
class GeneralSettings : public IOptionsPage class GeneralSettings : public IOptionsPage
{ {
Q_OBJECT Q_OBJECT
@@ -64,7 +64,7 @@ private slots:
#endif #endif
private: private:
Ui_GeneralSettings *m_page; Ui::GeneralSettings *m_page;
QWidget *m_dialog; QWidget *m_dialog;
}; };

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>GeneralSettings</class> <class>Core::Internal::GeneralSettings</class>
<widget class="QWidget" name="GeneralSettings"> <widget class="QWidget" name="Core::Internal::GeneralSettings">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@@ -62,7 +62,7 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="alphaAllowed" stdset="0"> <property name="alphaAllowed">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>

View File

@@ -120,7 +120,7 @@ WelcomeMode::~WelcomeMode()
QString WelcomeMode::name() const QString WelcomeMode::name() const
{ {
return QLatin1String("Welcome"); return tr("Welcome");
} }
QIcon WelcomeMode::icon() const QIcon WelcomeMode::icon() const

View File

@@ -42,7 +42,8 @@ using namespace QuickOpen::Internal;
DirectoryFilter::DirectoryFilter() DirectoryFilter::DirectoryFilter()
: m_name(tr("Generic Directory Filter")), : m_name(tr("Generic Directory Filter")),
m_filters(QStringList() << "*.h" << "*.cpp" << "*.ui" << "*.qrc") m_filters(QStringList() << QLatin1String("*.h") << QLatin1String("*.cpp")
<< QLatin1String("*.ui") << QLatin1String("*.qrc"))
{ {
setIncludedByDefault(true); setIncludedByDefault(true);
} }
@@ -112,7 +113,7 @@ bool DirectoryFilter::openConfigDialog(QWidget *parent, bool &needsRefresh)
m_ui.nameEdit->selectAll(); m_ui.nameEdit->selectAll();
m_ui.directoryList->clear(); m_ui.directoryList->clear();
m_ui.directoryList->addItems(m_directories); m_ui.directoryList->addItems(m_directories);
m_ui.fileTypeEdit->setText(m_filters.join(tr(","))); m_ui.fileTypeEdit->setText(m_filters.join(QString(QLatin1Char(','))));
m_ui.shortcutEdit->setText(shortcutString()); m_ui.shortcutEdit->setText(shortcutString());
m_ui.defaultFlag->setChecked(!isIncludedByDefault()); m_ui.defaultFlag->setChecked(!isIncludedByDefault());
updateOptionButtons(); updateOptionButtons();
@@ -132,7 +133,7 @@ bool DirectoryFilter::openConfigDialog(QWidget *parent, bool &needsRefresh)
if (!directoriesChanged && m_directories.at(i) != oldDirectories.at(i)) if (!directoriesChanged && m_directories.at(i) != oldDirectories.at(i))
directoriesChanged = true; directoriesChanged = true;
} }
m_filters = m_ui.fileTypeEdit->text().trimmed().split(tr(",")); m_filters = m_ui.fileTypeEdit->text().trimmed().split(QLatin1Char(','));
setShortcutString(m_ui.shortcutEdit->text().trimmed()); setShortcutString(m_ui.shortcutEdit->text().trimmed());
setIncludedByDefault(!m_ui.defaultFlag->isChecked()); setIncludedByDefault(!m_ui.defaultFlag->isChecked());
if (directoriesChanged || oldFilters != m_filters) if (directoriesChanged || oldFilters != m_filters)
@@ -207,7 +208,8 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future)
} }
while (!dirs.isEmpty() && !future.isCanceled()) { while (!dirs.isEmpty() && !future.isCanceled()) {
if (future.isProgressUpdateNeeded()) { if (future.isProgressUpdateNeeded()) {
future.setProgressValueAndText(progress, tr("%1 filter update: %2 files").arg(m_name).arg(files.size())); future.setProgressValueAndText(progress,
tr("%1 filter update: %n files", 0, files.size()).arg(m_name));
} }
QDir dir = dirs.pop(); QDir dir = dirs.pop();
int dirProgressMax = progressValues.pop(); int dirProgressMax = progressValues.pop();

View File

@@ -63,7 +63,7 @@
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Specify a short word/abbreviation that can be used to restrict completions to files from this directory tree. <string>Specify a short word/abbreviation that can be used to restrict completions to files from this directory tree.
To do this you type this shortcut and a space in the QuickOpen entry field, and then the word to search for.</string> To do this, you type this shortcut and a space in the Locator entry field, and then the word to search for.</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -699,8 +699,8 @@ void BookmarkManager::removeBookmarkItem(QTreeView *treeView, const QModelIndex&
QString data = index.data(Qt::UserRole + 10).toString(); QString data = index.data(Qt::UserRole + 10).toString();
if (data == QLatin1String("Folder") && item->rowCount() > 0) { if (data == QLatin1String("Folder") && item->rowCount() > 0) {
int value = QMessageBox::question(treeView, tr("Remove"), int value = QMessageBox::question(treeView, tr("Remove"),
tr("You are going to delete a Folder, this will also<br>" tr("You are going to delete a Folder which will also<br>"
"remove it's content. Are you sure to continue?"), "remove its content. Are you sure to continue?"),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel); QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
if (value == QMessageBox::Cancel) if (value == QMessageBox::Cancel)