OSDN Git Service

10n: Fix tr() issues.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Wed, 19 Jan 2011 15:50:03 +0000 (16:50 +0100)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>
Wed, 19 Jan 2011 15:50:03 +0000 (16:50 +0100)
13 files changed:
src/plugins/cppeditor/cppsnippetprovider.cpp
src/plugins/debugger/debuggermainwindow.cpp
src/plugins/debugger/debuggerrunner.cpp
src/plugins/git/gitclient.cpp
src/plugins/help/helpmode.cpp
src/plugins/help/helpmode.h
src/plugins/projectexplorer/projectexplorer.cpp
src/plugins/qmldesigner/components/formeditor/itemcreatortool.cpp
src/plugins/qmldesigner/components/stateseditor/stateseditorimageprovider.h
src/plugins/qmljseditor/qmljssnippetprovider.cpp
src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp
src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h
src/plugins/texteditor/snippets/plaintextsnippetprovider.cpp

index 9e099fd..efa8371 100644 (file)
@@ -44,6 +44,7 @@
 #include <texteditor/snippets/snippeteditor.h>
 
 #include <QtCore/QLatin1String>
+#include <QtCore/QCoreApplication>
 
 using namespace CppEditor;
 using namespace Internal;
@@ -62,7 +63,7 @@ QString CppSnippetProvider::groupId() const
 
 QString CppSnippetProvider::displayName() const
 {
-    return tr("C++");
+    return QCoreApplication::translate("CppEditor::Internal::CppSnippetProvider", "C++");
 }
 
 void CppSnippetProvider::decorateEditor(TextEditor::SnippetEditor *editor) const
index ccfbf26..d5e187f 100644 (file)
@@ -475,7 +475,7 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode)
     debugToolBarLayout->addStretch();
     debugToolBarLayout->addWidget(new Utils::StyledSeparator);
 
-    QDockWidget *dock = new QDockWidget(tr("Debugger Toolbar"));
+    QDockWidget *dock = new QDockWidget(DebuggerMainWindowPrivate::tr("Debugger Toolbar"));
     dock->setObjectName(QLatin1String("Debugger Toolbar"));
     dock->setWidget(debugToolBar);
     dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
index 1f0e3cf..b7585b7 100644 (file)
@@ -536,7 +536,7 @@ bool DebuggerRunControlFactory::canRun(RunConfiguration *runConfiguration, const
 
 QString DebuggerRunControlFactory::displayName() const
 {
-    return tr("Debug");
+    return DebuggerRunControl::tr("Debug");
 }
 
 // Find Qt installation by running qmake
@@ -638,7 +638,7 @@ DebuggerRunControl *DebuggerRunControlFactory::create
 
     if (!check) {
         //appendMessage(errorMessage, true);
-        Core::ICore::instance()->showWarningWithOptions(tr("Debugger"),
+        Core::ICore::instance()->showWarningWithOptions(DebuggerRunControl::tr("Debugger"),
             check.errorMessage, QString(), check.settingsCategory, check.settingsPage);
         return 0;
     }
index 4fa7ee6..61c5b64 100644 (file)
@@ -92,13 +92,9 @@ BaseGitArgumentsWidget::BaseGitArgumentsWidget(GitSettings *settings,
     Q_ASSERT(client);
 }
 
-} // namespace Internal
-} // namespace Git
-
-namespace {
-
 class BaseGitDiffArgumentsWidget : public Git::Internal::BaseGitArgumentsWidget
 {
+    Q_OBJECT
 public:
     BaseGitDiffArgumentsWidget(Git::Internal::GitSettings *settings,
                                Git::Internal::GitClient *client,
@@ -164,6 +160,7 @@ protected:
 
 class GitCommitDiffArgumentsWidget : public BaseGitDiffArgumentsWidget
 {
+    Q_OBJECT
 public:
     GitCommitDiffArgumentsWidget(Git::Internal::GitSettings *settings,
                                  Git::Internal::GitClient *client, const QString &directory,
@@ -186,6 +183,7 @@ private:
 
 class GitFileDiffArgumentsWidget : public BaseGitDiffArgumentsWidget
 {
+    Q_OBJECT
 public:
     GitFileDiffArgumentsWidget(Git::Internal::GitSettings *settings,
                                Git::Internal::GitClient *client, const QString &directory,
@@ -205,6 +203,7 @@ private:
 
 class GitBranchDiffArgumentsWidget : public BaseGitDiffArgumentsWidget
 {
+    Q_OBJECT
 public:
     GitBranchDiffArgumentsWidget(Git::Internal::GitSettings *settings,
                                  Git::Internal::GitClient *client, const QString &directory,
@@ -224,6 +223,7 @@ private:
 
 class GitShowArgumentsWidget : public Git::Internal::BaseGitArgumentsWidget
 {
+    Q_OBJECT
 public:
     GitShowArgumentsWidget(Git::Internal::GitSettings *settings,
                            Git::Internal::GitClient *client,
@@ -289,6 +289,7 @@ private:
 
 class GitBlameArgumentsWidget : public Git::Internal::BaseGitArgumentsWidget
 {
+    Q_OBJECT
 public:
     GitBlameArgumentsWidget(Git::Internal::GitSettings *settings,
                             Git::Internal::GitClient *client, const QString &directory,
@@ -365,8 +366,6 @@ private:
     QString m_fileName;
 };
 
-} // namespace
-
 inline Core::IEditor* locateEditor(const Core::ICore *core, const char *property, const QString &entry)
 {
     foreach (Core::IEditor *ed, core->editorManager()->openedEditors())
@@ -400,9 +399,6 @@ static inline VCSBase::VCSBaseOutputWindow *outputWindow()
     return VCSBase::VCSBaseOutputWindow::instance();
 }
 
-namespace Git {
-namespace Internal {
-
 static inline QString msgRepositoryNotFound(const QString &dir)
 {
     return GitClient::tr("Unable to determine the repository for %1.").arg(dir);
@@ -2457,3 +2453,5 @@ unsigned GitClient::synchronousGitVersion(bool silent, QString *errorMessage /*
 
 } // namespace Internal
 } // namespace Git
+
+#include "gitclient.moc"
index 28d7552..2598925 100644 (file)
@@ -34,8 +34,7 @@
 #include "helpmode.h"
 #include "helpconstants.h"
 
-#include <QtGui/QIcon>
-#include <QtGui/QWidget>
+#include <QtCore/QCoreApplication>
 
 using namespace Help;
 using namespace Help::Internal;
@@ -47,3 +46,23 @@ HelpMode::HelpMode(QObject *parent)
 {
     setObjectName(QLatin1String("HelpMode"));
 }
+
+QString HelpMode::displayName() const
+{
+    return QCoreApplication::translate("Help::Internal::HelpMode", "Help");
+}
+
+int HelpMode::priority() const
+{
+    return Constants::P_MODE_HELP;
+}
+
+QString HelpMode::id() const
+{
+    return QLatin1String(Constants::ID_MODE_HELP);
+}
+
+Core::Context HelpMode::context() const
+{
+    return Core::Context(Constants::C_MODE_HELP);
+}
index 36bc0c8..e125fd3 100644 (file)
@@ -34,9 +34,6 @@
 #ifndef HELPMODE_H
 #define HELPMODE_H
 
-#include "helpmode.h"
-#include "helpconstants.h"
-
 #include <coreplugin/imode.h>
 
 #include <QtCore/QString>
@@ -48,15 +45,15 @@ namespace Internal {
 class HelpMode : public Core::IMode
 {
 public:
-    HelpMode(QObject *parent = 0);
+    explicit HelpMode(QObject *parent = 0);
 
-    QString displayName() const { return tr("Help"); }
+    QString displayName() const;
     QIcon icon() const { return m_icon; }
-    int priority() const { return Constants::P_MODE_HELP; }
+    int priority() const;
     QWidget *widget() { return m_widget; }
-    QString id() const { return QLatin1String(Constants::ID_MODE_HELP); }
+    QString id() const;
     QString type() const { return QString(); }
-    Core::Context context() const { return Core::Context(Constants::C_MODE_HELP); }
+    Core::Context context() const;
     QString contextHelpId() const { return QString(); }
     void setWidget(QWidget *widget) { m_widget = widget; }
 
index 11de200..1d01d0c 100644 (file)
@@ -221,7 +221,7 @@ class ProjectsMode : public Core::IMode
 public:
     ProjectsMode(QWidget *proWindow) : m_widget(proWindow) {}
 
-    QString displayName() const { return tr("Projects"); }
+    QString displayName() const { return QCoreApplication::translate("ProjectExplorer::ProjectsMode", "Projects"); }
     QIcon icon() const { return QIcon(QLatin1String(":/fancyactionbar/images/mode_Project.png")); }
     int priority() const { return Constants::P_MODE_SESSION; }
     QWidget *widget() { return m_widget; }
index aa01499..473b330 100644 (file)
@@ -183,7 +183,7 @@ void ItemCreatorTool::createAtItem(const QRectF &rect)
     if (list.first() == "item") {
         RewriterTransaction transaction = view()->beginRewriterTransaction();
         Q_ASSERT(false); //this code is out of date
-        ItemLibraryEntry itemLibraryEntry; //= view()->model()->metaInfo().itemLibraryInfo()->entry(list.at(1));
+        ItemLibraryEntry itemLibraryEntry; // = view()->model()->metaInfo().itemLibraryInfo()->entry(list.at(1));
         QmlItemNode newNode = view()->createQmlItemNode(itemLibraryEntry, pos, parentNode);
         newNode.modelNode().variantProperty("width") = rect.width();
         newNode.modelNode().variantProperty("height") = rect.height();
index 8c8d2d6..1ca788d 100644 (file)
 #ifndef STATESEDITORIMAGEPROVIDER_H
 #define STATESEDITORIMAGEPROVIDER_H
 
-#include <QDeclarativeImageProvider>
-#include <QWeakPointer>
 #include"abstractview.h"
 
-namespace QmlDesigner {
+#include <QtDeclarative/QDeclarativeImageProvider>
+#include <QtCore/QWeakPointer>
 
+namespace QmlDesigner {
 namespace Internal {
 
 class StatesEditorView;
@@ -57,9 +57,8 @@ private:
     QWeakPointer<NodeInstanceView> m_nodeInstanceView;
 };
 
-}
-
-}
+} // namespace Internal
+} // namespace QmlDesigner
 
 #endif // STATESEDITORIMAGEPROVIDER_H
 
index 42b260d..96fee49 100644 (file)
@@ -44,6 +44,7 @@
 #include <texteditor/snippets/snippeteditor.h>
 
 #include <QtCore/QLatin1String>
+#include <QtCore/QCoreApplication>
 
 using namespace QmlJSEditor;
 using namespace Internal;
@@ -62,7 +63,7 @@ QString QmlJSSnippetProvider::groupId() const
 
 QString QmlJSSnippetProvider::displayName() const
 {
-    return tr("QML");
+    return QCoreApplication::translate("QmlJSEditor::Internal::QmlJSSnippetProvider", "QML");
 }
 
 void QmlJSSnippetProvider::decorateEditor(TextEditor::SnippetEditor *editor) const
index f7cdaf7..dfcc9f5 100644 (file)
 #include "maemoconstants.h"
 #include "maemodeviceconfigurations.h"
 
+#include <projectexplorer/projectexplorerconstants.h>
+
 #include <coreplugin/filemanager.h>
 #include <coreplugin/ssh/sshconnection.h>
 #include <qt4projectmanager/qt4projectmanagerconstants.h>
 #include <qt4projectmanager/qtversionmanager.h>
 #include <utils/environment.h>
 
-#include <QtCore/QCoreApplication>
 #include <QtGui/QDesktopServices>
 #include <QtCore/QDir>
 #include <QtCore/QProcess>
 #include <QtCore/QString>
 
-#define TR(text) QCoreApplication::translate("Qt4ProjectManager::Internal::MaemoGlobal", text)
-
 namespace Qt4ProjectManager {
 namespace Internal {
 namespace {
@@ -136,23 +135,23 @@ QString MaemoGlobal::remoteEnvironment(const QList<Utils::EnvironmentItem> &list
 QString MaemoGlobal::failedToConnectToServerMessage(const Core::SshConnection::Ptr &connection,
     const MaemoDeviceConfig::ConstPtr &deviceConfig)
 {
-    QString errorMsg = TR("Could not connect to host: %1")
+    QString errorMsg = tr("Could not connect to host: %1")
         .arg(connection->errorString());
 
     if (deviceConfig->type() == MaemoDeviceConfig::Simulator) {
         if (connection->errorState() == Core::SshTimeoutError
                 || connection->errorState() == Core::SshSocketError) {
-            errorMsg += TR("\nDid you start Qemu?");
+            errorMsg += tr("\nDid you start Qemu?");
         }
     } else if (connection->errorState() == Core::SshTimeoutError) {
-        errorMsg += TR("\nIs the device connected and set up for network access?");
+        errorMsg += tr("\nIs the device connected and set up for network access?");
     }
     return errorMsg;
 }
 
 QString MaemoGlobal::deviceConfigurationName(const MaemoDeviceConfig::ConstPtr &devConf)
 {
-    return devConf ? devConf->name() : TR("(No device)");
+    return devConf ? devConf->name() : tr("(No device)");
 }
 
 QString MaemoGlobal::maddeRoot(const QtVersion *qtVersion)
@@ -209,13 +208,13 @@ bool MaemoGlobal::removeRecursively(const QString &filePath, QString &error)
         }
         dir.cdUp();
         if (!dir.rmdir(fileInfo.fileName())) {
-            error = TR("Failed to remove directory '%1'.")
+            error = tr("Failed to remove directory '%1'.")
                 .arg(QDir::toNativeSeparators(filePath));
             return false;
         }
     } else {
         if (!QFile::remove(filePath)) {
-            error = TR("Failed to remove file '%1'.")
+            error = tr("Failed to remove file '%1'.")
                 .arg(QDir::toNativeSeparators(filePath));
             return false;
         }
index 688da9f..5133cf9 100644 (file)
 
 #include <utils/environment.h>
 
-#include <projectexplorer/deployconfiguration.h>
 #include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/deployconfiguration.h>
 
 #include <QtCore/QList>
 #include <QtCore/QSharedPointer>
+#include <QtCore/QCoreApplication>
 
 #define ASSERT_STATE_GENERIC(State, expected, actual)                         \
     MaemoGlobal::assertState<State>(expected, actual, Q_FUNC_INFO)
@@ -52,7 +52,6 @@ class QString;
 QT_END_NAMESPACE
 
 namespace Core { class SshConnection; }
-
 namespace Qt4ProjectManager {
 class QtVersion;
 namespace Internal {
@@ -60,6 +59,7 @@ class MaemoDeviceConfig;
 
 class MaemoGlobal
 {
+    Q_DECLARE_TR_FUNCTIONS(Qt4ProjectManager::Internal::MaemoGlobal)
 public:
     enum MaemoVersion { Maemo5, Maemo6 };
 
index cd5b9d7..d33292c 100644 (file)
@@ -36,6 +36,7 @@
 #include <texteditor/texteditorconstants.h>
 
 #include <QtCore/QLatin1String>
+#include <QtCore/QCoreApplication>
 
 using namespace TextEditor;
 using namespace Internal;
@@ -53,7 +54,7 @@ QString PlainTextSnippetProvider::groupId() const
 
 QString PlainTextSnippetProvider::displayName() const
 {
-    return tr("Text");
+    return QCoreApplication::translate("TextEditor::Internal::PlainTextSnippetProvider", "Text");
 }
 
 void PlainTextSnippetProvider::decorateEditor(TextEditor::SnippetEditor *) const