mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
wallet: Avoid translating RPC errors when loading wallets
Common errors and warnings should be translated when displayed in the GUI, but not translated when displayed elsewhere. The wallet method CreateWalletFromFile does not know its caller, so this commit changes it to return a bilingual_str to the caller.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <interfaces/handler.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <util/string.h>
|
||||
#include <util/translation.h>
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -244,10 +245,10 @@ void CreateWalletActivity::finish()
|
||||
{
|
||||
destroyProgressDialog();
|
||||
|
||||
if (!m_error_message.empty()) {
|
||||
QMessageBox::critical(m_parent_widget, tr("Create wallet failed"), QString::fromStdString(m_error_message));
|
||||
if (!m_error_message.original.empty()) {
|
||||
QMessageBox::critical(m_parent_widget, tr("Create wallet failed"), QString::fromStdString(m_error_message.translated));
|
||||
} else if (!m_warning_message.empty()) {
|
||||
QMessageBox::warning(m_parent_widget, tr("Create wallet warning"), QString::fromStdString(Join(m_warning_message, "\n")));
|
||||
QMessageBox::warning(m_parent_widget, tr("Create wallet warning"), QString::fromStdString(Join(m_warning_message, "\n", OpTranslated)));
|
||||
}
|
||||
|
||||
if (m_wallet_model) Q_EMIT created(m_wallet_model);
|
||||
@@ -285,10 +286,10 @@ void OpenWalletActivity::finish()
|
||||
{
|
||||
destroyProgressDialog();
|
||||
|
||||
if (!m_error_message.empty()) {
|
||||
QMessageBox::critical(m_parent_widget, tr("Open wallet failed"), QString::fromStdString(m_error_message));
|
||||
if (!m_error_message.original.empty()) {
|
||||
QMessageBox::critical(m_parent_widget, tr("Open wallet failed"), QString::fromStdString(m_error_message.translated));
|
||||
} else if (!m_warning_message.empty()) {
|
||||
QMessageBox::warning(m_parent_widget, tr("Open wallet warning"), QString::fromStdString(Join(m_warning_message, "\n")));
|
||||
QMessageBox::warning(m_parent_widget, tr("Open wallet warning"), QString::fromStdString(Join(m_warning_message, "\n", OpTranslated)));
|
||||
}
|
||||
|
||||
if (m_wallet_model) Q_EMIT opened(m_wallet_model);
|
||||
|
||||
Reference in New Issue
Block a user