Merge bitcoin-core/gui#345: Connection Type Translator Comments

4832737c7dcc87afea5e1e88945ec311417aa876 qt: connection type translator comments (Jarol Rodriguez)

Pull request description:

  This PR introduces Qt translator comments for `Connection Type` strings in `guiutil.cpp` as well as `rpcconsole.cpp`.

  This is an alternate implementation of the idea presented in the last three commits of #289. It is especially inspired by commit 842f4e834dfe5fd2786a5092f78ea28da1b36e4f.

  Per [Qt Dev Notes](https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Developer-Notes-for-Qt-Code), it is better to not break up strings when not necessary. This way we preserve the full context for translators.

ACKs for top commit:
  jonatack:
    Code review re-ACK 4832737c7dcc87afea5e1e88945ec311417aa876 per `git diff 371e2b9 4832737`, changes are translator comment edits since my review yesterday (thank you for updating)
  hebasto:
    ACK 4832737c7dcc87afea5e1e88945ec311417aa876

Tree-SHA512: 67e1741e10a2e30cde6d50d3293eec89f0b7641b34463865dc6909d2926cdcf33a7d8c1dc8055d2f85906ad2002cdaa594d37b184d16e2f06614b6c5ad00c982
This commit is contained in:
Hennadii Stepanov 2021-09-29 11:52:38 +03:00 committed by pasta
parent 688b66e9d1
commit 8e0abeb1c1
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
2 changed files with 27 additions and 1 deletions

View File

@ -1673,14 +1673,26 @@ QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction
{
QString prefix;
if (prepend_direction) {
prefix = (conn_type == ConnectionType::INBOUND) ? QObject::tr("Inbound") : QObject::tr("Outbound") + " ";
prefix = (conn_type == ConnectionType::INBOUND) ?
/*: An inbound connection from a peer. An inbound connection
is a connection initiated by a peer. */
QObject::tr("Inbound") :
/*: An outbound connection to a peer. An outbound connection
is a connection initiated by us. */
QObject::tr("Outbound") + " ";
}
switch (conn_type) {
case ConnectionType::INBOUND: return prefix;
//: Peer connection type that relays all network information.
case ConnectionType::OUTBOUND_FULL_RELAY: return prefix + QObject::tr("Full Relay");
/*: Peer connection type that relays network information about
blocks and not transactions or addresses. */
case ConnectionType::BLOCK_RELAY: return prefix + QObject::tr("Block Relay");
//: Peer connection type established manually through one of several methods.
case ConnectionType::MANUAL: return prefix + QObject::tr("Manual");
//: Short-lived peer connection type that tests the aliveness of known addresses.
case ConnectionType::FEELER: return prefix + QObject::tr("Feeler");
//: Short-lived peer connection type that solicits known addresses from a peer.
case ConnectionType::ADDR_FETCH: return prefix + QObject::tr("Address Fetch");
} // no default case, so the compiler can warn about missing cases
assert(false);

View File

@ -503,14 +503,28 @@ RPCConsole::RPCConsole(interfaces::Node& node, QWidget* parent, Qt::WindowFlags
constexpr QChar nonbreaking_hyphen(8209);
const std::vector<QString> CONNECTION_TYPE_DOC{
//: Explanatory text for an inbound peer connection.
tr("Inbound: initiated by peer"),
/*: Explanatory text for an outbound peer connection that
relays all network information. This is the default behavior for
outbound connections. */
tr("Outbound Full Relay: default"),
/*: Explanatory text for an outbound peer connection that relays
network information about blocks and not transactions or addresses. */
tr("Outbound Block Relay: does not relay transactions or addresses"),
/*: Explanatory text for an outbound peer connection that was
established manually through one of several methods. The numbered
arguments are stand-ins for the methods available to establish
manual connections. */
tr("Outbound Manual: added using RPC %1 or %2/%3 configuration options")
.arg("addnode")
.arg(QString(nonbreaking_hyphen) + "addnode")
.arg(QString(nonbreaking_hyphen) + "connect"),
/*: Explanatory text for a short-lived outbound peer connection that
is used to test the aliveness of known addresses. */
tr("Outbound Feeler: short-lived, for testing addresses"),
/*: Explanatory text for a short-lived outbound peer connection that is used
to request addresses from a peer. */
tr("Outbound Address Fetch: short-lived, for soliciting addresses")};
const QString list{"<ul><li>" + Join(CONNECTION_TYPE_DOC, QString("</li><li>")) + "</li></ul>"};
ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(list));