diff --git a/src/addressbook.cpp b/src/addressbook.cpp index 85f9e56..f778ed5 100644 --- a/src/addressbook.cpp +++ b/src/addressbook.cpp @@ -124,7 +124,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) { if (!addr.isEmpty() && !ab.label->text().isEmpty()) { // Test if address is valid. if (!Settings::isValidAddress(addr)) { - QMessageBox::critical(parent, "Address Format Error", addr + " doesn't seem to be a valid Zcash address.", QMessageBox::Ok); + QMessageBox::critical(parent, QObject::tr("Address Format Error"), addr + QObject::tr(" doesn't seem to be a valid Zcash address."), QMessageBox::Ok); } else { model.addNewLabel(ab.label->text(), ab.addr->text()); } @@ -168,12 +168,12 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) { }); } - menu.addAction("Copy address", [&] () { + menu.addAction(QObject::tr("Copy address"), [&] () { QGuiApplication::clipboard()->setText(addr); - parent->ui->statusBar->showMessage("Copied to clipboard", 3 * 1000); + parent->ui->statusBar->showMessage(QObject::tr("Copied to clipboard"), 3 * 1000); }); - menu.addAction("Delete label", [&] () { + menu.addAction(QObject::tr("Delete label"), [&] () { model.removeItemAt(index.row()); }); diff --git a/src/main.cpp b/src/main.cpp index dea67b6..a11c5ab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,7 +12,8 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); QString locale = QLocale::system().name(); - + qDebug() << "Loading locale " << locale; + QTranslator translator; translator.load(QString(":/translations/res/zec_qt_wallet_") + locale); a.installTranslator(&translator); diff --git a/src/rpc.cpp b/src/rpc.cpp index 3ff3eb0..022b225 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -347,7 +347,7 @@ void RPC::noConnection() { main->statusIcon->setToolTip(""); main->statusLabel->setText(QObject::tr("No Connection")); main->statusLabel->setToolTip(""); - main->ui->statusBar->showMessage("No Connection", 1000); + main->ui->statusBar->showMessage(QObject::tr("No Connection"), 1000); // Clear balances table. QMap emptyBalances; @@ -572,25 +572,25 @@ void RPC::getInfoThenRefresh(bool force) { } txt = txt % " ( " % QString::number(progress * 100, 'f', 0) % "% )"; ui->blockheight->setText(txt); - ui->heightLabel->setText("Downloading blocks"); + ui->heightLabel->setText(QObject::tr("Downloading blocks")); } else { ui->blockheight->setText(QString::number(blockNumber)); - ui->heightLabel->setText("Block height"); + ui->heightLabel->setText(QObject::tr("Block height")); } } // Update the status bar QString statusText = QString() % - (isSyncing ? "Syncing" : "Connected") % + (isSyncing ? QObject::tr("Syncing") : QObject::tr("Connected")) % " (" % - (Settings::getInstance()->isTestnet() ? "testnet:" : "") % + (Settings::getInstance()->isTestnet() ? QObject::tr("testnet:") : "") % QString::number(blockNumber) % (isSyncing ? ("/" % QString::number(progress*100, 'f', 0) % "%") : QString()) % ")"; main->statusLabel->setText(statusText); auto zecPrice = Settings::getUSDFormat(1); - QString tooltip = "Connected to zcashd";; + QString tooltip = QObject::tr("Connected to zcashd"); if (!zecPrice.isEmpty()) { tooltip = "1 ZEC = " % zecPrice % "\n" % tooltip; } @@ -606,7 +606,7 @@ void RPC::getInfoThenRefresh(bool force) { static bool shown = false; if (!shown && prevCallSucceeded) { // show error only first time shown = true; - QMessageBox::critical(main, "Connection Error", "There was an error connecting to zcashd. The error was: \n\n" + QMessageBox::critical(main, QObject::tr("Connection Error"), QObject::tr("There was an error connecting to zcashd. The error was") + ": \n\n" + reply->errorString(), QMessageBox::StandardButton::Ok); shown = false; } @@ -844,15 +844,15 @@ void RPC::watchTxStatus() { auto errorMsg = QString::fromStdString(it["error"]["message"]); QMessageBox msg( QMessageBox::Critical, - "Transaction Error", - "The transaction with id " % id % " failed. The error was:\n\n" % errorMsg, + QObject::tr("Transaction Error"), + QObject::tr("The transaction with id ") % id % QObject::tr(" failed. The error was") + ":\n\n" + errorMsg, QMessageBox::Ok, main ); watchingOps.remove(id); - main->ui->statusBar->showMessage(" Tx " % id % " failed", 15 * 1000); + main->ui->statusBar->showMessage(QObject::tr(" Tx ") % id % QObject::tr(" failed"), 15 * 1000); main->loadingLabel->setVisible(false); msg.exec(); @@ -871,7 +871,7 @@ void RPC::watchTxStatus() { main->loadingLabel->setVisible(false); } else { main->loadingLabel->setVisible(true); - main->loadingLabel->setToolTip(QString::number(watchingOps.size()) + " tx computing. This can take several minutes."); + main->loadingLabel->setToolTip(QString::number(watchingOps.size()) + QObject::tr(" tx computing. This can take several minutes.")); } }); } @@ -950,8 +950,8 @@ void RPC::shutdownZcashd() { Ui_ConnectionDialog connD; connD.setupUi(&d); connD.topIcon->setBasePixmap(QIcon(":/icons/res/icon.ico").pixmap(256, 256)); - connD.status->setText("Please wait for zec-qt-wallet to exit"); - connD.statusDetail->setText("Waiting for zcashd to exit"); + connD.status->setText(QObject::tr("Please wait for zec-qt-wallet to exit")); + connD.statusDetail->setText(QObject::tr("Waiting for zcashd to exit")); QTimer waiter(main); diff --git a/src/sendtab.cpp b/src/sendtab.cpp index 38fd1dc..1950f52 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -584,7 +584,7 @@ void MainWindow::sendButton() { // And send the Tx rpc->sendZTransaction(params, [=](const json& reply) { QString opid = QString::fromStdString(reply.get()); - ui->statusBar->showMessage("Computing Tx: " % opid); + ui->statusBar->showMessage(tr("Computing Tx: ") % opid); // And then start monitoring the transaction rpc->addNewTxToWatch(tx, opid); diff --git a/src/settings.cpp b/src/settings.cpp index fb77c6c..7304f6d 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -166,7 +166,7 @@ QString Settings::getZECUSDDisplayFormat(double bal) { return getZECDisplayFormat(bal); } -const QString Settings::txidStatusMessage = QString("Tx submitted (right click to copy) txid:"); +const QString Settings::txidStatusMessage = QString(tr("Tx submitted (right click to copy) txid:")); QString Settings::getTokenName() { if (Settings::getInstance()->isTestnet()) { diff --git a/src/turnstile.cpp b/src/turnstile.cpp index 95b1bbe..a2e1c2c 100644 --- a/src/turnstile.cpp +++ b/src/turnstile.cpp @@ -116,8 +116,8 @@ void Turnstile::planMigration(QString zaddr, QString destAddr, int numsplits, in if (migItems.empty()) { // Show error and abort QMessageBox::warning(mainwindow, - "Locked funds", - "Could not initiate migration.\nYou either have unconfirmed funds or the balance is too low for an automatic migration."); + QObject::tr("Locked funds"), + QObject::tr("Could not initiate migration.\nYou either have unconfirmed funds or the balance is too low for an automatic migration.")); return; } @@ -357,7 +357,7 @@ void Turnstile::doSendTx(Tx tx, std::function cb) { rpc->sendZTransaction(params, [=] (const json& reply) { QString opid = QString::fromStdString(reply.get()); //qDebug() << opid; - mainwindow->ui->statusBar->showMessage("Computing Tx: " % opid); + mainwindow->ui->statusBar->showMessage(QObject::tr("Computing Tx: ") % opid); // And then start monitoring the transaction rpc->addNewTxToWatch(tx, opid); diff --git a/src/txtablemodel.cpp b/src/txtablemodel.cpp index 7f9ecd3..d610b47 100644 --- a/src/txtablemodel.cpp +++ b/src/txtablemodel.cpp @@ -4,7 +4,7 @@ TxTableModel::TxTableModel(QObject *parent) : QAbstractTableModel(parent) { - headers << "Type" << "Address" << "Date/Time" << "Amount"; + headers << QObject::tr("Type") << QObject::tr("Address") << QObject::tr("Date/Time") << QObject::tr("Amount"); } TxTableModel::~TxTableModel() {