Strings for translation

This commit is contained in:
Aditya Kulkarni
2018-11-27 14:14:39 -08:00
parent 68b138e5b3
commit e1f1741384
7 changed files with 25 additions and 24 deletions

View File

@@ -124,7 +124,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) {
if (!addr.isEmpty() && !ab.label->text().isEmpty()) { if (!addr.isEmpty() && !ab.label->text().isEmpty()) {
// Test if address is valid. // Test if address is valid.
if (!Settings::isValidAddress(addr)) { 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 { } else {
model.addNewLabel(ab.label->text(), ab.addr->text()); 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); 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()); model.removeItemAt(index.row());
}); });

View File

@@ -12,6 +12,7 @@ int main(int argc, char *argv[])
QApplication a(argc, argv); QApplication a(argc, argv);
QString locale = QLocale::system().name(); QString locale = QLocale::system().name();
qDebug() << "Loading locale " << locale;
QTranslator translator; QTranslator translator;
translator.load(QString(":/translations/res/zec_qt_wallet_") + locale); translator.load(QString(":/translations/res/zec_qt_wallet_") + locale);

View File

@@ -347,7 +347,7 @@ void RPC::noConnection() {
main->statusIcon->setToolTip(""); main->statusIcon->setToolTip("");
main->statusLabel->setText(QObject::tr("No Connection")); main->statusLabel->setText(QObject::tr("No Connection"));
main->statusLabel->setToolTip(""); main->statusLabel->setToolTip("");
main->ui->statusBar->showMessage("No Connection", 1000); main->ui->statusBar->showMessage(QObject::tr("No Connection"), 1000);
// Clear balances table. // Clear balances table.
QMap<QString, double> emptyBalances; QMap<QString, double> emptyBalances;
@@ -572,25 +572,25 @@ void RPC::getInfoThenRefresh(bool force) {
} }
txt = txt % " ( " % QString::number(progress * 100, 'f', 0) % "% )"; txt = txt % " ( " % QString::number(progress * 100, 'f', 0) % "% )";
ui->blockheight->setText(txt); ui->blockheight->setText(txt);
ui->heightLabel->setText("Downloading blocks"); ui->heightLabel->setText(QObject::tr("Downloading blocks"));
} else { } else {
ui->blockheight->setText(QString::number(blockNumber)); ui->blockheight->setText(QString::number(blockNumber));
ui->heightLabel->setText("Block height"); ui->heightLabel->setText(QObject::tr("Block height"));
} }
} }
// Update the status bar // Update the status bar
QString statusText = QString() % 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) % QString::number(blockNumber) %
(isSyncing ? ("/" % QString::number(progress*100, 'f', 0) % "%") : QString()) % (isSyncing ? ("/" % QString::number(progress*100, 'f', 0) % "%") : QString()) %
")"; ")";
main->statusLabel->setText(statusText); main->statusLabel->setText(statusText);
auto zecPrice = Settings::getUSDFormat(1); auto zecPrice = Settings::getUSDFormat(1);
QString tooltip = "Connected to zcashd";; QString tooltip = QObject::tr("Connected to zcashd");
if (!zecPrice.isEmpty()) { if (!zecPrice.isEmpty()) {
tooltip = "1 ZEC = " % zecPrice % "\n" % tooltip; tooltip = "1 ZEC = " % zecPrice % "\n" % tooltip;
} }
@@ -606,7 +606,7 @@ void RPC::getInfoThenRefresh(bool force) {
static bool shown = false; static bool shown = false;
if (!shown && prevCallSucceeded) { // show error only first time if (!shown && prevCallSucceeded) { // show error only first time
shown = true; 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); + reply->errorString(), QMessageBox::StandardButton::Ok);
shown = false; shown = false;
} }
@@ -844,15 +844,15 @@ void RPC::watchTxStatus() {
auto errorMsg = QString::fromStdString(it["error"]["message"]); auto errorMsg = QString::fromStdString(it["error"]["message"]);
QMessageBox msg( QMessageBox msg(
QMessageBox::Critical, QMessageBox::Critical,
"Transaction Error", QObject::tr("Transaction Error"),
"The transaction with id " % id % " failed. The error was:\n\n" % errorMsg, QObject::tr("The transaction with id ") % id % QObject::tr(" failed. The error was") + ":\n\n" + errorMsg,
QMessageBox::Ok, QMessageBox::Ok,
main main
); );
watchingOps.remove(id); 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); main->loadingLabel->setVisible(false);
msg.exec(); msg.exec();
@@ -871,7 +871,7 @@ void RPC::watchTxStatus() {
main->loadingLabel->setVisible(false); main->loadingLabel->setVisible(false);
} else { } else {
main->loadingLabel->setVisible(true); 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; Ui_ConnectionDialog connD;
connD.setupUi(&d); connD.setupUi(&d);
connD.topIcon->setBasePixmap(QIcon(":/icons/res/icon.ico").pixmap(256, 256)); connD.topIcon->setBasePixmap(QIcon(":/icons/res/icon.ico").pixmap(256, 256));
connD.status->setText("Please wait for zec-qt-wallet to exit"); connD.status->setText(QObject::tr("Please wait for zec-qt-wallet to exit"));
connD.statusDetail->setText("Waiting for zcashd to exit"); connD.statusDetail->setText(QObject::tr("Waiting for zcashd to exit"));
QTimer waiter(main); QTimer waiter(main);

View File

@@ -584,7 +584,7 @@ void MainWindow::sendButton() {
// And send the Tx // And send the Tx
rpc->sendZTransaction(params, [=](const json& reply) { rpc->sendZTransaction(params, [=](const json& reply) {
QString opid = QString::fromStdString(reply.get<json::string_t>()); QString opid = QString::fromStdString(reply.get<json::string_t>());
ui->statusBar->showMessage("Computing Tx: " % opid); ui->statusBar->showMessage(tr("Computing Tx: ") % opid);
// And then start monitoring the transaction // And then start monitoring the transaction
rpc->addNewTxToWatch(tx, opid); rpc->addNewTxToWatch(tx, opid);

View File

@@ -166,7 +166,7 @@ QString Settings::getZECUSDDisplayFormat(double bal) {
return getZECDisplayFormat(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() { QString Settings::getTokenName() {
if (Settings::getInstance()->isTestnet()) { if (Settings::getInstance()->isTestnet()) {

View File

@@ -116,8 +116,8 @@ void Turnstile::planMigration(QString zaddr, QString destAddr, int numsplits, in
if (migItems.empty()) { if (migItems.empty()) {
// Show error and abort // Show error and abort
QMessageBox::warning(mainwindow, QMessageBox::warning(mainwindow,
"Locked funds", QObject::tr("Locked funds"),
"Could not initiate migration.\nYou either have unconfirmed funds or the balance is too low for an automatic migration."); QObject::tr("Could not initiate migration.\nYou either have unconfirmed funds or the balance is too low for an automatic migration."));
return; return;
} }
@@ -357,7 +357,7 @@ void Turnstile::doSendTx(Tx tx, std::function<void(void)> cb) {
rpc->sendZTransaction(params, [=] (const json& reply) { rpc->sendZTransaction(params, [=] (const json& reply) {
QString opid = QString::fromStdString(reply.get<json::string_t>()); QString opid = QString::fromStdString(reply.get<json::string_t>());
//qDebug() << opid; //qDebug() << opid;
mainwindow->ui->statusBar->showMessage("Computing Tx: " % opid); mainwindow->ui->statusBar->showMessage(QObject::tr("Computing Tx: ") % opid);
// And then start monitoring the transaction // And then start monitoring the transaction
rpc->addNewTxToWatch(tx, opid); rpc->addNewTxToWatch(tx, opid);

View File

@@ -4,7 +4,7 @@
TxTableModel::TxTableModel(QObject *parent) TxTableModel::TxTableModel(QObject *parent)
: QAbstractTableModel(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() { TxTableModel::~TxTableModel() {