Skip to content

Commit 040c0ea

Browse files
author
MarcoFalke
committed
Init: Cleanup error and warning strings
Also update doc/translation_strings_policy.md
1 parent 6782f58 commit 040c0ea

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

doc/translation_strings_policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Try to write translation strings in an understandable way, for both the user and
5252
### Do not translate internal errors
5353

5454
Do not translate internal errors, or log messages, or messages that appear on the RPC interface. If an error is to be shown to the user,
55-
use a generic message, then log the detailed message to the log. E.g. "Error: A fatal internal error occurred, see debug.log for details".
55+
use a translatable generic message, then log the detailed message to the log. E.g. "A fatal internal error occurred, see debug.log for details".
5656
This helps troubleshooting; if the error is the same for everyone, the likelihood is increased that it can be found using a search engine.
5757

5858
### Avoid fragments

src/init.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -690,13 +690,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
690690
#endif
691691

692692
if (!SetupNetworking())
693-
return InitError("Error: Initializing networking failed");
693+
return InitError("Initializing networking failed");
694694

695695
#ifndef WIN32
696696
if (GetBoolArg("-sysperms", false)) {
697697
#ifdef ENABLE_WALLET
698698
if (!GetBoolArg("-disablewallet", false))
699-
return InitError("Error: -sysperms is not allowed in combination with enabled wallet functionality");
699+
return InitError("-sysperms is not allowed in combination with enabled wallet functionality");
700700
#endif
701701
} else {
702702
umask(077);
@@ -826,16 +826,16 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
826826

827827
// Check for -debugnet
828828
if (GetBoolArg("-debugnet", false))
829-
InitWarning(_("Warning: Unsupported argument -debugnet ignored, use -debug=net."));
829+
InitWarning(_("Unsupported argument -debugnet ignored, use -debug=net."));
830830
// Check for -socks - as this is a privacy risk to continue, exit here
831831
if (mapArgs.count("-socks"))
832-
return InitError(_("Error: Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported."));
832+
return InitError(_("Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported."));
833833
// Check for -tor - as this is a privacy risk to continue, exit here
834834
if (GetBoolArg("-tor", false))
835-
return InitError(_("Error: Unsupported argument -tor found, use -onion."));
835+
return InitError(_("Unsupported argument -tor found, use -onion."));
836836

837837
if (GetBoolArg("-benchmark", false))
838-
InitWarning(_("Warning: Unsupported argument -benchmark ignored, use -debug=bench."));
838+
InitWarning(_("Unsupported argument -benchmark ignored, use -debug=bench."));
839839

840840
// Checkmempool and checkblockindex default to true in regtest mode
841841
mempool.setSanityCheck(GetBoolArg("-checkmempool", chainparams.DefaultConsistencyChecks()));
@@ -846,7 +846,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
846846
int64_t nMempoolSizeLimit = GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
847847
int64_t nMempoolDescendantSizeLimit = GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000;
848848
if (nMempoolSizeLimit < 0 || nMempoolSizeLimit < nMempoolDescendantSizeLimit * 40)
849-
return InitError(strprintf(_("Error: -maxmempool must be at least %d MB"), GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) / 25));
849+
return InitError(strprintf(_("-maxmempool must be at least %d MB"), GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) / 25));
850850

851851
// -par=0 means autodetect, but nScriptCheckThreads==0 means no concurrency
852852
nScriptCheckThreads = GetArg("-par", DEFAULT_SCRIPTCHECK_THREADS);
@@ -915,7 +915,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
915915
if (!ParseMoney(mapArgs["-paytxfee"], nFeePerK))
916916
return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s'"), mapArgs["-paytxfee"]));
917917
if (nFeePerK > nHighTransactionFeeWarning)
918-
InitWarning(_("Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction."));
918+
InitWarning(_("-paytxfee is set very high! This is the transaction fee you will pay if you send a transaction."));
919919
payTxFee = CFeeRate(nFeePerK, 1000);
920920
if (payTxFee < ::minRelayTxFee)
921921
{
@@ -929,7 +929,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
929929
if (!ParseMoney(mapArgs["-maxtxfee"], nMaxFee))
930930
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s'"), mapArgs["-maptxfee"]));
931931
if (nMaxFee > nHighTransactionMaxFeeWarning)
932-
InitWarning(_("Warning: -maxtxfee is set very high! Fees this large could be paid on a single transaction."));
932+
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
933933
maxTxFee = nMaxFee;
934934
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
935935
{
@@ -1056,12 +1056,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
10561056
BOOST_FOREACH(string cmt, mapMultiArgs["-uacomment"])
10571057
{
10581058
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
1059-
return InitError(strprintf("User Agent comment (%s) contains unsafe characters.", cmt));
1059+
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
10601060
uacomments.push_back(SanitizeString(cmt, SAFE_CHARS_UA_COMMENT));
10611061
}
10621062
strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments);
10631063
if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) {
1064-
return InitError(strprintf("Total length of network version string %i exceeds maximum of %i characters. Reduce the number and/or size of uacomments.",
1064+
return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of uacomments."),
10651065
strSubVersion.size(), MAX_SUBVERSION_LENGTH));
10661066
}
10671067

@@ -1382,9 +1382,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
13821382
strErrors << _("Error loading wallet.dat: Wallet corrupted") << "\n";
13831383
else if (nLoadWalletRet == DB_NONCRITICAL_ERROR)
13841384
{
1385-
string msg(_("Warning: error reading wallet.dat! All keys read correctly, but transaction data"
1385+
InitWarning(_("Error reading wallet.dat! All keys read correctly, but transaction data"
13861386
" or address book entries might be missing or incorrect."));
1387-
InitWarning(msg);
13881387
}
13891388
else if (nLoadWalletRet == DB_TOO_NEW)
13901389
strErrors << _("Error loading wallet.dat: Wallet requires newer version of Bitcoin Core") << "\n";

0 commit comments

Comments
 (0)