Skip to content

Conversation

@hebasto
Copy link
Member

@hebasto hebasto commented Feb 2, 2019

Currently, related to wallets and wrong command-line/config option values InitError() and InitWarning() contents are translated partially: some are translated, others are not.

This PR make translations of all such messages which are meaningful for a user/translator.

Also this PR prevents command-line/config option names from translation in InitError() and InitWarning() calls (that is not the case in master).

@maflcko
Copy link
Member

maflcko commented Feb 2, 2019

I'd say some of the errors are exceptions that rarely happen and shouldn't be translated

@hebasto hebasto changed the title [WIP] Fix InitError() and InitWarning() content Fix InitError() and InitWarning() content Feb 2, 2019
@hebasto
Copy link
Member Author

hebasto commented Feb 2, 2019

@MarcoFalke added rationale, removed [WIP]

@laanwj
Copy link
Member

laanwj commented Feb 2, 2019

I'd say some of the errors are exceptions that rarely happen and shouldn't be translated

I agree. There's also the problem, especially with extremely rare error messages (such as the secp256k1 failure) that translating them makes them impossible to google. This doesn't really weigh up to the advantage of translating the message if it's very technical in the first place, so translating won't help the user understand it. It also requires the translator to understand which may not be reasonable.

So I'm not convinced this is a good thing.

@hebasto
Copy link
Member Author

hebasto commented Feb 2, 2019

@laanwj

There's also the problem, especially with extremely rare error messages (such as the secp256k1 failure) that translating them makes them impossible to google.

Agree. Should 128148775ee465047c2a9c0e2a92277981b1a4b7 commit be removed completely or InitSanityCheck()-related part only?

@laanwj
Copy link
Member

laanwj commented Feb 2, 2019

I'd say yes.
(coincidentally, too late for this for 0.18, translation string freeze was February 1)

@hebasto
Copy link
Member Author

hebasto commented Feb 2, 2019

@laanwj

(coincidentally, too late for this for 0.18, translation string freeze was February 1)

I know it from the last IRC meeting. 0.18 is not the target for this PR :)

@maflcko maflcko added this to the 0.19.0 milestone Feb 2, 2019
@hebasto hebasto changed the title Fix InitError() and InitWarning() content [WIP] Fix InitError() and InitWarning() content Feb 2, 2019
@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 2, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #16127 (Add support for thread safety annotations when using std::mutex by ajtowns)
  • #16112 (util: Log early messages by MarcoFalke)
  • #15946 (Allow maintaining the blockfilterindex when using prune by jonasschnelli)
  • #15891 (test: Require standard txs in regtest by default by MarcoFalke)
  • #15606 ([experimental] UTXO snapshots by jamesob)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@hebasto hebasto force-pushed the 20190202-initerror branch from fbf9caa to 7eb863e Compare February 2, 2019 23:00
@hebasto
Copy link
Member Author

hebasto commented Feb 2, 2019

Ref: IRC discussion

@hebasto hebasto force-pushed the 20190202-initerror branch from 7eb863e to a224845 Compare February 2, 2019 23:55
@hebasto hebasto changed the title [WIP] Fix InitError() and InitWarning() content Fix InitError() and InitWarning() content Feb 2, 2019
@hebasto
Copy link
Member Author

hebasto commented Feb 2, 2019

I'd say some of the errors are exceptions that rarely happen and shouldn't be translated

Removed translations of error messages inside InitSanityCheck().
PR description updated.

@hebasto
Copy link
Member Author

hebasto commented Feb 3, 2019

Translation Strings Policy:

Anything that appears to the user in the GUI is to be translated. This includes labels, menu items, button texts, tooltips and window titles. This includes messages passed to the GUI through the UI interface through InitMessage, ThreadSafeMessageBox or ShowProgress.

@hebasto
Copy link
Member Author

hebasto commented Feb 3, 2019

Ref: comment by @laanwj:

I think errors relating directly to user options should be kept translated.

@hebasto
Copy link
Member Author

hebasto commented Mar 9, 2019

Rebased.

@hebasto hebasto force-pushed the 20190202-initerror branch from 2c7c01a to 71fcc30 Compare April 23, 2019 19:00
@hebasto
Copy link
Member Author

hebasto commented Apr 23, 2019

Rebased.

enum Network net = ParseNetwork(snet);
if (net == NET_UNROUTABLE)
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet));
return InitError(strprintf(_("Unknown network specified in %s: '%s'"), "-onlynet", snet));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bodies of an if statement should be on the same line or in brackets, imo this could be fixed in this PR

proxyType addrOnion = proxyType(onionProxy, proxyRandomize);
if (!addrOnion.IsValid())
return InitError(strprintf(_("Invalid -onion address or hostname: '%s'"), onionArg));
return InitError(strprintf(_("Invalid %s address or hostname: '%s'"), "-onion", onionArg));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, same line or brackets

LookupSubNet(net.c_str(), subnet);
if (!subnet.IsValid())
return InitError(strprintf(_("Invalid netmask specified in -whitelist: '%s'"), net));
return InitError(strprintf(_("Invalid netmask specified in %s: '%s'"), "-whitelist", net));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, same line or brackets


if (gArgs.GetBoolArg("-sysperms", false))
return InitError("-sysperms is not allowed in combination with enabled wallet functionality");
return InitError(strprintf(_("%s is not allowed in combination with enabled wallet functionality"), "-sysperms"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same line or brackets

return InitError(strprintf(_("%s is not allowed in combination with enabled wallet functionality"), "-sysperms"));
if (gArgs.GetArg("-prune", 0) && gArgs.GetBoolArg("-rescan", false))
return InitError(_("Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again."));
return InitError(strprintf(_("Rescans are not possible in pruned mode. You will need to use %s which will download the whole blockchain again."), "-reindex"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same line or brackets


if (!SetupNetworking())
return InitError("Initializing networking failed");
return InitError(_("Initializing networking failed"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tend to NACK. This will put the translated message into the debug log

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the translation should be registered here only and then later translated in InitError with _()

@hebasto
Copy link
Member Author

hebasto commented Jun 15, 2019

@MarcoFalke

Tend to NACK. This will put the translated message into the debug log

I guess the translation should be registered here only and then later translated in InitError with _()

Agree. There was a dedicated PR #15340.

So, closing this PR now.

@hebasto hebasto closed this Jun 15, 2019
tryphe pushed a commit to tryphe/bitcoin that referenced this pull request Jul 18, 2019
init: nMaxConnections and (nFD-nFDMin) cannot be negative, don't check against 0
init: try to fix Travis note about deducing types
init: try to fix travis again "deduced conflicting types"
init: try a better way through the Travis problem
init: revert old init warning for drahtbot
net: name nit "NUM"->"MAX"_FEELER_CONNCTIONS
init: name nit "NUM"->"MAX"_FEELER_CONNCTIONS
init: fixup typo
@hebasto hebasto deleted the 20190202-initerror branch June 13, 2020 12:57
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants