Merge #16745: wallet: Translate all initErrors in CreateWalletFromFile
fa61365a13
wallet: Translate all initErrors in CreateWalletFromFile (MarcoFalke)fa70d199d0
util: Make util/error bilingual_str (refactor) (MarcoFalke) Pull request description: The translations are going to close in three days (#15940), so I am submitting this as a standalone pull request. Those changes are part of a bugfix #16661, which includes a test. The first change (the refactor) is required, the second commit is not. I am happy to drop it, if needed. ACKs for top commit: laanwj: utACKfa61365a13
hebasto: ACKfa61365a13
, I have tested the code on Linux Mint 19.2. Tree-SHA512: a7616cc38b9ffd301c6b915ea808a65815c3d97e9f57ec091772eb260e5cf0d75a13a6e4dfa3913e236833677c7929b9a748cb7d7a0e406d51749944b614e11b
This commit is contained in:
commit
6e431296da
4 changed files with 24 additions and 21 deletions
|
@ -1060,7 +1060,7 @@ bool AppInitParameterInteraction()
|
|||
{
|
||||
CAmount n = 0;
|
||||
if (!ParseMoney(gArgs.GetArg("-incrementalrelayfee", ""), n))
|
||||
return InitError(AmountErrMsg("incrementalrelayfee", gArgs.GetArg("-incrementalrelayfee", "")));
|
||||
return InitError(AmountErrMsg("incrementalrelayfee", gArgs.GetArg("-incrementalrelayfee", "")).translated);
|
||||
incrementalRelayFee = CFeeRate(n);
|
||||
}
|
||||
|
||||
|
@ -1104,7 +1104,7 @@ bool AppInitParameterInteraction()
|
|||
if (gArgs.IsArgSet("-minrelaytxfee")) {
|
||||
CAmount n = 0;
|
||||
if (!ParseMoney(gArgs.GetArg("-minrelaytxfee", ""), n)) {
|
||||
return InitError(AmountErrMsg("minrelaytxfee", gArgs.GetArg("-minrelaytxfee", "")));
|
||||
return InitError(AmountErrMsg("minrelaytxfee", gArgs.GetArg("-minrelaytxfee", "")).translated);
|
||||
}
|
||||
// High fee check is done afterward in WalletParameterInteraction()
|
||||
::minRelayTxFee = CFeeRate(n);
|
||||
|
@ -1120,7 +1120,7 @@ bool AppInitParameterInteraction()
|
|||
{
|
||||
CAmount n = 0;
|
||||
if (!ParseMoney(gArgs.GetArg("-blockmintxfee", ""), n))
|
||||
return InitError(AmountErrMsg("blockmintxfee", gArgs.GetArg("-blockmintxfee", "")));
|
||||
return InitError(AmountErrMsg("blockmintxfee", gArgs.GetArg("-blockmintxfee", "")).translated);
|
||||
}
|
||||
|
||||
// Feerate used to define dust. Shouldn't be changed lightly as old
|
||||
|
@ -1129,7 +1129,7 @@ bool AppInitParameterInteraction()
|
|||
{
|
||||
CAmount n = 0;
|
||||
if (!ParseMoney(gArgs.GetArg("-dustrelayfee", ""), n))
|
||||
return InitError(AmountErrMsg("dustrelayfee", gArgs.GetArg("-dustrelayfee", "")));
|
||||
return InitError(AmountErrMsg("dustrelayfee", gArgs.GetArg("-dustrelayfee", "")).translated);
|
||||
dustRelayFee = CFeeRate(n);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,12 +41,12 @@ std::string ResolveErrMsg(const std::string& optname, const std::string& strBind
|
|||
return strprintf(_("Cannot resolve -%s address: '%s'").translated, optname, strBind);
|
||||
}
|
||||
|
||||
std::string AmountHighWarn(const std::string& optname)
|
||||
bilingual_str AmountHighWarn(const std::string& optname)
|
||||
{
|
||||
return strprintf(_("%s is set very high!").translated, optname);
|
||||
return strprintf(_("%s is set very high!"), optname);
|
||||
}
|
||||
|
||||
std::string AmountErrMsg(const std::string& optname, const std::string& strValue)
|
||||
bilingual_str AmountErrMsg(const std::string& optname, const std::string& strValue)
|
||||
{
|
||||
return strprintf(_("Invalid amount for -%s=<amount>: '%s'").translated, optname, strValue);
|
||||
return strprintf(_("Invalid amount for -%s=<amount>: '%s'"), optname, strValue);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
struct bilingual_str;
|
||||
|
||||
enum class TransactionError {
|
||||
OK, //!< No error
|
||||
MISSING_INPUTS,
|
||||
|
@ -34,8 +36,8 @@ std::string TransactionErrorString(const TransactionError error);
|
|||
|
||||
std::string ResolveErrMsg(const std::string& optname, const std::string& strBind);
|
||||
|
||||
std::string AmountHighWarn(const std::string& optname);
|
||||
bilingual_str AmountHighWarn(const std::string& optname);
|
||||
|
||||
std::string AmountErrMsg(const std::string& optname, const std::string& strValue);
|
||||
bilingual_str AmountErrMsg(const std::string& optname, const std::string& strValue);
|
||||
|
||||
#endif // BITCOIN_UTIL_ERROR_H
|
||||
|
|
|
@ -4387,23 +4387,23 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
|||
}
|
||||
|
||||
if (!gArgs.GetArg("-addresstype", "").empty() && !ParseOutputType(gArgs.GetArg("-addresstype", ""), walletInstance->m_default_address_type)) {
|
||||
chain.initError(strprintf("Unknown address type '%s'", gArgs.GetArg("-addresstype", "")));
|
||||
chain.initError(strprintf(_("Unknown address type '%s'").translated, gArgs.GetArg("-addresstype", "")));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!gArgs.GetArg("-changetype", "").empty() && !ParseOutputType(gArgs.GetArg("-changetype", ""), walletInstance->m_default_change_type)) {
|
||||
chain.initError(strprintf("Unknown change type '%s'", gArgs.GetArg("-changetype", "")));
|
||||
chain.initError(strprintf(_("Unknown change type '%s'").translated, gArgs.GetArg("-changetype", "")));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (gArgs.IsArgSet("-mintxfee")) {
|
||||
CAmount n = 0;
|
||||
if (!ParseMoney(gArgs.GetArg("-mintxfee", ""), n) || 0 == n) {
|
||||
chain.initError(AmountErrMsg("mintxfee", gArgs.GetArg("-mintxfee", "")));
|
||||
chain.initError(AmountErrMsg("mintxfee", gArgs.GetArg("-mintxfee", "")).translated);
|
||||
return nullptr;
|
||||
}
|
||||
if (n > HIGH_TX_FEE_PER_KB) {
|
||||
chain.initWarning(AmountHighWarn("-mintxfee") + " " +
|
||||
chain.initWarning(AmountHighWarn("-mintxfee").translated + " " +
|
||||
_("This is the minimum transaction fee you pay on every transaction.").translated);
|
||||
}
|
||||
walletInstance->m_min_fee = CFeeRate(n);
|
||||
|
@ -4417,7 +4417,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
|||
return nullptr;
|
||||
}
|
||||
if (nFeePerK > HIGH_TX_FEE_PER_KB) {
|
||||
chain.initWarning(AmountHighWarn("-fallbackfee") + " " +
|
||||
chain.initWarning(AmountHighWarn("-fallbackfee").translated + " " +
|
||||
_("This is the transaction fee you may pay when fee estimates are not available.").translated);
|
||||
}
|
||||
walletInstance->m_fallback_fee = CFeeRate(nFeePerK);
|
||||
|
@ -4430,7 +4430,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
|||
return nullptr;
|
||||
}
|
||||
if (nFeePerK > HIGH_TX_FEE_PER_KB) {
|
||||
chain.initWarning(AmountHighWarn("-discardfee") + " " +
|
||||
chain.initWarning(AmountHighWarn("-discardfee").translated + " " +
|
||||
_("This is the transaction fee you may discard if change is smaller than dust at this level").translated);
|
||||
}
|
||||
walletInstance->m_discard_rate = CFeeRate(nFeePerK);
|
||||
|
@ -4438,11 +4438,11 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
|||
if (gArgs.IsArgSet("-paytxfee")) {
|
||||
CAmount nFeePerK = 0;
|
||||
if (!ParseMoney(gArgs.GetArg("-paytxfee", ""), nFeePerK)) {
|
||||
chain.initError(AmountErrMsg("paytxfee", gArgs.GetArg("-paytxfee", "")));
|
||||
chain.initError(AmountErrMsg("paytxfee", gArgs.GetArg("-paytxfee", "")).translated);
|
||||
return nullptr;
|
||||
}
|
||||
if (nFeePerK > HIGH_TX_FEE_PER_KB) {
|
||||
chain.initWarning(AmountHighWarn("-paytxfee") + " " +
|
||||
chain.initWarning(AmountHighWarn("-paytxfee").translated + " " +
|
||||
_("This is the transaction fee you will pay if you send a transaction.").translated);
|
||||
}
|
||||
walletInstance->m_pay_tx_fee = CFeeRate(nFeePerK, 1000);
|
||||
|
@ -4457,7 +4457,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
|||
{
|
||||
CAmount nMaxFee = 0;
|
||||
if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee)) {
|
||||
chain.initError(AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", "")));
|
||||
chain.initError(AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", "")).translated);
|
||||
return nullptr;
|
||||
}
|
||||
if (nMaxFee > HIGH_MAX_TX_FEE) {
|
||||
|
@ -4471,9 +4471,10 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
|||
walletInstance->m_default_max_tx_fee = nMaxFee;
|
||||
}
|
||||
|
||||
if (chain.relayMinFee().GetFeePerK() > HIGH_TX_FEE_PER_KB)
|
||||
chain.initWarning(AmountHighWarn("-minrelaytxfee") + " " +
|
||||
if (chain.relayMinFee().GetFeePerK() > HIGH_TX_FEE_PER_KB) {
|
||||
chain.initWarning(AmountHighWarn("-minrelaytxfee").translated + " " +
|
||||
_("The wallet will avoid paying less than the minimum relay fee.").translated);
|
||||
}
|
||||
|
||||
walletInstance->m_confirm_target = gArgs.GetArg("-txconfirmtarget", DEFAULT_TX_CONFIRM_TARGET);
|
||||
walletInstance->m_spend_zero_conf_change = gArgs.GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE);
|
||||
|
|
Loading…
Reference in a new issue