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

View File

@ -8,13 +8,13 @@ AboutDialog::AboutDialog(QWidget *parent) :
{
ui->setupUi(this);
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
ui->label->setText("<h1>Iaito</h1>"
ui->label->setText(tr("<h1>Iaito</h1>"
"Version 1.0 alpha<br />"
"Using r2-" R2_GITTAP
"<h2>License</h2>"
"This Software is released under the GNU General Public License v3.0"
"<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()

View File

@ -24,7 +24,7 @@ int main(int argc, char *argv[])
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.addVersionOption();
cmd_parser.addPositionalArgument("filename", QObject::tr("Filename to open."));
@ -47,8 +47,8 @@ int main(int argc, char *argv[])
msg.setIcon(QMessageBox::Critical);
msg.setWindowIcon(QIcon(":/img/logo-small.png"));
msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msg.setWindowTitle("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.setWindowTitle(QObject::tr("Version mismatch!"));
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)
return 1;
}

View File

@ -345,7 +345,7 @@ void MainWindow::finalizeOpen()
core->setSettings();
addOutput(" > Populating UI");
addOutput(tr(" > Populating UI"));
// FIXME: initialization order frakup. the next line is needed so that the
// comments widget displays the function names.
core->cmd("fs sections");
@ -364,9 +364,9 @@ void MainWindow::finalizeOpen()
}
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");
}
@ -374,7 +374,7 @@ void MainWindow::finalizeOpen()
this->core->binStart = this->core->cmd("?v $M");
this->core->binEnd = this->core->cmd("?v $M+$s");
addOutput(" > Finished, happy reversing :)");
addOutput(tr(" > Finished, happy reversing :)"));
// Add fortune message
addOutput("\n" + core->cmd("fo"));
memoryDock->setWindowTitle("entry0");
@ -449,7 +449,7 @@ void MainWindow::saveProject()
QString notes = this->notepadDock->textToBase64();
//this->add_debug_output(notes);
this->core->cmd("Pnj " + notes);
this->addOutput("Project saved: " + project_name);
this->addOutput(tr("Project saved: ") + project_name);
}
void MainWindow::start_web_server()
@ -501,7 +501,7 @@ void MainWindow::setFilename(const QString &fn)
void MainWindow::closeEvent(QCloseEvent *event)
{
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));
//qDebug() << ret;
if (ret == QMessageBox::Save)
@ -963,7 +963,7 @@ void MainWindow::on_actionRun_Script_triggered()
dialog.setDirectory(QDir::home());
QString fileName;
fileName = dialog.getOpenFileName(this, "Select radare2 script");
fileName = dialog.getOpenFileName(this, tr("Select radare2 script"));
if (!fileName.length()) //cancel was pressed
return;
@ -1047,7 +1047,7 @@ void MainWindow::on_actionReset_settings_triggered()
{
QMessageBox::StandardButton ret =
(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);
if (ret == QMessageBox::Ok)
{

View File

@ -99,7 +99,7 @@ void NewFileDialog::on_loadFileButton_clicked()
if (!checkfile.exists() || !checkfile.isFile())
{
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();
}
else
@ -132,7 +132,7 @@ void NewFileDialog::on_newFileButton_clicked()
dialog.setDirectory(QDir::home());
QString fileName;
fileName = dialog.getOpenFileName(this, "Select file");
fileName = dialog.getOpenFileName(this, tr("Select file"));
if (!fileName.isEmpty())
{

View File

@ -70,7 +70,7 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
ui->progressBar->setVisible(1);
ui->statusLabel->setVisible(1);
ui->statusLabel->setText("Starting analysis");
ui->statusLabel->setText(tr("Starting analysis"));
//ui->progressBar->setValue(5);
int va = ui->vaCheckBox->isChecked();
@ -126,14 +126,14 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
}
//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
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);
//ui->progressBar->setValue(40);
ui->statusLabel->setText("Analysis in progress");
ui->statusLabel->setText(tr("Analysis in progress"));
// Threads stuff
// connect signal/slot
@ -189,8 +189,8 @@ void OptionsDialog::on_okButton_clicked()
void OptionsDialog::anal_finished()
{
ui->statusLabel->setText("Loading interface");
main->addOutput(" > Analysis finished");
ui->statusLabel->setText(tr("Loading interface"));
main->addOutput(tr(" > Analysis finished"));
QString initial_seek = ui->entry_initialSeek->text();
if (initial_seek.length() > 0)
@ -241,12 +241,12 @@ void OptionsDialog::on_analSlider_valueChanged(int value)
if (value == 0)
{
ui->analCheckBox->setChecked(false);
ui->analCheckBox->setText("Analysis: Disabled");
ui->analCheckBox->setText(tr("Analysis: Disabled"));
}
else
{
ui->analCheckBox->setChecked(true);
ui->analCheckBox->setText("Analysis: Enabled");
ui->analCheckBox->setText(tr("Analysis: Enabled"));
if (value==3)
{
ui->analoptionsFrame->setVisible(true);