mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
util: Make util/error bilingual_str (refactor)
Translated strings should not end up in the debug log, stderr, or returned by an RPC. Changing the util methods in util/error to return a bilingual_str paves the way to achieve this goal in the long term.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user