Commit 249a8b2d authored by Friedemann Kleint's avatar Friedemann Kleint

tr()-Fixes in CLANG code model.

Do not use QObject::tr(), use native file paths,
use complete contexts.

Change-Id: Icc4990b4c2ca5b9ae6f6b639db9e1a45a93e0a65
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 4c4bb918
......@@ -1173,9 +1173,8 @@ void ClangCompletionAssistProcessor::completeIncludePath(const QString &realPath
const QStringList &suffixes)
{
QDirIterator i(realPath, QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
const QString hint =
QObject::tr("Location: ", "Parent folder for proposed #include completion")
+ QDir::cleanPath(realPath);
//: Parent folder for proposed #include completion
const QString hint = tr("Location: %1").arg(QDir::toNativeSeparators(QDir::cleanPath(realPath)));
while (i.hasNext()) {
const QString fileName = i.next();
const QFileInfo fileInfo = i.fileInfo();
......
......@@ -43,6 +43,7 @@
#include <QStringList>
#include <QTextCursor>
#include <QCoreApplication>
namespace ClangCodeModel {
......@@ -104,6 +105,8 @@ private:
class CLANG_EXPORT ClangCompletionAssistProcessor : public TextEditor::IAssistProcessor
{
Q_DECLARE_TR_FUNCTIONS(ClangCodeModel::Internal::ClangCompletionAssistProcessor)
public:
ClangCompletionAssistProcessor();
virtual ~ClangCompletionAssistProcessor();
......
......@@ -53,7 +53,8 @@ QString ModelManagerSupport::id() const
QString ModelManagerSupport::displayName() const
{
return QCoreApplication::translate("ModelManagerSupport::displayName",
//: Display name
return QCoreApplication::translate("ClangCodeModel::Internal::ModelManagerSupport",
"Clang");
}
......
......@@ -48,8 +48,7 @@ QString ClangProjectSettingsPanelFactory::id() const
QString ClangProjectSettingsPanelFactory::displayName() const
{
return QCoreApplication::translate("ClangProjectSettingsPropertiesPage",
"Clang Settings");
return ClangProjectSettingsWidget::tr("Clang Settings");
}
int ClangProjectSettingsPanelFactory::priority() const
......@@ -67,9 +66,7 @@ bool ClangProjectSettingsPanelFactory::supports(Project *project)
PropertiesPanel *ClangProjectSettingsPanelFactory::createPanel(Project *project)
{
PropertiesPanel *panel = new PropertiesPanel;
panel->setDisplayName(QCoreApplication::translate(
"ClangProjectSettingsPropertiesPage",
"Clang Settings"));
panel->setDisplayName(ClangProjectSettingsWidget::tr("Clang Settings"));
panel->setWidget(new ClangProjectSettingsWidget(project));
return panel;
}
......
......@@ -96,7 +96,8 @@ void CompletionProposalsBuilder::operator ()(const CXCompletionResult &cxResult)
if (m_resultAvailability == CodeCompletionResult::Deprecated) {
m_comment += QLatin1String("<b>@note</b> ");
m_comment += QCoreApplication::translate("deprecated C++ symbol", "Is deprecated");
//: deprecated C++ symbol
m_comment += tr("Is deprecated");
}
m_hint = QLatin1String("<p>");
......@@ -675,9 +676,9 @@ void CompletionProposalsBuilder::concatSlotSignalSignature(const CXCompletionStr
const QString parent = Internal::getQString(clang_getCompletionParent(cxString, NULL));
if (m_resultKind == CodeCompletionResult::SlotCompletionKind)
m_hint += QObject::tr("Slot of %1, returns %2").arg(parent).arg(resultType);
m_hint += tr("Slot of %1, returns %2").arg(parent, resultType);
else
m_hint += QObject::tr("Signal of %1, returns %2").arg(parent).arg(resultType);
m_hint += tr("Signal of %1, returns %2").arg(parent, resultType);
}
/**
......
......@@ -34,10 +34,14 @@
#include "clang_global.h"
#include <clang-c/Index.h>
#include <QCoreApplication>
namespace ClangCodeModel {
class CLANG_EXPORT CompletionProposalsBuilder
{
Q_DECLARE_TR_FUNCTIONS(ClangCodeModel::CompletionProposalsBuilder)
public:
CompletionProposalsBuilder(QList<CodeCompletionResult> &results, quint64 contexts, bool isSignalSlotCompletion);
void operator ()(const CXCompletionResult &cxResult);
......
......@@ -52,11 +52,11 @@ const QString Diagnostic::severityAsString() const
return QString();
static QStringList strs = QStringList()
<< QCoreApplication::translate("Diagnostic", "ignored")
<< QCoreApplication::translate("Diagnostic", "note")
<< QCoreApplication::translate("Diagnostic", "warning")
<< QCoreApplication::translate("Diagnostic", "error")
<< QCoreApplication::translate("Diagnostic", "fatal")
<< QCoreApplication::translate("ClangCodeModel::Diagnostic", "ignored")
<< QCoreApplication::translate("ClangCodeModel::Diagnostic", "note")
<< QCoreApplication::translate("ClangCodeModel::Diagnostic", "warning")
<< QCoreApplication::translate("ClangCodeModel::Diagnostic", "error")
<< QCoreApplication::translate("ClangCodeModel::Diagnostic", "fatal")
;
return strs.at(m_severity);
......
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