Add tr() to visible strings; fix #119 (#209)

* Add tr() to visible strings; close #119
This commit is contained in:
Alexandr Filatov 2017-09-09 12:36:15 +03:00 committed by xarkes
parent f3aba5fdd0
commit 15bdbef4a0
6 changed files with 37 additions and 37 deletions

View File

@ -64,7 +64,7 @@ void createNewDialog::on_exampleButton_clicked()
{ {
str = "48656c6c6f20576f726c6400"; str = "48656c6c6f20576f726c6400";
} }
else fprintf(stderr, "Unknown combo value selected"); else fprintf(stderr, tr("Unknown combo value selected").toLocal8Bit().constData());
if (str.length() > 0) if (str.length() > 0)
ui->plainTextEdit->setPlainText(str); ui->plainTextEdit->setPlainText(str);
// } // }
@ -95,12 +95,12 @@ void createNewDialog::on_buttonCreate_clicked()
} }
else else
{ {
__alert("Failed to create file"); __alert(tr("Failed to create file"));
} }
} }
else else
{ {
__alert("Invalid assembler code"); __alert(tr("Invalid assembler code"));
} }
r_asm_code_free(code); r_asm_code_free(code);
} }
@ -119,12 +119,12 @@ void createNewDialog::on_buttonCreate_clicked()
} }
else else
{ {
__alert("failed to open file"); __alert(tr("Failed to open file"));
} }
} }
else else
{ {
__alert("Invalid file size"); __alert(tr("Invalid file size"));
} }
} }
else if (type == "C Code") else if (type == "C Code")
@ -151,12 +151,12 @@ void createNewDialog::on_buttonCreate_clicked()
} }
else else
{ {
__alert("failed to open file"); __alert(tr("Failed to open file"));
} }
} }
else else
{ {
__alert("Invalid file size"); __alert(tr("Invalid file size"));
} }
} }
else if (type == "Text") else if (type == "Text")
@ -174,12 +174,12 @@ void createNewDialog::on_buttonCreate_clicked()
} }
else else
{ {
__alert("failed to open file"); __alert(tr("Failed to open file"));
} }
} }
else else
{ {
__alert("Empty string?"); __alert(tr("Empty string?"));
} }
} }
else if (type == "Hexpairs") else if (type == "Hexpairs")
@ -199,18 +199,18 @@ void createNewDialog::on_buttonCreate_clicked()
} }
else else
{ {
__alert("failed to open file"); __alert(tr("Failed to open file"));
} }
} }
else else
{ {
__alert("Invalid hexpair string"); __alert(tr("Invalid hexpair string"));
} }
free(buf); free(buf);
} }
else else
{ {
__alert("Unknown combo value selected"); __alert(tr("Unknown combo value selected"));
return; return;
} }
@ -230,12 +230,12 @@ void createNewDialog::on_buttonCreate_clicked()
w->core->seek(0); w->core->seek(0);
w->updateFrames(); w->updateFrames();
w->setFilename("-"); w->setFilename("-");
w->addOutput("Finished, check its contents"); w->addOutput(tr("Finished, check its contents"));
w->showMaximized(); w->showMaximized();
} }
else else
{ {
__alert("No file created."); __alert(tr("No file created."));
} }
} }

View File

@ -8,13 +8,13 @@ AboutDialog::AboutDialog(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
ui->label->setText("<h1>Iaito</h1>" ui->label->setText(tr("<h1>Iaito</h1>"
"Version 1.0 alpha<br />" "Version 1.0 alpha<br />"
"Using r2-" R2_GITTAP "Using r2-" R2_GITTAP
"<h2>License</h2>" "<h2>License</h2>"
"This Software is released under the GNU General Public License v3.0" "This Software is released under the GNU General Public License v3.0"
"<h2>Authors</h2>" "<h2>Authors</h2>"
"Hugo Teso &lt;hugo.teso@gmail.org&gt;\nSoon to be thousands more!"); "Hugo Teso &lt;hugo.teso@gmail.org&gt;\nSoon to be thousands more!"));
} }
AboutDialog::~AboutDialog() AboutDialog::~AboutDialog()

View File

@ -24,7 +24,7 @@ int main(int argc, char *argv[])
QCommandLineParser cmd_parser; QCommandLineParser cmd_parser;
cmd_parser.setApplicationDescription("A Qt and C++ GUI for radare2 reverse engineering framework"); cmd_parser.setApplicationDescription(QObject::tr("A Qt and C++ GUI for radare2 reverse engineering framework"));
cmd_parser.addHelpOption(); cmd_parser.addHelpOption();
cmd_parser.addVersionOption(); cmd_parser.addVersionOption();
cmd_parser.addPositionalArgument("filename", QObject::tr("Filename to open.")); cmd_parser.addPositionalArgument("filename", QObject::tr("Filename to open."));
@ -47,8 +47,8 @@ int main(int argc, char *argv[])
msg.setIcon(QMessageBox::Critical); msg.setIcon(QMessageBox::Critical);
msg.setWindowIcon(QIcon(":/img/logo-small.png")); msg.setWindowIcon(QIcon(":/img/logo-small.png"));
msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msg.setWindowTitle("Version mismatch!"); msg.setWindowTitle(QObject::tr("Version mismatch!"));
msg.setText(QString("The version used to compile iaito (%1) does not match the binary version of radare2 (%2). This could result in unexpected behaviour. Are you sure you want to continue?").arg(localVersion, r2version)); msg.setText(QString(QObject::tr("The version used to compile iaito (%1) does not match the binary version of radare2 (%2). This could result in unexpected behaviour. Are you sure you want to continue?")).arg(localVersion, r2version));
if (msg.exec() == QMessageBox::No) if (msg.exec() == QMessageBox::No)
return 1; return 1;
} }

View File

@ -345,7 +345,7 @@ void MainWindow::finalizeOpen()
core->setSettings(); core->setSettings();
addOutput(" > Populating UI"); addOutput(tr(" > Populating UI"));
// FIXME: initialization order frakup. the next line is needed so that the // FIXME: initialization order frakup. the next line is needed so that the
// comments widget displays the function names. // comments widget displays the function names.
core->cmd("fs sections"); core->cmd("fs sections");
@ -364,9 +364,9 @@ void MainWindow::finalizeOpen()
} }
else else
{ {
addOutput(" > Adding binary information to notepad"); addOutput(tr(" > Adding binary information to notepad"));
notepadDock->setText("# Binary information\n\n" + core->cmd("i") + notepadDock->setText(tr("# Binary information\n\n") + core->cmd("i") +
"\n" + core->cmd("ie") + "\n" + core->cmd("iM") + "\n"); "\n" + core->cmd("ie") + "\n" + core->cmd("iM") + "\n");
} }
@ -374,7 +374,7 @@ void MainWindow::finalizeOpen()
this->core->binStart = this->core->cmd("?v $M"); this->core->binStart = this->core->cmd("?v $M");
this->core->binEnd = this->core->cmd("?v $M+$s"); this->core->binEnd = this->core->cmd("?v $M+$s");
addOutput(" > Finished, happy reversing :)"); addOutput(tr(" > Finished, happy reversing :)"));
// Add fortune message // Add fortune message
addOutput("\n" + core->cmd("fo")); addOutput("\n" + core->cmd("fo"));
memoryDock->setWindowTitle("entry0"); memoryDock->setWindowTitle("entry0");
@ -449,7 +449,7 @@ void MainWindow::saveProject()
QString notes = this->notepadDock->textToBase64(); QString notes = this->notepadDock->textToBase64();
//this->add_debug_output(notes); //this->add_debug_output(notes);
this->core->cmd("Pnj " + notes); this->core->cmd("Pnj " + notes);
this->addOutput("Project saved: " + project_name); this->addOutput(tr("Project saved: ") + project_name);
} }
void MainWindow::start_web_server() void MainWindow::start_web_server()
@ -501,7 +501,7 @@ void MainWindow::setFilename(const QString &fn)
void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::closeEvent(QCloseEvent *event)
{ {
QMessageBox::StandardButton ret = QMessageBox::question(this, "Iaito", QMessageBox::StandardButton ret = QMessageBox::question(this, "Iaito",
"Do you really want to exit?\nSave your project before closing!", tr("Do you really want to exit?\nSave your project before closing!"),
(QMessageBox::StandardButtons)(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel)); (QMessageBox::StandardButtons)(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel));
//qDebug() << ret; //qDebug() << ret;
if (ret == QMessageBox::Save) if (ret == QMessageBox::Save)
@ -963,7 +963,7 @@ void MainWindow::on_actionRun_Script_triggered()
dialog.setDirectory(QDir::home()); dialog.setDirectory(QDir::home());
QString fileName; QString fileName;
fileName = dialog.getOpenFileName(this, "Select radare2 script"); fileName = dialog.getOpenFileName(this, tr("Select radare2 script"));
if (!fileName.length()) //cancel was pressed if (!fileName.length()) //cancel was pressed
return; return;
@ -1047,7 +1047,7 @@ void MainWindow::on_actionReset_settings_triggered()
{ {
QMessageBox::StandardButton ret = QMessageBox::StandardButton ret =
(QMessageBox::StandardButton)QMessageBox::question(this, "Iaito", (QMessageBox::StandardButton)QMessageBox::question(this, "Iaito",
"Do you really want to clear all settings?", tr("Do you really want to clear all settings?"),
QMessageBox::Ok | QMessageBox::Cancel); QMessageBox::Ok | QMessageBox::Cancel);
if (ret == QMessageBox::Ok) if (ret == QMessageBox::Ok)
{ {

View File

@ -99,7 +99,7 @@ void NewFileDialog::on_loadFileButton_clicked()
if (!checkfile.exists() || !checkfile.isFile()) if (!checkfile.exists() || !checkfile.isFile())
{ {
QMessageBox msgBox(this); QMessageBox msgBox(this);
msgBox.setText("Select a new program or a previous one\nbefore continue"); msgBox.setText(tr("Select a new program or a previous one\nbefore continue"));
msgBox.exec(); msgBox.exec();
} }
else else
@ -132,7 +132,7 @@ void NewFileDialog::on_newFileButton_clicked()
dialog.setDirectory(QDir::home()); dialog.setDirectory(QDir::home());
QString fileName; QString fileName;
fileName = dialog.getOpenFileName(this, "Select file"); fileName = dialog.getOpenFileName(this, tr("Select file"));
if (!fileName.isEmpty()) if (!fileName.isEmpty())
{ {

View File

@ -70,7 +70,7 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
ui->progressBar->setVisible(1); ui->progressBar->setVisible(1);
ui->statusLabel->setVisible(1); ui->statusLabel->setVisible(1);
ui->statusLabel->setText("Starting analysis"); ui->statusLabel->setText(tr("Starting analysis"));
//ui->progressBar->setValue(5); //ui->progressBar->setValue(5);
int va = ui->vaCheckBox->isChecked(); int va = ui->vaCheckBox->isChecked();
@ -126,14 +126,14 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
} }
//ui->progressBar->setValue(20); //ui->progressBar->setValue(20);
ui->statusLabel->setText("Loading binary"); ui->statusLabel->setText(tr("Loading binary"));
// options dialog should show the list of archs inside the given fatbin // options dialog should show the list of archs inside the given fatbin
int binidx = 0; // index of subbin int binidx = 0; // index of subbin
main->addOutput(" > Loading file: " + main->getFilename()); main->addOutput(tr(" > Loading file: ") + main->getFilename());
main->core->loadFile(main->getFilename(), loadaddr, mapaddr, rw, va, binidx, load_bininfo); main->core->loadFile(main->getFilename(), loadaddr, mapaddr, rw, va, binidx, load_bininfo);
//ui->progressBar->setValue(40); //ui->progressBar->setValue(40);
ui->statusLabel->setText("Analysis in progress"); ui->statusLabel->setText(tr("Analysis in progress"));
// Threads stuff // Threads stuff
// connect signal/slot // connect signal/slot
@ -189,8 +189,8 @@ void OptionsDialog::on_okButton_clicked()
void OptionsDialog::anal_finished() void OptionsDialog::anal_finished()
{ {
ui->statusLabel->setText("Loading interface"); ui->statusLabel->setText(tr("Loading interface"));
main->addOutput(" > Analysis finished"); main->addOutput(tr(" > Analysis finished"));
QString initial_seek = ui->entry_initialSeek->text(); QString initial_seek = ui->entry_initialSeek->text();
if (initial_seek.length() > 0) if (initial_seek.length() > 0)
@ -241,12 +241,12 @@ void OptionsDialog::on_analSlider_valueChanged(int value)
if (value == 0) if (value == 0)
{ {
ui->analCheckBox->setChecked(false); ui->analCheckBox->setChecked(false);
ui->analCheckBox->setText("Analysis: Disabled"); ui->analCheckBox->setText(tr("Analysis: Disabled"));
} }
else else
{ {
ui->analCheckBox->setChecked(true); ui->analCheckBox->setChecked(true);
ui->analCheckBox->setText("Analysis: Enabled"); ui->analCheckBox->setText(tr("Analysis: Enabled"));
if (value==3) if (value==3)
{ {
ui->analoptionsFrame->setVisible(true); ui->analoptionsFrame->setVisible(true);