Beautifier: Fix untranslated DISPLAY_NAME

Change-Id: Ifad91eaada5f7614767b6332a643723de79fc6b2
Reviewed-by: Lorenz Haas <lorenz.haas@histomatics.de>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
Takumi ASAKI
2016-06-01 16:42:05 +09:00
committed by Orgad Shaneh
parent 74fed1d5b7
commit 88819d0490
9 changed files with 20 additions and 12 deletions

View File

@@ -69,7 +69,7 @@ ArtisticStyle::~ArtisticStyle()
bool ArtisticStyle::initialize() bool ArtisticStyle::initialize()
{ {
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::ArtisticStyle::MENU_ID); Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::ArtisticStyle::MENU_ID);
menu->menu()->setTitle(Constants::ArtisticStyle::DISPLAY_NAME); menu->menu()->setTitle(tr(Constants::ArtisticStyle::DISPLAY_NAME));
m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this); m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this);
menu->addAction(Core::ActionManager::registerAction(m_formatFile, menu->addAction(Core::ActionManager::registerAction(m_formatFile,
@@ -104,7 +104,7 @@ void ArtisticStyle::formatFile()
const QString cfgFileName = configurationFile(); const QString cfgFileName = configurationFile();
if (cfgFileName.isEmpty()) { if (cfgFileName.isEmpty()) {
BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile( BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile(
Constants::ArtisticStyle::DISPLAY_NAME)); tr(Constants::ArtisticStyle::DISPLAY_NAME)));
} else { } else {
m_beautifierPlugin->formatCurrentFile(command(cfgFileName)); m_beautifierPlugin->formatCurrentFile(command(cfgFileName));
} }

View File

@@ -25,11 +25,13 @@
#pragma once #pragma once
#include <QtGlobal>
namespace Beautifier { namespace Beautifier {
namespace Constants { namespace Constants {
namespace ArtisticStyle { namespace ArtisticStyle {
const char DISPLAY_NAME[] = "Artistic Style"; const char DISPLAY_NAME[] = QT_TRANSLATE_NOOP("Beautifier::Internal::ArtisticStyle::ArtisticStyle", "Artistic Style");
const char ACTION_FORMATFILE[] = "ArtisticStyle.FormatFile"; const char ACTION_FORMATFILE[] = "ArtisticStyle.FormatFile";
const char MENU_ID[] = "ArtisticStyle.Menu"; const char MENU_ID[] = "ArtisticStyle.Menu";
const char OPTION_ID[] = "ArtisticStyle"; const char OPTION_ID[] = "ArtisticStyle";

View File

@@ -28,6 +28,7 @@
#include "artisticstyleconstants.h" #include "artisticstyleconstants.h"
#include "artisticstylesettings.h" #include "artisticstylesettings.h"
#include "artisticstyle.h"
#include "../beautifierconstants.h" #include "../beautifierconstants.h"
#include "../beautifierplugin.h" #include "../beautifierplugin.h"
@@ -49,7 +50,7 @@ ArtisticStyleOptionsPageWidget::ArtisticStyleOptionsPageWidget(ArtisticStyleSett
"HOME", QDir::toNativeSeparators(QDir::home().absolutePath()))); "HOME", QDir::toNativeSeparators(QDir::home().absolutePath())));
ui->command->setExpectedKind(Utils::PathChooser::ExistingCommand); ui->command->setExpectedKind(Utils::PathChooser::ExistingCommand);
ui->command->setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle( ui->command->setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle(
Constants::ArtisticStyle::DISPLAY_NAME)); ArtisticStyle::tr(Constants::ArtisticStyle::DISPLAY_NAME)));
connect(ui->command, &Utils::PathChooser::validChanged, ui->options, &QWidget::setEnabled); connect(ui->command, &Utils::PathChooser::validChanged, ui->options, &QWidget::setEnabled);
ui->configurations->setSettings(m_settings); ui->configurations->setSettings(m_settings);
} }

View File

@@ -101,7 +101,7 @@ FormatTask format(FormatTask task)
process.setTimeoutS(5); process.setTimeoutS(5);
Utils::SynchronousProcessResponse response = process.runBlocking(executable, options); Utils::SynchronousProcessResponse response = process.runBlocking(executable, options);
if (response.result != Utils::SynchronousProcessResponse::Finished) { if (response.result != Utils::SynchronousProcessResponse::Finished) {
task.error = QObject::tr("Failed to format: %1.").arg(response.exitMessage(executable, 5)); task.error = BeautifierPlugin::tr("Failed to format: %1.").arg(response.exitMessage(executable, 5));
return task; return task;
} }
const QString output = response.stdErr; const QString output = response.stdErr;

View File

@@ -73,7 +73,7 @@ QString ClangFormat::id() const
bool ClangFormat::initialize() bool ClangFormat::initialize()
{ {
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::ClangFormat::MENU_ID); Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::ClangFormat::MENU_ID);
menu->menu()->setTitle(Constants::ClangFormat::DISPLAY_NAME); menu->menu()->setTitle(tr(Constants::ClangFormat::DISPLAY_NAME));
m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this); m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this);
Core::Command *cmd Core::Command *cmd

View File

@@ -25,11 +25,13 @@
#pragma once #pragma once
#include <QtGlobal>
namespace Beautifier { namespace Beautifier {
namespace Constants { namespace Constants {
namespace ClangFormat { namespace ClangFormat {
const char DISPLAY_NAME[] = "ClangFormat"; const char DISPLAY_NAME[] = QT_TRANSLATE_NOOP("Beautifier::Internal::ClangFormat::ClangFormat", "ClangFormat");
const char ACTION_FORMATFILE[] = "ClangFormat.FormatFile"; const char ACTION_FORMATFILE[] = "ClangFormat.FormatFile";
const char ACTION_FORMATSELECTED[] = "ClangFormat.FormatSelectedText"; const char ACTION_FORMATSELECTED[] = "ClangFormat.FormatSelectedText";
const char MENU_ID[] = "ClangFormat.Menu"; const char MENU_ID[] = "ClangFormat.Menu";

View File

@@ -69,7 +69,7 @@ Uncrustify::~Uncrustify()
bool Uncrustify::initialize() bool Uncrustify::initialize()
{ {
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::Uncrustify::MENU_ID); Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::Uncrustify::MENU_ID);
menu->menu()->setTitle(Constants::Uncrustify::DISPLAY_NAME); menu->menu()->setTitle(tr(Constants::Uncrustify::DISPLAY_NAME));
m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this); m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this);
Core::Command *cmd Core::Command *cmd
@@ -114,7 +114,7 @@ void Uncrustify::formatFile()
const QString cfgFileName = configurationFile(); const QString cfgFileName = configurationFile();
if (cfgFileName.isEmpty()) { if (cfgFileName.isEmpty()) {
BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile( BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile(
Constants::Uncrustify::DISPLAY_NAME)); tr(Constants::Uncrustify::DISPLAY_NAME)));
} else { } else {
m_beautifierPlugin->formatCurrentFile(command(cfgFileName)); m_beautifierPlugin->formatCurrentFile(command(cfgFileName));
} }
@@ -125,7 +125,7 @@ void Uncrustify::formatSelectedText()
const QString cfgFileName = configurationFile(); const QString cfgFileName = configurationFile();
if (cfgFileName.isEmpty()) { if (cfgFileName.isEmpty()) {
BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile( BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile(
Constants::Uncrustify::DISPLAY_NAME)); tr(Constants::Uncrustify::DISPLAY_NAME)));
return; return;
} }

View File

@@ -25,11 +25,13 @@
#pragma once #pragma once
#include <QtGlobal>
namespace Beautifier { namespace Beautifier {
namespace Constants { namespace Constants {
namespace Uncrustify { namespace Uncrustify {
const char DISPLAY_NAME[] = "Uncrustify"; const char DISPLAY_NAME[] = QT_TRANSLATE_NOOP("Beautifier::Internal::Uncrustify::Uncrustify", "Uncrustify");
const char ACTION_FORMATFILE[] = "Uncrustify.FormatFile"; const char ACTION_FORMATFILE[] = "Uncrustify.FormatFile";
const char ACTION_FORMATSELECTED[] = "Uncrustify.FormatSelectedText"; const char ACTION_FORMATSELECTED[] = "Uncrustify.FormatSelectedText";
const char MENU_ID[] = "Uncrustify.Menu"; const char MENU_ID[] = "Uncrustify.Menu";

View File

@@ -28,6 +28,7 @@
#include "uncrustifyconstants.h" #include "uncrustifyconstants.h"
#include "uncrustifysettings.h" #include "uncrustifysettings.h"
#include "uncrustify.h"
#include "../beautifierconstants.h" #include "../beautifierconstants.h"
#include "../beautifierplugin.h" #include "../beautifierplugin.h"
@@ -51,7 +52,7 @@ UncrustifyOptionsPageWidget::UncrustifyOptionsPageWidget(UncrustifySettings *set
"HOME", QDir::toNativeSeparators(QDir::home().absolutePath()))); "HOME", QDir::toNativeSeparators(QDir::home().absolutePath())));
ui->command->setExpectedKind(Utils::PathChooser::ExistingCommand); ui->command->setExpectedKind(Utils::PathChooser::ExistingCommand);
ui->command->setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle( ui->command->setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle(
Constants::Uncrustify::DISPLAY_NAME)); Uncrustify::tr(Constants::Uncrustify::DISPLAY_NAME)));
connect(ui->command, &Utils::PathChooser::validChanged, ui->options, &QWidget::setEnabled); connect(ui->command, &Utils::PathChooser::validChanged, ui->options, &QWidget::setEnabled);
ui->configurations->setSettings(m_settings); ui->configurations->setSettings(m_settings);
} }